Show More
@@ -0,0 +1,24 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | hg init | |||
|
4 | echo 123 > a | |||
|
5 | echo 123 > c | |||
|
6 | hg add a c | |||
|
7 | hg commit -m "first" -d "0 0" a c | |||
|
8 | echo 123 > b | |||
|
9 | hg status | |||
|
10 | echo 12 > c | |||
|
11 | hg status | |||
|
12 | hg add b | |||
|
13 | hg status | |||
|
14 | hg rm a | |||
|
15 | hg status | |||
|
16 | hg revert a | |||
|
17 | hg status | |||
|
18 | hg revert b | |||
|
19 | hg status | |||
|
20 | hg revert c | |||
|
21 | hg status | |||
|
22 | ls | |||
|
23 | ||||
|
24 | true |
@@ -0,0 +1,16 b'' | |||||
|
1 | ? b | |||
|
2 | M c | |||
|
3 | ? b | |||
|
4 | M c | |||
|
5 | A b | |||
|
6 | M c | |||
|
7 | A b | |||
|
8 | R a | |||
|
9 | M c | |||
|
10 | A b | |||
|
11 | M c | |||
|
12 | ? b | |||
|
13 | ? b | |||
|
14 | a | |||
|
15 | b | |||
|
16 | c |
@@ -1824,6 +1824,10 b' def revert(ui, repo, *names, **opts):' | |||||
1824 | chosen[relname] = 1 |
|
1824 | chosen[relname] = 1 | |
1825 | return ret |
|
1825 | return ret | |
1826 |
|
1826 | |||
|
1827 | (c, a, d, u) = repo.changes() | |||
|
1828 | repo.forget(filter(choose, a)) | |||
|
1829 | repo.undelete(filter(choose, d)) | |||
|
1830 | ||||
1827 | r = repo.update(node, False, True, choose, False) |
|
1831 | r = repo.update(node, False, True, choose, False) | |
1828 | for n in relnames: |
|
1832 | for n in relnames: | |
1829 | if n not in chosen: |
|
1833 | if n not in chosen: |
@@ -555,6 +555,30 b' class localrepository:' | |||||
555 | else: |
|
555 | else: | |
556 | self.dirstate.update([f], "r") |
|
556 | self.dirstate.update([f], "r") | |
557 |
|
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") | |||
|
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): |
General Comments 0
You need to be logged in to leave comments.
Login now