hgext/rebase.py
changeset 23490 102f144f6e02
parent 23489 fe4157d839ac
child 23491 9972758ab4c5
equal deleted inserted replaced
23489:fe4157d839ac 23490:102f144f6e02
    21 from mercurial.node import nullrev
    21 from mercurial.node import nullrev
    22 from mercurial.lock import release
    22 from mercurial.lock import release
    23 from mercurial.i18n import _
    23 from mercurial.i18n import _
    24 import os, errno
    24 import os, errno
    25 
    25 
       
    26 revtodo = -1
    26 nullmerge = -2
    27 nullmerge = -2
    27 revignored = -3
    28 revignored = -3
    28 
    29 
    29 cmdtable = {}
    30 cmdtable = {}
    30 command = cmdutil.command(cmdtable)
    31 command = cmdutil.command(cmdtable)
   365         sortedstate = sorted(state)
   366         sortedstate = sorted(state)
   366         total = len(sortedstate)
   367         total = len(sortedstate)
   367         pos = 0
   368         pos = 0
   368         for rev in sortedstate:
   369         for rev in sortedstate:
   369             pos += 1
   370             pos += 1
   370             if state[rev] == -1:
   371             if state[rev] == revtodo:
   371                 ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, repo[rev])),
   372                 ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, repo[rev])),
   372                             _('changesets'), total)
   373                             _('changesets'), total)
   373                 p1, p2, base = defineparents(repo, rev, target, state,
   374                 p1, p2, base = defineparents(repo, rev, target, state,
   374                                              targetancestors)
   375                                              targetancestors)
   375                 storestatus(repo, originalwd, target, state, collapsef, keepf,
   376                 storestatus(repo, originalwd, target, state, collapsef, keepf,
   788         skipped = set()
   789         skipped = set()
   789         # recompute the set of skipped revs
   790         # recompute the set of skipped revs
   790         if not collapse:
   791         if not collapse:
   791             seen = set([target])
   792             seen = set([target])
   792             for old, new in sorted(state.items()):
   793             for old, new in sorted(state.items()):
   793                 if new != nullrev and new in seen:
   794                 if new != revtodo and new in seen:
   794                     skipped.add(old)
   795                     skipped.add(old)
   795                 seen.add(new)
   796                 seen.add(new)
   796         repo.ui.debug('computed skipped revs: %s\n' %
   797         repo.ui.debug('computed skipped revs: %s\n' %
   797                       (' '.join(str(r) for r in sorted(skipped)) or None))
   798                       (' '.join(str(r) for r in sorted(skipped)) or None))
   798         repo.ui.debug('rebase status resumed\n')
   799         repo.ui.debug('rebase status resumed\n')
   880             if not collapse and samebranch and root in dest.children():
   881             if not collapse and samebranch and root in dest.children():
   881                 repo.ui.debug('source is a child of destination\n')
   882                 repo.ui.debug('source is a child of destination\n')
   882                 return None
   883                 return None
   883 
   884 
   884         repo.ui.debug('rebase onto %d starting from %s\n' % (dest, root))
   885         repo.ui.debug('rebase onto %d starting from %s\n' % (dest, root))
   885         state.update(dict.fromkeys(rebaseset, nullrev))
   886         state.update(dict.fromkeys(rebaseset, revtodo))
   886         # Rebase tries to turn <dest> into a parent of <root> while
   887         # Rebase tries to turn <dest> into a parent of <root> while
   887         # preserving the number of parents of rebased changesets:
   888         # preserving the number of parents of rebased changesets:
   888         #
   889         #
   889         # - A changeset with a single parent will always be rebased as a
   890         # - A changeset with a single parent will always be rebased as a
   890         #   changeset with a single parent.
   891         #   changeset with a single parent.