Mercurial > hg
diff hgext/strip.py @ 21847:f6f122f4813b
strip: remove bookmarks after strip succeed (issue4295)
In case we have revs to strip, delete the bookmark after the strip succeeds, not
beforehand as we might still abort due to dirty working directory, etc.
author | David Soria Parra <davidsp@fb.com> |
---|---|
date | Tue, 08 Jul 2014 16:24:23 -0700 |
parents | 04eaa8eec6a0 |
children | ba3bc6474bbf |
line wrap: on
line diff
--- a/hgext/strip.py Thu Jun 12 18:02:23 2014 -0700 +++ b/hgext/strip.py Tue Jul 08 16:24:23 2014 -0700 @@ -42,7 +42,7 @@ raise util.Abort(_("local changed subrepos found" + excsuffix)) return m, a, r, d -def strip(ui, repo, revs, update=True, backup="all", force=None): +def strip(ui, repo, revs, update=True, backup="all", force=None, bookmark=None): wlock = lock = None try: wlock = repo.wlock() @@ -59,6 +59,14 @@ repo.dirstate.write() repair.strip(ui, repo, revs, backup) + + marks = repo._bookmarks + if bookmark: + if bookmark == repo._bookmarkcurrent: + bookmarks.unsetcurrent(repo) + del marks[bookmark] + marks.write() + ui.write(_("bookmark '%s' deleted\n") % bookmark) finally: release(lock, wlock) @@ -205,15 +213,9 @@ repo.dirstate.write() update = False - if opts.get('bookmark'): - if mark == repo._bookmarkcurrent: - bookmarks.unsetcurrent(repo) - del marks[mark] - marks.write() - ui.write(_("bookmark '%s' deleted\n") % mark) strip(ui, repo, revs, backup=backup, update=update, - force=opts.get('force')) + force=opts.get('force'), bookmark=opts.get('bookmark')) finally: wlock.release()