hgext/histedit.py
changeset 38786 28d8b5f49b4d
parent 38783 e7aa113b14f7
child 39914 b153ca77a52b
equal deleted inserted replaced
38785:fb9121ea38c4 38786:28d8b5f49b4d
  1082     elif goal == 'edit-plan':
  1082     elif goal == 'edit-plan':
  1083         if any((outg, revs, freeargs)):
  1083         if any((outg, revs, freeargs)):
  1084             raise error.Abort(_('only --commands argument allowed with '
  1084             raise error.Abort(_('only --commands argument allowed with '
  1085                                '--edit-plan'))
  1085                                '--edit-plan'))
  1086     else:
  1086     else:
  1087         if os.path.exists(os.path.join(repo.path, 'histedit-state')):
  1087         if state.inprogress():
  1088             raise error.Abort(_('history edit already in progress, try '
  1088             raise error.Abort(_('history edit already in progress, try '
  1089                                '--continue or --abort'))
  1089                                '--continue or --abort'))
  1090         if outg:
  1090         if outg:
  1091             if revs:
  1091             if revs:
  1092                 raise error.Abort(_('no revisions allowed with --outgoing'))
  1092                 raise error.Abort(_('no revisions allowed with --outgoing'))
  1622             repair.strip(ui, repo, roots, backup=backup)
  1622             repair.strip(ui, repo, roots, backup=backup)
  1623 
  1623 
  1624 def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs):
  1624 def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs):
  1625     if isinstance(nodelist, str):
  1625     if isinstance(nodelist, str):
  1626         nodelist = [nodelist]
  1626         nodelist = [nodelist]
  1627     if os.path.exists(os.path.join(repo.path, 'histedit-state')):
  1627     state = histeditstate(repo)
  1628         state = histeditstate(repo)
  1628     if state.inprogress():
  1629         state.read()
  1629         state.read()
  1630         histedit_nodes = {action.node for action
  1630         histedit_nodes = {action.node for action
  1631                           in state.actions if action.node}
  1631                           in state.actions if action.node}
  1632         common_nodes = histedit_nodes & set(nodelist)
  1632         common_nodes = histedit_nodes & set(nodelist)
  1633         if common_nodes:
  1633         if common_nodes:
  1636     return orig(ui, repo, nodelist, *args, **kwargs)
  1636     return orig(ui, repo, nodelist, *args, **kwargs)
  1637 
  1637 
  1638 extensions.wrapfunction(repair, 'strip', stripwrapper)
  1638 extensions.wrapfunction(repair, 'strip', stripwrapper)
  1639 
  1639 
  1640 def summaryhook(ui, repo):
  1640 def summaryhook(ui, repo):
  1641     if not os.path.exists(repo.vfs.join('histedit-state')):
  1641     state = histeditstate(repo)
       
  1642     if not state.inprogress():
  1642         return
  1643         return
  1643     state = histeditstate(repo)
       
  1644     state.read()
  1644     state.read()
  1645     if state.actions:
  1645     if state.actions:
  1646         # i18n: column positioning for "hg summary"
  1646         # i18n: column positioning for "hg summary"
  1647         ui.write(_('hist:   %s (histedit --continue)\n') %
  1647         ui.write(_('hist:   %s (histedit --continue)\n') %
  1648                  (ui.label(_('%d remaining'), 'histedit.remaining') %
  1648                  (ui.label(_('%d remaining'), 'histedit.remaining') %