##// END OF EJS Templates
strip: simplify collectone
Matt Mackall -
r13705:73cfb7a5 default
parent child Browse files
Show More
@@ -35,28 +35,24 b' def _collectfiles(repo, striprev):'
35 35
36 36 def _collectbrokencsets(repo, files, striprev):
37 37 """return the changesets which will be broken by the truncation"""
38 s = set()
38 39 def collectone(revlog):
39 startrev = count = len(revlog)
40 links = (revlog.linkrev(i) for i in xrange(len(revlog)))
40 41 # find the truncation point of the revlog
41 for i in xrange(count):
42 lrev = revlog.linkrev(i)
42 for lrev in links:
43 43 if lrev >= striprev:
44 startrev = i + 1
45 44 break
45 # see if any revision after this point has a linkrev
46 # less than striprev (those will be broken by strip)
47 for lrev in links:
48 if lrev < striprev:
49 s.add(lrev)
46 50
47 # see if any revision after that point has a linkrev less than striprev
48 # (those will be broken by strip)
49 for i in xrange(startrev, count):
50 lrev = revlog.linkrev(i)
51 if lrev < striprev:
52 yield lrev
51 collectone(repo.manifest)
52 for fname in files:
53 collectone(repo.file(fname))
53 54
54 for rev in collectone(repo.manifest):
55 yield rev
56 for fname in files:
57 f = repo.file(fname)
58 for rev in collectone(f):
59 yield rev
55 return s
60 56
61 57 def strip(ui, repo, node, backup="all"):
62 58 cl = repo.changelog
@@ -76,7 +72,7 b' def strip(ui, repo, node, backup="all"):'
76 72 tostrip.add(striprev)
77 73
78 74 files = _collectfiles(repo, striprev)
79 saverevs = set(_collectbrokencsets(repo, files, striprev))
75 saverevs = _collectbrokencsets(repo, files, striprev)
80 76
81 77 # compute heads
82 78 saveheads = set(saverevs)
General Comments 0
You need to be logged in to leave comments. Login now