Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 2029:d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
new version does these things:
- saves backup copies of modified files (issue 147)
- prints output like other commands, and errors when files not found
(issue 123)
- marks files added/removed (issue 93)
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Fri, 31 Mar 2006 10:37:25 -0800 |
parents | a59da8cc35e4 |
children | 5c4496ed152d |
line wrap: on
line diff
--- a/mercurial/localrepo.py Fri Mar 31 03:25:35 2006 -0600 +++ b/mercurial/localrepo.py Fri Mar 31 10:37:25 2006 -0800 @@ -483,7 +483,7 @@ self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2) return n - def walk(self, node=None, files=[], match=util.always): + def walk(self, node=None, files=[], match=util.always, badmatch=None): if node: fdict = dict.fromkeys(files) for fn in self.manifest.read(self.changelog.read(node)[0]): @@ -491,8 +491,12 @@ if match(fn): yield 'm', fn for fn in fdict: - self.ui.warn(_('%s: No such file in rev %s\n') % ( - util.pathto(self.getcwd(), fn), short(node))) + if badmatch and badmatch(fn): + if match(fn): + yield 'b', fn + else: + self.ui.warn(_('%s: No such file in rev %s\n') % ( + util.pathto(self.getcwd(), fn), short(node))) else: for src, fn in self.dirstate.walk(files, match): yield src, fn