# HG changeset patch # User Matt Mackall # Date 1269097316 18000 # Node ID 16b9aa398c28e06028526287cb63979aaacd9313 # Parent d794ea113834ee934e9897ccb6c59ea8ab0926b4# Parent d94832c4a31d49eb5747c364540c9fd36f639689 Merge with stable diff -r d794ea113834 -r 16b9aa398c28 mercurial/patch.py --- a/mercurial/patch.py Fri Mar 19 16:05:16 2010 -0500 +++ b/mercurial/patch.py Sat Mar 20 10:01:56 2010 -0500 @@ -933,8 +933,10 @@ missing = not goodb and not gooda and not createfunc() # some diff programs apparently produce create patches where the - # afile is not /dev/null, but rather the same name as the bfile - if missing and afile == bfile: + # afile is not /dev/null, but afile starts with bfile + abasedir = afile[:afile.rfind('/') + 1] + bbasedir = bfile[:bfile.rfind('/') + 1] + if missing and abasedir == bbasedir and afile.startswith(bfile): # this isn't very pretty hunk.create = True if createfunc(): diff -r d794ea113834 -r 16b9aa398c28 tests/test-import --- a/tests/test-import Fri Mar 19 16:05:16 2010 -0500 +++ b/tests/test-import Sat Mar 20 10:01:56 2010 -0500 @@ -351,10 +351,22 @@ @@ -0,0 +1,1 @@ +a EOF +# some people have patches like the following too +cat > create2.patch <