This is an archive of the discontinued Mercurial Phabricator instance.

patch: handle 0 context lines (diff.unified=0) when parsing patches
ClosedPublic

Authored by spectral on Jan 29 2019, 9:31 PM.

Details

Summary

Previously, if there were no context lines, we would just keep updating the
ranges and the hunk, but not actually storing the hunk (just overwriting it each
time). Thus a diff like this:

$ hg diff --config diff.unified=0
diff --git a/bar b/bar
--- a/bar
+++ b/bar
@@ -1,0 +2,1 @@ 1
+change1
@@ -3,0 +5,1 @@ 3
+change2

would come out of the parser like this (change1 is lost):

bar:
@@ -3,0 +5,1 @@ 3
+change2

This had some really weird side effects for things like commit --interactive,
split, etc.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped