Mercurial > hg
comparison hgext/rebase.py @ 38377:a73eab7d6575
rebase: use progress helper
Differential Revision: https://phab.mercurial-scm.org/D3778
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 17 Jun 2018 22:01:59 -0700 |
parents | f4f1fb1cbfb4 |
children | d6686f864a70 |
comparison
equal
deleted
inserted
replaced
38376:0d7ec620faef | 38377:a73eab7d6575 |
---|---|
431 # When using single transaction, store state when transaction | 431 # When using single transaction, store state when transaction |
432 # commits. | 432 # commits. |
433 self.storestatus(tr) | 433 self.storestatus(tr) |
434 | 434 |
435 cands = [k for k, v in self.state.iteritems() if v == revtodo] | 435 cands = [k for k, v in self.state.iteritems() if v == revtodo] |
436 total = len(cands) | 436 p = repo.ui.makeprogress(_("rebasing"), unit=_('changesets'), |
437 posholder = [0] | 437 total=len(cands)) |
438 def progress(ctx): | 438 def progress(ctx): |
439 posholder[0] += 1 | 439 p.increment(item=("%d:%s" % (ctx.rev(), ctx))) |
440 self.repo.ui.progress(_("rebasing"), posholder[0], | |
441 ("%d:%s" % (ctx.rev(), ctx)), | |
442 _('changesets'), total) | |
443 allowdivergence = self.ui.configbool( | 440 allowdivergence = self.ui.configbool( |
444 'experimental', 'evolution.allowdivergence') | 441 'experimental', 'evolution.allowdivergence') |
445 for subset in sortsource(self.destmap): | 442 for subset in sortsource(self.destmap): |
446 sortedrevs = self.repo.revs('sort(%ld, -topo)', subset) | 443 sortedrevs = self.repo.revs('sort(%ld, -topo)', subset) |
447 if not allowdivergence: | 444 if not allowdivergence: |
450 self.obsoletewithoutsuccessorindestination, | 447 self.obsoletewithoutsuccessorindestination, |
451 self.obsoletewithoutsuccessorindestination, | 448 self.obsoletewithoutsuccessorindestination, |
452 ) | 449 ) |
453 for rev in sortedrevs: | 450 for rev in sortedrevs: |
454 self._rebasenode(tr, rev, allowdivergence, progress) | 451 self._rebasenode(tr, rev, allowdivergence, progress) |
455 ui.progress(_('rebasing'), None) | 452 p.complete() |
456 ui.note(_('rebase merging completed\n')) | 453 ui.note(_('rebase merging completed\n')) |
457 | 454 |
458 def _concludenode(self, rev, p1, p2, editor, commitmsg=None): | 455 def _concludenode(self, rev, p1, p2, editor, commitmsg=None): |
459 '''Commit the wd changes with parents p1 and p2. | 456 '''Commit the wd changes with parents p1 and p2. |
460 | 457 |