##// END OF EJS Templates
patch: always raise PatchError with a message, simplify handling
Patrick Mezard -
r12674:aa2fe1f5 default
parent child Browse files
Show More
@@ -499,11 +499,7 def dorecord(ui, repo, commitfunc, *pats
499 eolmode=None)
499 eolmode=None)
500 cmdutil.updatedir(ui, repo, pfiles)
500 cmdutil.updatedir(ui, repo, pfiles)
501 except patch.PatchError, err:
501 except patch.PatchError, err:
502 s = str(err)
502 raise util.Abort(str(err))
503 if s:
504 raise util.Abort(s)
505 else:
506 raise util.Abort(_('patch failed to apply'))
507 del fp
503 del fp
508
504
509 # 4. We prepared working directory according to filtered patch.
505 # 4. We prepared working directory according to filtered patch.
@@ -1233,7 +1233,7 def internalpatch(patchobj, ui, strip, c
1233 if fp != patchobj:
1233 if fp != patchobj:
1234 fp.close()
1234 fp.close()
1235 if ret < 0:
1235 if ret < 0:
1236 raise PatchError
1236 raise PatchError(_('patch failed to apply'))
1237 return ret > 0
1237 return ret > 0
1238
1238
1239 def patch(patchname, ui, strip=1, cwd=None, files=None, eolmode='strict'):
1239 def patch(patchname, ui, strip=1, cwd=None, files=None, eolmode='strict'):
@@ -1256,11 +1256,7 def patch(patchname, ui, strip=1, cwd=No
1256 return externalpatch(patcher, patchname, ui, strip, cwd, files)
1256 return externalpatch(patcher, patchname, ui, strip, cwd, files)
1257 return internalpatch(patchname, ui, strip, cwd, files, eolmode)
1257 return internalpatch(patchname, ui, strip, cwd, files, eolmode)
1258 except PatchError, err:
1258 except PatchError, err:
1259 s = str(err)
1259 raise util.Abort(str(err))
1260 if s:
1261 raise util.Abort(s)
1262 else:
1263 raise util.Abort(_('patch failed to apply'))
1264
1260
1265 def b85diff(to, tn):
1261 def b85diff(to, tn):
1266 '''print base85-encoded binary diff'''
1262 '''print base85-encoded binary diff'''
General Comments 0
You need to be logged in to leave comments. Login now