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:
-
+ Uploaded a commit containing a diff to Review Board (see:
+ https://reviews.reviewboard.org/r/6779/)
-
I'm excited! I know it's too early, but just even seeing a prototype on the RBTools side is cool.
-
-
-
-
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 :) -
-
-
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:
-
~ Add the
-H
/--with-history
option to therbt post
command. This~ flag allows for review requests with commit history to be posted. ~ That is, instead of review requests consisting of only a single diff, ~ they can span multiple commits (i.e., diffs), each of which can be ~ inspected and reviewed. Currently, the only SCMTool that supports this ~ flag is Git. ~ 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 or SQUASH_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 tothe RBTools web API resources. The DiffCommitListResource
handlesthe uploading of commits via the upload_commit
method.Add the
create_empty_diffset
method to theDiffListResource
class.This method is used to create an empty DiffSet
so that a reviewrequest can be created with commit history. NB:
- The commit metadata information generated by this patch is bogus. - The commit will contain the squashed diff of the entire revision range. This is currently a proof of concept.
- Commit:
-
588ed00337b72f34e7ee47efa49da7727e2cc7ff35429c7f5e59f90ae20245bf2d6d70195577aa5a
-
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:
-
35429c7f5e59f90ae20245bf2d6d70195577aa5a5c9866caeed32f08731853866e40d9f00038b899
-
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
- Change Summary:
-
squashed diffs -> linear history
- Summary:
-
[WIP] Allow uploading of a single (squashed) commit with Git.Allow uploading linear history with Git.
- Description:
-
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 or SQUASH_HISTORY
config option in.reviewboardrc
tooverride 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 tothe RBTools web API resources. The DiffCommitListResource
handlesthe uploading of commits via the upload_commit
method.Add the
create_empty_diffset
method to theDiffListResource
class.This method is used to create an empty DiffSet
so that a reviewrequest can be created with commit history. ~ NB:
~ - The commit metadata information generated by this patch is ~ Add the
get_history
method to theSCMClient
class. This method~ gets a linear history of commit metadata given some revisions. - bogus. - - The commit will contain the squashed diff of the entire revision - range. ~ This is currently a proof of concept.
~ NB: This requires some overhauls to the current backend that is up for review.
-
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:
-
Uploaded a commit containing a diff to Review Board (see:
~ https://reviews.reviewboard.org/r/6779/) ~ https://reviews.reviewboard.org/r/6816/)
-
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 :)
-
-
-
-
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.
-
Can we get a list of all SHAs we need, and then do a single
execute()
for this, to reduce the time needed? -
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?
-
-
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):
-
-
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.
-
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:
-
Allow uploading linear history with Git.Allow uploading simple linear history with Git.
- Description:
-
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 or SQUASH_HISTORY
config option in.reviewboardrc
tooverride 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 tothe RBTools web API resources. The DiffCommitListResource
handlesthe uploading of commits via the upload_commit
method.Add the
create_empty_diffset
method to theDiffListResource
class.This method is used to create an empty DiffSet
so that a reviewrequest can be created with commit history. Add the
get_history
method to theSCMClient
class. This methodgets a linear history of commit metadata given some revisions. ~ NB: This requires some overhauls to the current backend that is up for review.
~ 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. - Branch:
-
masterdvcs
-
Tool: PEP8 Style Checker Processed Files: rbtools/commands/post.py rbtools/clients/__init__.py rbtools/api/resource.py rbtools/clients/git.py