Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 1447:508a3f559553
revert added and removed files to their normal state before reverting
add a test for revert
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Tue, 25 Oct 2005 15:51:28 -0700 |
parents | 0980d77f5e9a |
children | 182879d71922 |
comparison
equal
deleted
inserted
replaced
1446:4babaa52badf | 1447:508a3f559553 |
---|---|
552 self.dirstate.forget([f]) | 552 self.dirstate.forget([f]) |
553 elif f not in self.dirstate: | 553 elif f not in self.dirstate: |
554 self.ui.warn(_("%s not tracked!\n") % f) | 554 self.ui.warn(_("%s not tracked!\n") % f) |
555 else: | 555 else: |
556 self.dirstate.update([f], "r") | 556 self.dirstate.update([f], "r") |
557 | |
558 def undelete(self, list): | |
559 pl = self.dirstate.parents() | |
560 if pl[1] != nullid: | |
561 self.ui.warn("aborting: outstanding uncommitted merges\n") | |
562 return 1 | |
563 p = pl[0] | |
564 mn = self.changelog.read(p)[0] | |
565 mf = self.manifest.readflags(mn) | |
566 m = self.manifest.read(mn) | |
567 for f in list: | |
568 if self.dirstate.state(f) not in "r": | |
569 self.ui.warn("%s not removed!\n" % f) | |
570 else: | |
571 t = self.file(f).read(m[f]) | |
572 try: | |
573 self.wwrite(f, t) | |
574 except IOError, e: | |
575 if e.errno != errno.ENOENT: | |
576 raise | |
577 os.makedirs(os.path.dirname(self.wjoin(f))) | |
578 self.wwrite(f, t) | |
579 util.set_exec(self.wjoin(f), mf[f]) | |
580 self.dirstate.update([f], "n") | |
557 | 581 |
558 def copy(self, source, dest): | 582 def copy(self, source, dest): |
559 p = self.wjoin(dest) | 583 p = self.wjoin(dest) |
560 if not os.path.exists(p): | 584 if not os.path.exists(p): |
561 self.ui.warn(_("%s does not exist!\n") % dest) | 585 self.ui.warn(_("%s does not exist!\n") % dest) |