Details
Details
- Reviewers
durin42 - Group Reviewers
hg-reviewers - Commits
- rHGe5d87c69bbcb: histedit: use progress helper
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
durin42 |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | hgext/histedit.py (11 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | Jun 18 2018, 1:05 AM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz | ||
Closed | martinvonz |
zip(actions, actions[1:] + [None])): | zip(actions, actions[1:] + [None])): | ||||
if action.verb == 'fold' and nextact and nextact.verb == 'fold': | if action.verb == 'fold' and nextact and nextact.verb == 'fold': | ||||
state.actions[idx].__class__ = _multifold | state.actions[idx].__class__ = _multifold | ||||
# Force an initial state file write, so the user can run --abort/continue | # Force an initial state file write, so the user can run --abort/continue | ||||
# even if there's an exception before the first transaction serialize. | # even if there's an exception before the first transaction serialize. | ||||
state.write() | state.write() | ||||
total = len(state.actions) | |||||
pos = 0 | |||||
tr = None | tr = None | ||||
# Don't use singletransaction by default since it rolls the entire | # Don't use singletransaction by default since it rolls the entire | ||||
# transaction back if an unexpected exception happens (like a | # transaction back if an unexpected exception happens (like a | ||||
# pretxncommit hook throws, or the user aborts the commit msg editor). | # pretxncommit hook throws, or the user aborts the commit msg editor). | ||||
if ui.configbool("histedit", "singletransaction"): | if ui.configbool("histedit", "singletransaction"): | ||||
# Don't use a 'with' for the transaction, since actions may close | # Don't use a 'with' for the transaction, since actions may close | ||||
# and reopen a transaction. For example, if the action executes an | # and reopen a transaction. For example, if the action executes an | ||||
# external process it may choose to commit the transaction first. | # external process it may choose to commit the transaction first. | ||||
tr = repo.transaction('histedit') | tr = repo.transaction('histedit') | ||||
with util.acceptintervention(tr): | progress = ui.makeprogress(_("editing"), unit=_('changes'), | ||||
total=len(state.actions)) | |||||
with progress, util.acceptintervention(tr): | |||||
while state.actions: | while state.actions: | ||||
state.write(tr=tr) | state.write(tr=tr) | ||||
actobj = state.actions[0] | actobj = state.actions[0] | ||||
pos += 1 | progress.increment(item=actobj.torule()) | ||||
ui.progress(_("editing"), pos, actobj.torule(), | |||||
_('changes'), total) | |||||
ui.debug('histedit: processing %s %s\n' % (actobj.verb,\ | ui.debug('histedit: processing %s %s\n' % (actobj.verb,\ | ||||
actobj.torule())) | actobj.torule())) | ||||
parentctx, replacement_ = actobj.run() | parentctx, replacement_ = actobj.run() | ||||
state.parentctxnode = parentctx.node() | state.parentctxnode = parentctx.node() | ||||
state.replacements.extend(replacement_) | state.replacements.extend(replacement_) | ||||
state.actions.pop(0) | state.actions.pop(0) | ||||
state.write() | state.write() | ||||
ui.progress(_("editing"), None) | |||||
def _finishhistedit(ui, repo, state, fm): | def _finishhistedit(ui, repo, state, fm): | ||||
"""This action runs when histedit is finishing its session""" | """This action runs when histedit is finishing its session""" | ||||
repo.ui.pushbuffer() | repo.ui.pushbuffer() | ||||
hg.update(repo, state.parentctxnode, quietempty=True) | hg.update(repo, state.parentctxnode, quietempty=True) | ||||
repo.ui.popbuffer() | repo.ui.popbuffer() | ||||
mapping, tmpnodes, created, ntm = processreplacement(state) | mapping, tmpnodes, created, ntm = processreplacement(state) |