# HG changeset patch # User Patrick Mezard # Date 1307794451 -7200 # Node ID 65f4512e40e4c888de4f69aa449c5f145a9e4fbb # Parent 81fc9678b018c928e2c5333b9055a66616db0531 patch: turn patch() touched files dict into a set diff -r 81fc9678b018 -r 65f4512e40e4 hgext/mq.py --- 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) diff -r 81fc9678b018 -r 65f4512e40e4 hgext/transplant.py --- 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: diff -r 81fc9678b018 -r 65f4512e40e4 mercurial/commands.py --- 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) diff -r 81fc9678b018 -r 65f4512e40e4 mercurial/patch.py --- 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,