Correctly store base revision for Mercurial diffs with parent diffs (fixes issue 2971)
Review Request #4121 — Created May 8, 2013 and submitted
Mercurial diffs with parent diffs do not work at all in RB 1.7.7.1 if there is no overlap between the files in the diff and those in the parent diff. This change fixes the issue and improves the method of dealing with Mercurial diffs that was introduced changeset 6b1f537b4cf9. The old method was somewhat fragile and was broken by changeset 562a8b4a21a9.
Tested using a local repo on which the problem was originally seen. Added a unit test that tests this scenario.
Description | From | Last Updated |
---|---|---|
Col: 13 E128 continuation line under-indented for visual indent |
reviewbot | |
I'm concerned with this wording. Historically, RB's mentions of "changesets" were very centered around Perforce's model (server-side knowledge of changesets, … |
chipx86 | |
This needs a docstring, in the format of: """One-line summary. Multi-line description. """ Also, "base revision" is too generic. Need … |
chipx86 | |
No blank line. |
chipx86 | |
This seems rather expensive. Can we not compute this as we're parsing initially? |
chipx86 | |
You can do: if line.startswith(('# Parent'), ('diff -r')): |
chipx86 | |
Blank line before this. |
chipx86 |
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/forms.py reviewboard/diffviewer/parser.py reviewboard/scmtools/hg.py reviewboard/scmtools/core.py reviewboard/diffviewer/tests.py Ignored Files:
-
-
I'm concerned with this wording. Historically, RB's mentions of "changesets" were very centered around Perforce's model (server-side knowledge of changesets, mapped to the changenum field). Can we clarify in the comment more what we're referring to? (I know we already had some mention of this here, but I'd like to get this cleaned up.)
-
This needs a docstring, in the format of: """One-line summary. Multi-line description. """ Also, "base revision" is too generic. Need something more specific to the case here.
-
-
-
-
-
This is a review from Review Bot. Tool: PEP8 Style Checker Processed Files: reviewboard/diffviewer/forms.py reviewboard/diffviewer/parser.py reviewboard/scmtools/hg.py reviewboard/scmtools/core.py reviewboard/diffviewer/tests.py Ignored Files:
-
This is a review from Review Bot. Tool: Pyflakes Processed Files: reviewboard/diffviewer/forms.py reviewboard/diffviewer/parser.py reviewboard/scmtools/hg.py reviewboard/scmtools/core.py reviewboard/diffviewer/tests.py Ignored Files:
-
Hey Colin, Thanks for all the hard work on this. I know we've gone back and forth a lot, but this looks good. I wanted to run something by you before committing this and get your thoughts on it. I'm putting together a change that in some way overlaps. Basically, we're going to start storing the commit IDs even in cases where we don't natively fetch via commit ID on that type of repository. Basically, this is for Git + BitBucket support. BitBucket's API only allows fetching of files using a commit SHA1, rather than a blob SHA1 (which is otherwise used in most Git services). Unlike Mercurial, Git diffs don't contain this information natively in the diff, so we'll be allowing RBTools to provide it via our API when uploading the diff. We can then use the commit SHA1 when fetching from BitBucket, and the blob SHA1 everywhere else. So that seems pretty related to your change. The difference being that you're adding support to always use a commit SHA1 (if provided by the DiffParser) as the file revision. So I'm trying to decide how to merge these concepts together well. We may want to augment other DiffParsers to pull out the commit SHA1 but *not* use it as the file's revision, since we may look up the file differently depending on service. I think, then, that the only thing that would need to be modified with your change is to bring back an SCMTool capability field for saying whether to use commit IDs as revisions when parsing diffs. We had diff_uses_changeset_ids, and I think we should keep using that (but rename to diff_use_commit_id_as_revision). We can then safely return and store a commit ID from the DiffParser without necessarily having to look up via that ID. My upcoming change would then add some additional logic to take that commit ID the DiffParser returns and store it in the DiffSet, in a new field I'll be introducing. Does that seem sane?