##// END OF EJS Templates
amend: use context manager for locking
Martin von Zweigbergk -
r32921:5694311d default
parent child Browse files
Show More
@@ -30,7 +30,6 b' from . import ('
30 error,
30 error,
31 formatter,
31 formatter,
32 graphmod,
32 graphmod,
33 lock as lockmod,
34 match as matchmod,
33 match as matchmod,
35 obsolete,
34 obsolete,
36 patch,
35 patch,
@@ -2730,10 +2729,8 b' def amend(ui, repo, commitfunc, old, ext'
2730 base = old.p1()
2729 base = old.p1()
2731 createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
2730 createmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt)
2732
2731
2733 wlock = lock = newid = None
2732 newid = None
2734 try:
2733 with repo.wlock(), repo.lock():
2735 wlock = repo.wlock()
2736 lock = repo.lock()
2737 with repo.transaction('amend') as tr:
2734 with repo.transaction('amend') as tr:
2738 # See if we got a message from -m or -l, if not, open the editor
2735 # See if we got a message from -m or -l, if not, open the editor
2739 # with the message of the changeset to amend
2736 # with the message of the changeset to amend
@@ -2896,8 +2893,6 b' def amend(ui, repo, commitfunc, old, ext'
2896 ui.note(_('stripping intermediate changeset %s\n') % ctx)
2893 ui.note(_('stripping intermediate changeset %s\n') % ctx)
2897 ui.note(_('stripping amended changeset %s\n') % old)
2894 ui.note(_('stripping amended changeset %s\n') % old)
2898 repair.strip(ui, repo, old.node(), topic='amend-backup')
2895 repair.strip(ui, repo, old.node(), topic='amend-backup')
2899 finally:
2900 lockmod.release(lock, wlock)
2901 return newid
2896 return newid
2902
2897
2903 def commiteditor(repo, ctx, subs, editform=''):
2898 def commiteditor(repo, ctx, subs, editform=''):
General Comments 0
You need to be logged in to leave comments. Login now