mercurial/patch.py
changeset 24254 60c279ab7bd3
parent 24253 26fa5ff9e660
child 24259 5ac8ce04baa2
equal deleted inserted replaced
24253:26fa5ff9e660 24254:60c279ab7bd3
  1519         store.close()
  1519         store.close()
  1520     if ret < 0:
  1520     if ret < 0:
  1521         raise PatchError(_('patch failed to apply'))
  1521         raise PatchError(_('patch failed to apply'))
  1522     return ret > 0
  1522     return ret > 0
  1523 
  1523 
  1524 def internalpatch(ui, repo, patchobj, strip, files=None, eolmode='strict',
  1524 def internalpatch(ui, repo, patchobj, strip, prefix, files=None,
  1525                   similarity=0):
  1525                   eolmode='strict', similarity=0):
  1526     """use builtin patch to apply <patchobj> to the working directory.
  1526     """use builtin patch to apply <patchobj> to the working directory.
  1527     returns whether patch was applied with fuzz factor."""
  1527     returns whether patch was applied with fuzz factor."""
  1528     backend = workingbackend(ui, repo, similarity)
  1528     backend = workingbackend(ui, repo, similarity)
  1529     return patchbackend(ui, backend, patchobj, strip, '', files, eolmode)
  1529     return patchbackend(ui, backend, patchobj, strip, prefix, files, eolmode)
  1530 
  1530 
  1531 def patchrepo(ui, repo, ctx, store, patchobj, strip, files=None,
  1531 def patchrepo(ui, repo, ctx, store, patchobj, strip, files=None,
  1532               eolmode='strict'):
  1532               eolmode='strict'):
  1533     backend = repobackend(ui, repo, ctx, store)
  1533     backend = repobackend(ui, repo, ctx, store)
  1534     return patchbackend(ui, backend, patchobj, strip, '', files, eolmode)
  1534     return patchbackend(ui, backend, patchobj, strip, '', files, eolmode)
  1550     if files is None:
  1550     if files is None:
  1551         files = set()
  1551         files = set()
  1552     if patcher:
  1552     if patcher:
  1553         return _externalpatch(ui, repo, patcher, patchname, strip,
  1553         return _externalpatch(ui, repo, patcher, patchname, strip,
  1554                               files, similarity)
  1554                               files, similarity)
  1555     return internalpatch(ui, repo, patchname, strip, files, eolmode,
  1555     return internalpatch(ui, repo, patchname, strip, '', files, eolmode,
  1556                          similarity)
  1556                          similarity)
  1557 
  1557 
  1558 def changedfiles(ui, repo, patchpath, strip=1):
  1558 def changedfiles(ui, repo, patchpath, strip=1):
  1559     backend = fsbackend(ui, repo.root)
  1559     backend = fsbackend(ui, repo.root)
  1560     fp = open(patchpath, 'rb')
  1560     fp = open(patchpath, 'rb')