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 |
reviewbot | |
Small thing, but can you change the 0-related comparisons to check against -1 instead? I think that will help differentiate … |
chipx86 | |
These should be moved into __init__. |
brennie | |
Needs a docstring. |
chipx86 | |
Needs a docstring. |
chipx86 | |
Should we have an else statement that does something? At the very least, log a warning, or may raise an … |
chipx86 | |
Needs a docstring. |
chipx86 | |
Col: 9 E303 too many blank lines (2) |
reviewbot | |
Blank line after this. |
chipx86 |
-
Thinking it's worth adding some unit tests to cover the relative positions of
diff -r
anddiff --git
, and to also ensure that thenew_commit_id
andbase_commit_id
results 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
else
statement 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