$ hg diff --stat --git shows only the new filename on renames.
I added the old filename also to the output to make it identical
with the output of $ git diff --stat.
Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHGf1b0d9988825: diffstat: make --git work properly on renames (issue6025)
rHGffdac0067a14: diffstat: make --git work properly on renames (issue6025)
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Event Timeline
Comment Actions
@@ -2808,6 +2808,10 @@
elif (line.startswith('GIT binary patch') or line.startswith('Binary file')): isbinary = True+ elif line.startswith('rename from'):
+ filename = line.split()[-1]
+ elif line.startswith('rename to'):
+ filename += ' => %s' % line.split()[-1]
Nice.
One nit: better to not use .split() since a filename may include whitespace.
Comment Actions
One nit: better to not use .split() since a filename may include whitespace.
Nice catch! I will send a follow-up on this.
mercurial/patch.py | ||
---|---|---|
2814 | @pulkit Can you add a possible test case? I would like to work on this. By the way, Yuya has replied to this over mail and changes didn't get reflected in phab. Yuya says: Which hglib function? I never thought hglib would parse diffstat output. I don't think it's parsable (i.e. BC-guaranteed) format. |
This is unfortunately not working with hglib. hglib seems to be splitting data on '>' or only reading data after that.
@yuja do you have any idea what can cause that?