hgext/histedit.py
changeset 33446 fad6852cf879
parent 33445 0491004e2233
child 33486 af402f11cb9d
equal deleted inserted replaced
33445:0491004e2233 33446:fad6852cf879
  1120     if ui.configbool("histedit", "singletransaction", False):
  1120     if ui.configbool("histedit", "singletransaction", False):
  1121         # Don't use a 'with' for the transaction, since actions may close
  1121         # Don't use a 'with' for the transaction, since actions may close
  1122         # and reopen a transaction. For example, if the action executes an
  1122         # and reopen a transaction. For example, if the action executes an
  1123         # external process it may choose to commit the transaction first.
  1123         # external process it may choose to commit the transaction first.
  1124         tr = repo.transaction('histedit')
  1124         tr = repo.transaction('histedit')
  1125     try:
  1125     with util.acceptintervention(tr):
  1126         while state.actions:
  1126         while state.actions:
  1127             state.write(tr=tr)
  1127             state.write(tr=tr)
  1128             actobj = state.actions[0]
  1128             actobj = state.actions[0]
  1129             pos += 1
  1129             pos += 1
  1130             ui.progress(_("editing"), pos, actobj.torule(),
  1130             ui.progress(_("editing"), pos, actobj.torule(),
  1133                                                        actobj.torule()))
  1133                                                        actobj.torule()))
  1134             parentctx, replacement_ = actobj.run()
  1134             parentctx, replacement_ = actobj.run()
  1135             state.parentctxnode = parentctx.node()
  1135             state.parentctxnode = parentctx.node()
  1136             state.replacements.extend(replacement_)
  1136             state.replacements.extend(replacement_)
  1137             state.actions.pop(0)
  1137             state.actions.pop(0)
  1138 
       
  1139         if tr is not None:
       
  1140             tr.close()
       
  1141     except error.InterventionRequired:
       
  1142         if tr is not None:
       
  1143             tr.close()
       
  1144         raise
       
  1145     except Exception:
       
  1146         if tr is not None:
       
  1147             tr.abort()
       
  1148         raise
       
  1149 
  1138 
  1150     state.write()
  1139     state.write()
  1151     ui.progress(_("editing"), None)
  1140     ui.progress(_("editing"), None)
  1152 
  1141 
  1153 def _finishhistedit(ui, repo, state):
  1142 def _finishhistedit(ui, repo, state):