# HG changeset patch # User Patrick Mezard # Date 2011-05-19 20:44:01 # Node ID 2d16f15da7bda359883fe7e875de347198a4f317 # Parent d4192500586a1f73d1cfc719c2eeab3035daaacb patch: remove patch.patch() cwd argument diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -620,7 +620,7 @@ class queue(object): files = {} try: fuzz = patchmod.patch(self.ui, repo, patchfile, strip=1, - cwd=repo.root, files=files, eolmode=None) + files=files, eolmode=None) return (True, list(files), fuzz) except Exception, inst: self.ui.note(str(inst) + '\n') diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -227,8 +227,7 @@ class transplanter(object): if patchfile: try: files = {} - patch.patch(self.ui, repo, patchfile, cwd=repo.root, - files=files, eolmode=None) + patch.patch(self.ui, repo, patchfile, files=files, eolmode=None) files = list(files) if not files: self.ui.warn(_('%s: empty changeset') % revlog.hex(node)) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3105,8 +3105,8 @@ def import_(ui, repo, patch1, *patches, repo.dirstate.setbranch(branch or 'default') files = {} - patch.patch(ui, repo, tmpname, strip=strip, cwd=repo.root, - files=files, eolmode=None, similarity=sim / 100.0) + patch.patch(ui, repo, tmpname, strip=strip, files=files, + eolmode=None, similarity=sim / 100.0) files = list(files) if opts.get('no_commit'): if message: diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1281,13 +1281,14 @@ def _applydiff(ui, fp, patcher, backend, return -1 return err -def _externalpatch(ui, repo, patcher, patchname, strip, cwd, files, +def _externalpatch(ui, repo, patcher, patchname, strip, files, similarity): """use to apply to the working directory. returns whether patch was applied with fuzz factor.""" fuzz = False args = [] + cwd = repo.root if cwd: args.append('-d %s' % util.shellquote(cwd)) fp = util.popen('%s %s -p%d < %s' % (patcher, ' '.join(args), strip, @@ -1355,7 +1356,7 @@ def internalpatch(ui, repo, patchobj, st raise PatchError(_('patch failed to apply')) return ret > 0 -def patch(ui, repo, patchname, strip=1, cwd=None, files=None, eolmode='strict', +def patch(ui, repo, patchname, strip=1, files=None, eolmode='strict', similarity=0): """Apply to the working directory. @@ -1374,7 +1375,7 @@ def patch(ui, repo, patchname, strip=1, try: if patcher: return _externalpatch(ui, repo, patcher, patchname, strip, - cwd, files, similarity) + files, similarity) return internalpatch(ui, repo, patchname, strip, files, eolmode, similarity) except PatchError, err: