89 if isinstance(nodelist, str): |
89 if isinstance(nodelist, str): |
90 nodelist = [nodelist] |
90 nodelist = [nodelist] |
91 striplist = [cl.rev(node) for node in nodelist] |
91 striplist = [cl.rev(node) for node in nodelist] |
92 striprev = min(striplist) |
92 striprev = min(striplist) |
93 |
93 |
|
94 files = _collectfiles(repo, striprev) |
|
95 saverevs = _collectbrokencsets(repo, files, striprev) |
|
96 |
94 # Some revisions with rev > striprev may not be descendants of striprev. |
97 # Some revisions with rev > striprev may not be descendants of striprev. |
95 # We have to find these revisions and put them in a bundle, so that |
98 # We have to find these revisions and put them in a bundle, so that |
96 # we can restore them after the truncations. |
99 # we can restore them after the truncations. |
97 # To create the bundle we use repo.changegroupsubset which requires |
100 # To create the bundle we use repo.changegroupsubset which requires |
98 # the list of heads and bases of the set of interesting revisions. |
101 # the list of heads and bases of the set of interesting revisions. |
99 # (head = revision in the set that has no descendant in the set; |
102 # (head = revision in the set that has no descendant in the set; |
100 # base = revision in the set that has no ancestor in the set) |
103 # base = revision in the set that has no ancestor in the set) |
101 tostrip = set(striplist) |
104 tostrip = set(striplist) |
|
105 saveheads = set(saverevs) |
102 for r in cl.revs(start=striprev + 1): |
106 for r in cl.revs(start=striprev + 1): |
103 if any(p in tostrip for p in cl.parentrevs(r)): |
107 if any(p in tostrip for p in cl.parentrevs(r)): |
104 tostrip.add(r) |
108 tostrip.add(r) |
105 |
109 |
106 files = _collectfiles(repo, striprev) |
|
107 saverevs = _collectbrokencsets(repo, files, striprev) |
|
108 |
|
109 # compute heads |
|
110 saveheads = set(saverevs) |
|
111 for r in xrange(striprev + 1, len(cl)): |
|
112 if r not in tostrip: |
110 if r not in tostrip: |
113 saverevs.add(r) |
111 saverevs.add(r) |
114 saveheads.difference_update(cl.parentrevs(r)) |
112 saveheads.difference_update(cl.parentrevs(r)) |
115 saveheads.add(r) |
113 saveheads.add(r) |
116 saveheads = [cl.node(r) for r in saveheads] |
114 saveheads = [cl.node(r) for r in saveheads] |