comparison 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
comparison
equal deleted inserted replaced
2028:1f1fc418a96c 2029:d436b21b20dc
481 self.dirstate.forget(remove) 481 self.dirstate.forget(remove)
482 482
483 self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2) 483 self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2)
484 return n 484 return n
485 485
486 def walk(self, node=None, files=[], match=util.always): 486 def walk(self, node=None, files=[], match=util.always, badmatch=None):
487 if node: 487 if node:
488 fdict = dict.fromkeys(files) 488 fdict = dict.fromkeys(files)
489 for fn in self.manifest.read(self.changelog.read(node)[0]): 489 for fn in self.manifest.read(self.changelog.read(node)[0]):
490 fdict.pop(fn, None) 490 fdict.pop(fn, None)
491 if match(fn): 491 if match(fn):
492 yield 'm', fn 492 yield 'm', fn
493 for fn in fdict: 493 for fn in fdict:
494 self.ui.warn(_('%s: No such file in rev %s\n') % ( 494 if badmatch and badmatch(fn):
495 util.pathto(self.getcwd(), fn), short(node))) 495 if match(fn):
496 yield 'b', fn
497 else:
498 self.ui.warn(_('%s: No such file in rev %s\n') % (
499 util.pathto(self.getcwd(), fn), short(node)))
496 else: 500 else:
497 for src, fn in self.dirstate.walk(files, match): 501 for src, fn in self.dirstate.walk(files, match):
498 yield src, fn 502 yield src, fn
499 503
500 def changes(self, node1=None, node2=None, files=[], match=util.always, 504 def changes(self, node1=None, node2=None, files=[], match=util.always,