patch: fix patched files records in externalpatcher()
authorPatrick Mezard <pmezard@gmail.com>
Sun, 26 Oct 2008 17:26:28 +0100
changeset 7247 c4461ea8b4c8
parent 7246 2fef3051ebb3
child 7248 723d7a2e6ec0
patch: fix patched files records in externalpatcher()
mercurial/patch.py
tests/test-import
tests/test-import.out
--- a/mercurial/patch.py	Sun Oct 26 14:02:32 2008 +0100
+++ b/mercurial/patch.py	Sun Oct 26 17:26:28 2008 +0100
@@ -1060,7 +1060,7 @@
         if line.startswith('patching file '):
             pf = util.parse_patch_output(line)
             printed_file = False
-            files.setdefault(pf, (None, None))
+            files.setdefault(pf, None)
         elif line.find('with fuzz') >= 0:
             fuzz = True
             if not printed_file:
--- a/tests/test-import	Sun Oct 26 14:02:32 2008 +0100
+++ b/tests/test-import	Sun Oct 26 17:26:28 2008 +0100
@@ -20,6 +20,18 @@
 hg --cwd b tip | grep someone
 rm -r b
 
+echo % import exported patch with external patcher
+cat > dummypatch.py <<EOF
+print 'patching file a'
+file('a', 'wb').write('line2\n')
+EOF
+chmod +x dummypatch.py
+hg clone -r0 a b
+hg --cwd a export tip > tip.patch
+hg --config ui.patch='python ../dummypatch.py' --cwd b import ../tip.patch
+cat b/a
+rm -r b
+
 echo % import of plain diff should fail without message
 hg clone -r0 a b
 hg --cwd a diff -r0:1 > tip.patch
--- a/tests/test-import.out	Sun Oct 26 14:02:32 2008 +0100
+++ b/tests/test-import.out	Sun Oct 26 17:26:28 2008 +0100
@@ -13,6 +13,16 @@
 summary:     second change
 % committer should be same
 user:        someone
+% import exported patch with external patcher
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 2 changes to 2 files
+updating working directory
+2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+applying ../tip.patch
+line2
 % import of plain diff should fail without message
 requesting all changes
 adding changesets