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