--- a/mercurial/patch.py Fri Mar 20 00:22:37 2015 +0900
+++ b/mercurial/patch.py Thu Mar 19 10:18:05 2015 -0700
@@ -17,6 +17,7 @@
from node import hex, short
import cStringIO
import base85, mdiff, scmutil, util, diffhelpers, copies, encoding, error
+import pathutil
gitre = re.compile('diff --git a/(.*) b/(.*)')
tabsplitter = re.compile(r'(\t+|[^\t]+)')
@@ -1795,8 +1796,10 @@
eolmode='strict'):
if prefix:
- # clean up double slashes, lack of trailing slashes, etc
- prefix = util.normpath(prefix) + '/'
+ prefix = pathutil.canonpath(backend.repo.root, backend.repo.getcwd(),
+ prefix)
+ if prefix != '':
+ prefix += '/'
def pstrip(p):
return pathtransform(p, strip - 1, prefix)[1]