[PATCH] record: use patch instead of internalpatch (fixes issue 1406)
Abderrahim Kitouni
a.kitouni at gmail.com
Fri Apr 3 15:19:59 CDT 2009
# HG changeset patch
# User Abderrahim Kitouni <a.kitouni at gmail.com>
# Date 1238789938 -3600
# Node ID b24077ac56fdaa1885dfabfcefbbfe1326cb86ac
# Parent e2e13a7af148e5dfe4bc4db04ba9e38f66a50c20
record: use patch instead of internalpatch (fixes issue 1406).
diff --git a/hgext/record.py b/hgext/record.py
--- a/hgext/record.py
+++ b/hgext/record.py
@@ -468,18 +468,11 @@ def dorecord(ui, repo, committer, *pats,
# 3b. (apply)
if dopatch:
- try:
- ui.debug(_('applying patch\n'))
- ui.debug(fp.getvalue())
- pfiles = {}
- patch.internalpatch(fp, ui, 1, repo.root, files=pfiles)
- patch.updatedir(ui, repo, pfiles)
- except patch.PatchError, err:
- s = str(err)
- if s:
- raise util.Abort(s)
- else:
- raise util.Abort(_('patch failed to apply'))
+ ui.debug(_('applying patch\n'))
+ ui.debug(fp.getvalue())
+ pfiles = {}
+ patch.patch(fp, ui, 1, repo.root, files=pfiles)
+ patch.updatedir(ui, repo, pfiles)
del fp
# 4. We prepared working directory according to filtered patch.
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 change 1/2 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