mercurial/cmdutil.py
changeset 24993 be58bd30a478
parent 24991 4169a4f83548
child 24995 0579b0c2ea2b
equal deleted inserted replaced
24992:7df090c9c9fe 24993:be58bd30a478
  2462         ui.username() # raise exception if username not set
  2462         ui.username() # raise exception if username not set
  2463 
  2463 
  2464     ui.note(_('amending changeset %s\n') % old)
  2464     ui.note(_('amending changeset %s\n') % old)
  2465     base = old.p1()
  2465     base = old.p1()
  2466 
  2466 
  2467     wlock = lock = newid = None
  2467     wlock = dsguard = lock = newid = None
  2468     try:
  2468     try:
  2469         wlock = repo.wlock()
  2469         wlock = repo.wlock()
       
  2470         dsguard = dirstateguard(repo, 'amend')
  2470         lock = repo.lock()
  2471         lock = repo.lock()
  2471         tr = repo.transaction('amend')
  2472         tr = repo.transaction('amend')
  2472         try:
  2473         try:
  2473             # See if we got a message from -m or -l, if not, open the editor
  2474             # See if we got a message from -m or -l, if not, open the editor
  2474             # with the message of the changeset to amend
  2475             # with the message of the changeset to amend
  2635 
  2636 
  2636                 obsolete.createmarkers(repo, obs)
  2637                 obsolete.createmarkers(repo, obs)
  2637             tr.close()
  2638             tr.close()
  2638         finally:
  2639         finally:
  2639             tr.release()
  2640             tr.release()
       
  2641         dsguard.close()
  2640         if not createmarkers and newid != old.node():
  2642         if not createmarkers and newid != old.node():
  2641             # Strip the intermediate commit (if there was one) and the amended
  2643             # Strip the intermediate commit (if there was one) and the amended
  2642             # commit
  2644             # commit
  2643             if node:
  2645             if node:
  2644                 ui.note(_('stripping intermediate changeset %s\n') % ctx)
  2646                 ui.note(_('stripping intermediate changeset %s\n') % ctx)
  2645             ui.note(_('stripping amended changeset %s\n') % old)
  2647             ui.note(_('stripping amended changeset %s\n') % old)
  2646             repair.strip(ui, repo, old.node(), topic='amend-backup')
  2648             repair.strip(ui, repo, old.node(), topic='amend-backup')
  2647     finally:
  2649     finally:
  2648         if newid is None:
  2650         lockmod.release(lock, dsguard, wlock)
  2649             repo.dirstate.invalidate()
       
  2650         lockmod.release(lock, wlock)
       
  2651     return newid
  2651     return newid
  2652 
  2652 
  2653 def commiteditor(repo, ctx, subs, editform=''):
  2653 def commiteditor(repo, ctx, subs, editform=''):
  2654     if ctx.description():
  2654     if ctx.description():
  2655         return ctx.description()
  2655         return ctx.description()