changeset 6520:ba0b2dacc623

fix import with -p0
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sat, 12 Apr 2008 22:41:07 -0400
parents a7582980d654
children a3668330f14a c2c4fa9af016
files mercurial/patch.py tests/test-import tests/test-import.out
diffstat 3 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/patch.py	Sat Apr 12 21:08:03 2008 +0200
+++ b/mercurial/patch.py	Sat Apr 12 22:41:07 2008 -0400
@@ -789,7 +789,7 @@
         pathlen = len(path)
         i = 0
         if count == 0:
-            return path.rstrip()
+            return '', path.rstrip()
         while count > 0:
             i = path.find('/', i)
             if i == -1:
--- a/tests/test-import	Sat Apr 12 21:08:03 2008 +0200
+++ b/tests/test-import	Sat Apr 12 22:41:07 2008 -0400
@@ -244,3 +244,20 @@
 # and a2 should have duplicated it
 cat a2
 cd ..
+
+echo % 'test -p0'
+hg init p0
+cd p0
+echo a > a
+hg ci -Am t
+hg import -p0 - << EOF
+foobar
+--- a	Sat Apr 12 22:43:58 2008 -0400
++++ a	Sat Apr 12 22:44:05 2008 -0400
+@@ -1,1 +1,1 @@
+-a
++bb
+EOF
+hg status
+cat a
+cd ..
--- a/tests/test-import.out	Sat Apr 12 21:08:03 2008 +0200
+++ b/tests/test-import.out	Sat Apr 12 22:41:07 2008 -0400
@@ -256,3 +256,7 @@
 a
 % view a2
 a
+% test -p0
+adding a
+applying patch from stdin
+bb