# HG changeset patch
# User Patrick Mezard <pmezard@gmail.com>
# Date 2008-10-26 16:26:28
# Node ID c4461ea8b4c8022568080ecc847ba4ed3e17906c
# Parent  2fef3051ebb3e1b8997b8c5e053bc5de69ca5ed9

patch: fix patched files records in externalpatcher()

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1060,7 +1060,7 @@ def externalpatch(patcher, args, patchna
         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:
diff --git a/tests/test-import b/tests/test-import
--- a/tests/test-import
+++ b/tests/test-import
@@ -20,6 +20,18 @@ echo % committer should be same
 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
diff --git a/tests/test-import.out b/tests/test-import.out
--- a/tests/test-import.out
+++ b/tests/test-import.out
@@ -13,6 +13,16 @@ applying ../tip.patch
 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