prev: simplify the bookmark preserving logic
We can use 'None' as a special value and have a simpler code.
--- a/hgext3rd/evolve/__init__.py Fri Jul 14 00:58:14 2017 +0200
+++ b/hgext3rd/evolve/__init__.py Fri Jul 14 01:01:22 2017 +0200
@@ -2018,12 +2018,14 @@
ui.warn(_('(do you want --no-topic)\n'))
elif len(parents) == 1:
target = parents[0]
- bm = repo._activebookmark
- shouldmove = opts.get('move_bookmark') and bm is not None
+ bookmark = None
+ if opts.get('move_bookmark'):
+ bookmark = repo._activebookmark
if dryrunopt:
ui.write(('hg update %s;\n' % target.rev()))
- if shouldmove:
- ui.write(('hg bookmark %s -r %s;\n' % (bm, target.rev())))
+ if bookmark is not None:
+ ui.write(('hg bookmark %s -r %s;\n'
+ % (bookmark, target.rev())))
else:
ret = hg.update(repo, target.rev())
if not ret:
@@ -2031,8 +2033,8 @@
try:
lock = repo.lock()
tr = repo.transaction('previous')
- if shouldmove:
- repo._bookmarks[bm] = target.node()
+ if bookmark is not None:
+ repo._bookmarks[bookmark] = target.node()
repo._bookmarks.recordchange(tr)
else:
bookmarksmod.deactivate(repo)