Add mercurial generated git diff parser.
Review Request #7264 — Created April 29, 2015 and submitted
This adds a new HgGitDiffParser which will parse the headers generated by "hg export --git" and then rely on the GitDiffParser to parse the diff contents. The logic for deciding which hg parser to use has also been changed slightly so that it takes into account the possible presence of the commented headers hg provides. Tests for mercurial git diff parsing have been updated to provide the proper extended headers.
New tests, unit tests pass, uploaded diff from "hg export --git" parses and displays.
| Description | From | Last Updated |
|---|---|---|
|
're' imported but unused |
|
|
|
Small thing, but can you change the 0-related comparisons to check against -1 instead? I think that will help differentiate … |
|
|
|
These should be moved into __init__. |
|
|
|
Needs a docstring. |
|
|
|
Needs a docstring. |
|
|
|
Should we have an else statement that does something? At the very least, log a warning, or may raise an … |
|
|
|
Needs a docstring. |
|
|
|
Col: 9 E303 too many blank lines (2) |
|
|
|
Blank line after this. |
|
-
Thinking it's worth adding some unit tests to cover the relative positions of
diff -randdiff --git, and to also ensure that thenew_commit_idandbase_commit_idresults are what we expect in whatever cases could come up. -
Small thing, but can you change the 0-related comparisons to check against -1 instead? I think that will help differentiate a little between "is it found/not found" vs. "position relative to the other string" when reading the code.
-
-
-
Should we have an
elsestatement that does something? At the very least, log a warning, or may raise an exception if the format is invalid? -
- Change Summary:
-
Added tests, addressed feedback.
- Testing Done:
-
~ unit tests pass, uploaded diff from "hg export --git" parses and displays.
~ New tests, unit tests pass, uploaded diff from "hg export --git" parses and displays.
- Commit:
-
ea346d54d24ffba721ae9a2d947a9125042358438300ede97107279e28fad117bd8dca8c02b0ab02
- Change Summary:
-
Fix up silly mistakes that Review Bot caught here and in /r/7265
- Commit:
-
8300ede97107279e28fad117bd8dca8c02b0ab02b783bf49bf8e842b4a9ecbaa4d841fa1c2526219
- Change Summary:
-
Fixed issue.
- Commit:
-
b783bf49bf8e842b4a9ecbaa4d841fa1c2526219d39b867967e5663b310b6f29331c7675512a4e52
Tool: Pyflakes Processed Files: reviewboard/scmtools/tests.py reviewboard/scmtools/hg.py