Allow uploading simple linear history with Git.
Review Request #6787 — Created Jan. 16, 2015 and submitted
The default behaviour for posting is now to determine the capabilities
of the server to see if it supports creating a review request with
commit history. The user can specify the-S
/--squash-history
option orSQUASH_HISTORY
config option in.reviewboardrc
to
override this. However, the configuration option can itself be
overridden by the-H
/--with-history
flag.Currently the only
SCMClient
s that "supports" this flag is Git.Add the
DiffCommitResource
andDiffCommitListResource
resources to
the RBTools web API resources. TheDiffCommitListResource
handles
the uploading of commits via theupload_commit
method.Add the
create_empty_diffset
method to theDiffListResource
class.
This method is used to create an emptyDiffSet
so that a review
request can be created with commit history.Add the
get_history
method to theSCMClient
class. This method
gets a linear history of commit metadata given some revisions.The commit histories that can be uploaded by this change are simple
linear ones; that is, they must be linear histories (with no merges)
and diffs in commits should not overlap with respect to files.
Uploaded commits containing diffs to Review Board on the
dvcs
branch.
Description | From | Last Updated |
---|---|---|
One blank line. |
chipx86 | |
Is it commits or diff-commits? I thought we had the issue of conflicts in naming. |
chipx86 | |
That's just too new! |
chipx86 | |
This is the bit that's all placeholders I'm guessing. Maybe add a big # XXX This is all bogus data. … |
chipx86 | |
This can end up returning two different results. We should pre-calculate once. |
chipx86 | |
% on the next line (same line as the variable). |
chipx86 | |
Might be worth adding a config_key for this, in case any projects or users want to default to this behavior. |
chipx86 | |
No blank line here. |
chipx86 | |
Looks like this will always be True if --squash-history is not set. |
chipx86 | |
undefined name 'merge_parent_id' |
reviewbot | |
Col: 13 E265 block comment should start with '# ' |
reviewbot | |
Col: 23 W292 no newline at end of file |
reviewbot | |
'datetime' imported but unused |
reviewbot | |
Col: 26 E225 missing whitespace around operator |
reviewbot | |
"committer" |
chipx86 | |
Worth maybe just doing a full-on strip()? |
chipx86 | |
Trailing period. |
chipx86 | |
This can be: for sha in reversed(history_lines): That's a little bit faster, since it can just iterate instead of rebuilding … |
chipx86 | |
Can we get a list of all SHAs we need, and then do a single execute() for this, to reduce … |
chipx86 | |
This will also result in a lot of slow, expensive calls. Can we grab everything we need for all SHAs … |
chipx86 | |
You can probably just put the dictionary right in the append call instead. |
chipx86 | |
'datetime' imported but unused |
reviewbot | |
Col: 26 E225 missing whitespace around operator |
reviewbot | |
A nice Python utility function is enumerate. You can use that here to get both the index and the history … |
chipx86 | |
not diff will be the same as len(diff) == 0. |
chipx86 | |
This is kind of hard to follow (and sometimes can lead to unexpected values). Can you break this out into … |
chipx86 | |
We probably need to check for NotImplementedError, right? |
chipx86 | |
We ignore the item, but then we try fetching it in several places below. We should just use the item … |
chipx86 | |
Should be two blank lines. |
david | |
Blank line after this. |
david |
Testing Done: |
|
||||||
---|---|---|---|---|---|---|---|
Depends On: |
|
-
I'm excited! I know it's too early, but just even seeing a prototype on the RBTools side is cool.
-
-
rbtools/api/resource.py (Diff revision 1) Is it
commits
ordiff-commits
? I thought we had the issue of conflicts in naming. -
-
rbtools/commands/post.py (Diff revision 1) This is the bit that's all placeholders I'm guessing. Maybe add a big
# XXX This is all bogus data. Don't pay too much attention to it.
or something. (I almost commented on the commit IDs before I realized :) -
rbtools/commands/post.py (Diff revision 1) This can end up returning two different results. We should pre-calculate once.
-
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+108 -6) |
-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py Tool: Pyflakes Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py
Change Summary:
Add -S flag and SQUASH_HISTORY option.
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commit: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 3 (+130 -6) |
-
Tool: Pyflakes Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py Tool: PEP8 Style Checker Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py
Change Summary:
Use the right capability
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+131 -6) |
-
Tool: Pyflakes Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py Tool: PEP8 Style Checker Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py
Change Summary:
Update depends on field
Depends On: |
|
---|
-
-
rbtools/commands/post.py (Diff revision 4) Might be worth adding a
config_key
for this, in case any projects or users want to default to this behavior. -
-
rbtools/commands/post.py (Diff revision 4) Looks like this will always be True if
--squash-history
is not set.
Change Summary:
squashed diffs -> linear history
Summary: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Diff: |
Revision 5 (+238 -14) |
-
Tool: Pyflakes Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py Tool: PEP8 Style Checker Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py
-
-
-
-
-
Change Summary:
Update to reflect changes to r/6816
Testing Done: |
|
|||||||||
---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 6 (+253 -16) |
-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py Tool: Pyflakes Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py
-
-
-
A few comments on performance, and some small things here and there, but this looks like it's basically good to go :)
-
-
-
-
rbtools/clients/git.py (Diff revision 6) This can be:
for sha in reversed(history_lines):
That's a little bit faster, since it can just iterate instead of rebuilding the list.
-
rbtools/clients/git.py (Diff revision 6) Can we get a list of all SHAs we need, and then do a single
execute()
for this, to reduce the time needed? -
rbtools/clients/git.py (Diff revision 6) This will also result in a lot of slow, expensive calls. Can we grab everything we need for all SHAs in a single call, in some serialized format we can parse?
-
rbtools/clients/git.py (Diff revision 6) You can probably just put the dictionary right in the
append
call instead. -
rbtools/commands/post.py (Diff revision 6) A nice Python utility function is
enumerate
. You can use that here to get both the index and the history item:for i, item in enumerate(history):
-
-
rbtools/commands/post.py (Diff revision 6) This is kind of hard to follow (and sometimes can lead to unexpected values). Can you break this out into explicit
if/else
blocks?
Change Summary:
Address Christian's issues.
We only have to execute
git log
once due to new better parsing.
Diff: |
Revision 7 (+249 -16) |
---|
-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py Tool: Pyflakes Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py
-
Tool: Pyflakes Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py Tool: PEP8 Style Checker Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py
-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py Tool: Pyflakes Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py
Change Summary:
Rewording. master -> dvcs.
Summary: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Branch: |
|
-
-
rbtools/commands/post.py (Diff revision 9) We probably need to check for
NotImplementedError
, right? -
rbtools/commands/post.py (Diff revision 9) We ignore the item, but then we try fetching it in several places below. We should just use the item that we fetch here, to avoid all the extra lookups.
-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py
-
Tool: Pyflakes Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py