Mercurial > evolve
changeset 2765:8a2e1aac6b41
rewriteutil: move 'deletebookmark' to the module
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 23 Jul 2017 06:14:09 +0200 |
parents | a4a6f4128be5 |
children | 83ad13719e26 |
files | hgext3rd/evolve/__init__.py hgext3rd/evolve/rewriteutil.py |
diffstat | 2 files changed, 18 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py Sun Jul 23 06:11:33 2017 +0200 +++ b/hgext3rd/evolve/__init__.py Sun Jul 23 06:14:09 2017 +0200 @@ -2110,22 +2110,6 @@ finally: lockmod.release(wlock) -def _deletebookmark(repo, repomarks, bookmarks): - wlock = lock = tr = None - try: - wlock = repo.wlock() - lock = repo.lock() - tr = repo.transaction('prune') - bmchanges = [] - for bookmark in bookmarks: - bmchanges.append((bookmark, None)) - compat.bookmarkapplychanges(repo, tr, bmchanges) - tr.close() - for bookmark in sorted(bookmarks): - repo.ui.write(_("bookmark '%s' deleted\n") % bookmark) - finally: - lockmod.release(tr, lock, wlock) - def _getmetadata(**opts): metadata = {} date = opts.get('date') @@ -2192,7 +2176,7 @@ repomarks, revs = reachablefrombookmark(repo, revs, bookmarks) if not revs: # no revisions to prune - delete bookmark immediately - _deletebookmark(repo, repomarks, bookmarks) + rewriteutil.deletebookmark(repo, repomarks, bookmarks) if not revs: raise error.Abort(_('nothing to prune')) @@ -2295,7 +2279,7 @@ # update bookmarks if bookmarks: - _deletebookmark(repo, repomarks, bookmarks) + rewriteutil.deletebookmark(repo, repomarks, bookmarks) # create markers obsolete.createmarkers(repo, relations, metadata=metadata)
--- a/hgext3rd/evolve/rewriteutil.py Sun Jul 23 06:11:33 2017 +0200 +++ b/hgext3rd/evolve/rewriteutil.py Sun Jul 23 06:14:09 2017 +0200 @@ -72,6 +72,22 @@ raise error.Abort(msg, hint=hint) return root, head +def deletebookmark(repo, repomarks, bookmarks): + wlock = lock = tr = None + try: + wlock = repo.wlock() + lock = repo.lock() + tr = repo.transaction('prune') + bmchanges = [] + for bookmark in bookmarks: + bmchanges.append((bookmark, None)) + compat.bookmarkapplychanges(repo, tr, bmchanges) + tr.close() + for bookmark in sorted(bookmarks): + repo.ui.write(_("bookmark '%s' deleted\n") % bookmark) + finally: + lockmod.release(tr, lock, wlock) + def presplitupdate(repo, ui, prev, ctx): """prepare the working directory for a split (for topic hooking) """