Mercurial > hg
changeset 14564:65f4512e40e4
patch: turn patch() touched files dict into a set
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sat, 11 Jun 2011 14:14:11 +0200 |
parents | 81fc9678b018 |
children | 3cacc232f27f |
files | hgext/mq.py hgext/transplant.py mercurial/commands.py mercurial/patch.py |
diffstat | 4 files changed, 9 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Thu Jun 09 01:19:39 2011 +0800 +++ b/hgext/mq.py Sat Jun 11 14:14:11 2011 +0200 @@ -617,7 +617,7 @@ def patch(self, repo, patchfile): '''Apply patchfile to the working directory. patchfile: name of patch file''' - files = {} + files = set() try: fuzz = patchmod.patch(self.ui, repo, patchfile, strip=1, files=files, eolmode=None)
--- a/hgext/transplant.py Thu Jun 09 01:19:39 2011 +0800 +++ b/hgext/transplant.py Sat Jun 11 14:14:11 2011 +0200 @@ -227,7 +227,7 @@ raise util.Abort(_('can only omit patchfile if merging')) if patchfile: try: - files = {} + files = set() patch.patch(self.ui, repo, patchfile, files=files, eolmode=None) files = list(files) if not files:
--- a/mercurial/commands.py Thu Jun 09 01:19:39 2011 +0800 +++ b/mercurial/commands.py Sat Jun 11 14:14:11 2011 +0200 @@ -3106,7 +3106,7 @@ if opts.get('exact') or opts.get('import_branch'): repo.dirstate.setbranch(branch or 'default') - files = {} + files = set() patch.patch(ui, repo, tmpname, strip=strip, files=files, eolmode=None, similarity=sim / 100.0) files = list(files)
--- a/mercurial/patch.py Thu Jun 09 01:19:39 2011 +0800 +++ b/mercurial/patch.py Sat Jun 11 14:14:11 2011 +0200 @@ -1223,7 +1223,7 @@ continue ret = current_file.apply(values) if ret >= 0: - changed.setdefault(current_file.fname, None) + changed.add(current_file.fname) if ret > 0: err = 1 elif state == 'file': @@ -1236,7 +1236,7 @@ path = pstrip(gp.path) if gp.oldpath: copysource = pstrip(gp.oldpath) - changed[path] = gp + changed.add(path) if gp.op == 'RENAME': backend.unlink(copysource) if not first_hunk: @@ -1306,7 +1306,7 @@ if line.startswith('patching file '): pf = util.parsepatchoutput(line) printed_file = False - files.setdefault(pf, None) + files.add(pf) elif line.find('with fuzz') >= 0: fuzz = True if not printed_file: @@ -1340,7 +1340,7 @@ returns whether patch was applied with fuzz factor.""" if files is None: - files = {} + files = set() if eolmode is None: eolmode = ui.config('patch', 'eol', 'strict') if eolmode.lower() not in eolmodes: @@ -1359,7 +1359,7 @@ finally: if fp != patchobj: fp.close() - files.update(dict.fromkeys(backend.close())) + files.update(backend.close()) store.close() if ret < 0: raise PatchError(_('patch failed to apply')) @@ -1380,7 +1380,7 @@ """ patcher = ui.config('ui', 'patch') if files is None: - files = {} + files = set() try: if patcher: return _externalpatch(ui, repo, patcher, patchname, strip,