mercurial/repair.py
changeset 6750 fb42030d79d6
parent 6747 f6c00b17387c
child 6953 63b5f4c73c98
equal deleted inserted replaced
6749:51b0e799352f 6750:fb42030d79d6
    21 
    21 
    22 def _collectfiles(repo, striprev):
    22 def _collectfiles(repo, striprev):
    23     """find out the filelogs affected by the strip"""
    23     """find out the filelogs affected by the strip"""
    24     files = {}
    24     files = {}
    25 
    25 
    26     for x in xrange(striprev, repo.changelog.count()):
    26     for x in xrange(striprev, len(repo)):
    27         for name in repo[x].files():
    27         for name in repo[x].files():
    28             if name in files:
    28             if name in files:
    29                 continue
    29                 continue
    30             files[name] = 1
    30             files[name] = 1
    31 
    31 
    35 
    35 
    36 def _collectextranodes(repo, files, link):
    36 def _collectextranodes(repo, files, link):
    37     """return the nodes that have to be saved before the strip"""
    37     """return the nodes that have to be saved before the strip"""
    38     def collectone(revlog):
    38     def collectone(revlog):
    39         extra = []
    39         extra = []
    40         startrev = count = revlog.count()
    40         startrev = count = len(revlog)
    41         # find the truncation point of the revlog
    41         # find the truncation point of the revlog
    42         for i in xrange(0, count):
    42         for i in xrange(0, count):
    43             node = revlog.node(i)
    43             node = revlog.node(i)
    44             lrev = revlog.linkrev(node)
    44             lrev = revlog.linkrev(node)
    45             if lrev >= link:
    45             if lrev >= link:
    82     # (head = revision in the set that has no descendant in the set;
    82     # (head = revision in the set that has no descendant in the set;
    83     #  base = revision in the set that has no ancestor in the set)
    83     #  base = revision in the set that has no ancestor in the set)
    84     tostrip = {striprev: 1}
    84     tostrip = {striprev: 1}
    85     saveheads = {}
    85     saveheads = {}
    86     savebases = []
    86     savebases = []
    87     for r in xrange(striprev + 1, cl.count()):
    87     for r in xrange(striprev + 1, len(cl)):
    88         parents = cl.parentrevs(r)
    88         parents = cl.parentrevs(r)
    89         if parents[0] in tostrip or parents[1] in tostrip:
    89         if parents[0] in tostrip or parents[1] in tostrip:
    90             # r is a descendant of striprev
    90             # r is a descendant of striprev
    91             tostrip[r] = 1
    91             tostrip[r] = 1
    92             # if this is a merge and one of the parents does not descend
    92             # if this is a merge and one of the parents does not descend