[PATCH] fix for issue 1406

Abderrahim Kitouni a.kitouni at gmail.com
Thu Mar 26 11:53:18 CDT 2009


# HG changeset patch
# User Abderrahim Kitouni <a.kitouni at gmail.com>
# Date 1238012546 -3600
# Node ID 9fc8aca3f26f23adc36baeef6ace1dce8e8434c5
# Parent  c2ecaf63badee4e973c4d843121139d4d3269f12
Fix for issue 1406, and add a test for it.

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -913,6 +913,8 @@ def iterhunks(ui, fp, sourcefile=None):
                 if gp and gp.op in ('COPY', 'DELETE', 'RENAME'):
                     afile = bfile
                     gitworkdone = True
+                elif gp and gp.mode:
+                    gitworkdone = True
             newfile = True
         elif x.startswith('---'):
             # check for a unified diff
diff --git a/tests/test-record b/tests/test-record
--- a/tests/test-record
+++ b/tests/test-record
@@ -296,3 +296,14 @@ y
 y
 EOF
 echo; hg tip --config diff.git=True -p
+
+echo % chmod +x and file change
+
+echo c >> f1
+chmod +x f2
+hg record -d '23 0' -mab <<EOF
+y
+y
+y
+EOF
+echo; hg tip --config diff.git=True -p
diff --git a/tests/test-record.out b/tests/test-record.out
--- a/tests/test-record.out
+++ b/tests/test-record.out
@@ -572,3 +572,33 @@ new mode 100644
  b
 +c

+% chmod +x and file change
+diff --git a/subdir/f1 b/subdir/f1
+1 hunks, 1 lines changed
+examine changes to 'subdir/f1'? [Ynsfdaq?]  @@ -3,3 +3,4 @@
+ a
+ b
+ c
++c
+record this change to 'subdir/f1'? [Ynsfdaq?]  diff --git a/subdir/f2
b/subdir/f2
+old mode 100644
+new mode 100755
+examine changes to 'subdir/f2'? [Ynsfdaq?]
+changeset:   25:dd7c530de37d
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:23 1970 +0000
+summary:     ab
+
+diff --git a/subdir/f1 b/subdir/f1
+--- a/subdir/f1
++++ b/subdir/f1
+@@ -3,3 +3,4 @@
+ a
+ b
+ c
++c
+diff --git a/subdir/f2 b/subdir/f2
+old mode 100644
+new mode 100755
+


More information about the Mercurial-devel mailing list