record: do not lose permission changes on commit
authorSteve Borho <steve@borho.org>
Tue, 27 Jan 2009 09:58:48 -0600
changeset 7718 6fa7b6fb90a9
parent 7712 9f9bbd33f71e
child 7719 5d25b2f59ade
record: do not lose permission changes on commit
hgext/record.py
tests/test-record
tests/test-record.out
--- a/hgext/record.py	Sun Jan 25 20:27:37 2009 +0100
+++ b/hgext/record.py	Tue Jan 27 09:58:48 2009 -0600
@@ -475,7 +475,9 @@
                 try:
                     ui.debug(_('applying patch\n'))
                     ui.debug(fp.getvalue())
-                    patch.internalpatch(fp, ui, 1, repo.root)
+                    pfiles = {}
+                    patch.internalpatch(fp, ui, 1, repo.root, files=pfiles)
+                    patch.updatedir(ui, repo, pfiles)
                 except patch.PatchError, err:
                     s = str(err)
                     if s:
--- a/tests/test-record	Sun Jan 25 20:27:37 2009 +0100
+++ b/tests/test-record	Tue Jan 27 09:58:48 2009 -0600
@@ -264,3 +264,35 @@
 f
 EOF
 echo; hg tip -p
+
+echo % preserve chmod +x
+
+chmod +x f1
+echo a >> f1
+hg record -d '20 0' -mz <<EOF
+y
+y
+y
+EOF
+echo; hg tip --config diff.git=True -p
+
+echo % preserve execute permission on original
+
+echo b >> f1
+hg record -d '21 0' -maa <<EOF
+y
+y
+y
+EOF
+echo; hg tip --config diff.git=True -p
+
+echo % preserve chmod -x
+
+chmod -x f1
+echo c >> f1
+hg record -d '22 0' -mab <<EOF
+y
+y
+y
+EOF
+echo; hg tip --config diff.git=True -p
--- a/tests/test-record.out	Sun Jan 25 20:27:37 2009 +0100
+++ b/tests/test-record.out	Tue Jan 27 09:58:48 2009 -0600
@@ -494,3 +494,81 @@
  a
 +a
 
+% preserve chmod +x
+diff --git a/subdir/f1 b/subdir/f1
+old mode 100644
+new mode 100755
+1 hunks, 1 lines changed
+examine changes to 'subdir/f1'? [Ynsfdaq?]  @@ -1,2 +1,3 @@
+ a
+ a
++a
+record this change to 'subdir/f1'? [Ynsfdaq?]  
+changeset:   22:a891589cb933
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:20 1970 +0000
+summary:     z
+
+diff --git a/subdir/f1 b/subdir/f1
+old mode 100644
+new mode 100755
+--- a/subdir/f1
++++ b/subdir/f1
+@@ -1,2 +1,3 @@
+ a
+ a
++a
+
+% preserve execute permission on original
+diff --git a/subdir/f1 b/subdir/f1
+1 hunks, 1 lines changed
+examine changes to 'subdir/f1'? [Ynsfdaq?]  @@ -1,3 +1,4 @@
+ a
+ a
+ a
++b
+record this change to 'subdir/f1'? [Ynsfdaq?]  
+changeset:   23:befa0dae6201
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:21 1970 +0000
+summary:     aa
+
+diff --git a/subdir/f1 b/subdir/f1
+--- a/subdir/f1
++++ b/subdir/f1
+@@ -1,3 +1,4 @@
+ a
+ a
+ a
++b
+
+% preserve chmod -x
+diff --git a/subdir/f1 b/subdir/f1
+old mode 100755
+new mode 100644
+1 hunks, 1 lines changed
+examine changes to 'subdir/f1'? [Ynsfdaq?]  @@ -2,3 +2,4 @@
+ a
+ a
+ b
++c
+record this change to 'subdir/f1'? [Ynsfdaq?]  
+changeset:   24:8fd83ff53ce6
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:22 1970 +0000
+summary:     ab
+
+diff --git a/subdir/f1 b/subdir/f1
+old mode 100755
+new mode 100644
+--- a/subdir/f1
++++ b/subdir/f1
+@@ -2,3 +2,4 @@
+ a
+ a
+ b
++c
+