##// END OF EJS Templates
Fix git patch application when cwd != repo.root
Brendan Cully -
r3055:efd26cee default
parent child Browse files
Show More
@@ -182,7 +182,7 b' def readgitpatch(patchname):'
182
182
183 return (dopatch, gitpatches)
183 return (dopatch, gitpatches)
184
184
185 def dogitpatch(patchname, gitpatches):
185 def dogitpatch(patchname, gitpatches, cwd=None):
186 """Preprocess git patch so that vanilla patch can handle it"""
186 """Preprocess git patch so that vanilla patch can handle it"""
187 pf = file(patchname)
187 pf = file(patchname)
188 pfline = 1
188 pfline = 1
@@ -196,7 +196,7 b' def dogitpatch(patchname, gitpatches):'
196 if not p.copymod:
196 if not p.copymod:
197 continue
197 continue
198
198
199 copyfile(p.oldpath, p.path)
199 copyfile(p.oldpath, p.path, basedir=cwd)
200
200
201 # rewrite patch hunk
201 # rewrite patch hunk
202 while pfline < p.lineno:
202 while pfline < p.lineno:
@@ -233,7 +233,7 b' def patch(patchname, ui, strip=1, cwd=No'
233 fuzz = False
233 fuzz = False
234 if dopatch:
234 if dopatch:
235 if dopatch == 'filter':
235 if dopatch == 'filter':
236 patchname = dogitpatch(patchname, gitpatches)
236 patchname = dogitpatch(patchname, gitpatches, cwd=cwd)
237 patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch')
237 patcher = util.find_in_path('gpatch', os.environ.get('PATH', ''), 'patch')
238 args = []
238 args = []
239 if cwd:
239 if cwd:
General Comments 0
You need to be logged in to leave comments. Login now