# HG changeset patch # User Brendan Cully # Date 1156968746 25200 # Node ID efd26ceedafb951f007608d7454ab0e248cd4a3f # Parent 51b7f792e47344bb8940b9ddc888cd4ad9378f97 Fix git patch application when cwd != repo.root diff -r 51b7f792e473 -r efd26ceedafb mercurial/patch.py --- a/mercurial/patch.py Wed Aug 30 12:55:10 2006 -0700 +++ b/mercurial/patch.py Wed Aug 30 13:12:26 2006 -0700 @@ -182,7 +182,7 @@ return (dopatch, gitpatches) -def dogitpatch(patchname, gitpatches): +def dogitpatch(patchname, gitpatches, cwd=None): """Preprocess git patch so that vanilla patch can handle it""" pf = file(patchname) pfline = 1 @@ -196,7 +196,7 @@ if not p.copymod: continue - copyfile(p.oldpath, p.path) + copyfile(p.oldpath, p.path, basedir=cwd) # rewrite patch hunk while pfline < p.lineno: @@ -233,7 +233,7 @@ fuzz = False if dopatch: if dopatch == 'filter': - patchname = dogitpatch(patchname, gitpatches) + patchname = dogitpatch(patchname, gitpatches, cwd=cwd) patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch') args = [] if cwd: