hgext/obsolete.py
changeset 297 590ac023c536
parent 285 691cb55358b0
child 298 f597421662f7
equal deleted inserted replaced
296:c3ff47e6bd36 297:590ac023c536
   261     repo._rebasestate = {}
   261     repo._rebasestate = {}
   262     repo._rebasetarget = None
   262     repo._rebasetarget = None
   263     maxrev = len(repo) - 1
   263     maxrev = len(repo) - 1
   264     try:
   264     try:
   265         res = orig(ui, repo, *args, **kwargs)
   265         res = orig(ui, repo, *args, **kwargs)
   266         if not res and not kwargs.get('abort') and repo._rebasetarget:
   266         # Filter nullmerge or unrebased entries
       
   267         repo._rebasestate = dict(p for p in repo._rebasestate.iteritems()
       
   268                                  if p[1] >= 0)
       
   269         if not res and not kwargs.get('abort') and repo._rebasestate:
   267             # We have to tell rewritten revisions from removed
   270             # We have to tell rewritten revisions from removed
   268             # ones. When collapsing, removed revisions are considered
   271             # ones. When collapsing, removed revisions are considered
   269             # to be collapsed onto the final one, while in the normal
   272             # to be collapsed onto the final one, while in the normal
   270             # case their are marked obsolete without successor.
   273             # case their are marked obsolete without successor.
   271             emptynode = nullid
   274             emptynode = nullid
   276             # or to another rebased revision, it must have been
   279             # or to another rebased revision, it must have been
   277             # removed.
   280             # removed.
   278             targetrev = repo[repo._rebasetarget].rev()
   281             targetrev = repo[repo._rebasetarget].rev()
   279             newrevs = set([targetrev])
   282             newrevs = set([targetrev])
   280             for rev, newrev in sorted(repo._rebasestate.items()):
   283             for rev, newrev in sorted(repo._rebasestate.items()):
   281                 if newrev == -2:  # nullmerge
       
   282                     continue
       
   283                 oldnode = repo[rev].node()
   284                 oldnode = repo[rev].node()
   284                 if newrev not in newrevs and newrev >= 0:
   285                 if newrev not in newrevs:
   285                     newnode = repo[newrev].node()
   286                     newnode = repo[newrev].node()
   286                     newrevs.add(newrev)
   287                     newrevs.add(newrev)
   287                 else:
   288                 else:
   288                     newnode = emptynode
   289                     newnode = emptynode
   289                 repo.addobsolete(newnode, oldnode)
   290                 repo.addobsolete(newnode, oldnode)