comparison mercurial/commands.py @ 24944:08ec11e3ae4c

bookmarks: rename unsetcurrent to deactivate (API) Today, the terms 'active' and 'current' are interchangeably used throughout the codebase in reference to the active bookmark (the bookmark that will be updated with the next commit). This leads to confusion among developers and users. This patch is part of a series to standardize the usage to 'active' throughout the mercurial codebase and user interface.
author Ryan McElroy <rmcelroy@fb.com>
date Mon, 13 Apr 2015 21:53:37 -0700
parents a4ee6f774f14
children e0b0fbd47491
comparison
equal deleted inserted replaced
24943:3e39f67ef663 24944:08ec11e3ae4c
978 for mark in names: 978 for mark in names:
979 if mark not in marks: 979 if mark not in marks:
980 raise util.Abort(_("bookmark '%s' does not exist") % 980 raise util.Abort(_("bookmark '%s' does not exist") %
981 mark) 981 mark)
982 if mark == repo._bookmarkcurrent: 982 if mark == repo._bookmarkcurrent:
983 bookmarks.unsetcurrent(repo) 983 bookmarks.deactivate(repo)
984 del marks[mark] 984 del marks[mark]
985 marks.write() 985 marks.write()
986 986
987 elif rename: 987 elif rename:
988 if not names: 988 if not names:
1004 for mark in names: 1004 for mark in names:
1005 mark = checkformat(mark) 1005 mark = checkformat(mark)
1006 if newact is None: 1006 if newact is None:
1007 newact = mark 1007 newact = mark
1008 if inactive and mark == repo._bookmarkcurrent: 1008 if inactive and mark == repo._bookmarkcurrent:
1009 bookmarks.unsetcurrent(repo) 1009 bookmarks.deactivate(repo)
1010 return 1010 return
1011 tgt = cur 1011 tgt = cur
1012 if rev: 1012 if rev:
1013 tgt = scmutil.revsingle(repo, rev).node() 1013 tgt = scmutil.revsingle(repo, rev).node()
1014 checkconflict(repo, mark, cur, force, tgt) 1014 checkconflict(repo, mark, cur, force, tgt)
1015 marks[mark] = tgt 1015 marks[mark] = tgt
1016 if not inactive and cur == marks[newact] and not rev: 1016 if not inactive and cur == marks[newact] and not rev:
1017 bookmarks.setcurrent(repo, newact) 1017 bookmarks.setcurrent(repo, newact)
1018 elif cur != tgt and newact == repo._bookmarkcurrent: 1018 elif cur != tgt and newact == repo._bookmarkcurrent:
1019 bookmarks.unsetcurrent(repo) 1019 bookmarks.deactivate(repo)
1020 marks.write() 1020 marks.write()
1021 1021
1022 elif inactive: 1022 elif inactive:
1023 if len(marks) == 0: 1023 if len(marks) == 0:
1024 ui.status(_("no bookmarks set\n")) 1024 ui.status(_("no bookmarks set\n"))
1025 elif not repo._bookmarkcurrent: 1025 elif not repo._bookmarkcurrent:
1026 ui.status(_("no active bookmark\n")) 1026 ui.status(_("no active bookmark\n"))
1027 else: 1027 else:
1028 bookmarks.unsetcurrent(repo) 1028 bookmarks.deactivate(repo)
1029 finally: 1029 finally:
1030 wlock.release() 1030 wlock.release()
1031 else: # show bookmarks 1031 else: # show bookmarks
1032 fm = ui.formatter('bookmarks', opts) 1032 fm = ui.formatter('bookmarks', opts)
1033 hexfn = fm.hexfunc 1033 hexfn = fm.hexfunc
6411 ui.status(_("(activating bookmark %s)\n") % brev) 6411 ui.status(_("(activating bookmark %s)\n") % brev)
6412 elif brev: 6412 elif brev:
6413 if repo._bookmarkcurrent: 6413 if repo._bookmarkcurrent:
6414 ui.status(_("(leaving bookmark %s)\n") % 6414 ui.status(_("(leaving bookmark %s)\n") %
6415 repo._bookmarkcurrent) 6415 repo._bookmarkcurrent)
6416 bookmarks.unsetcurrent(repo) 6416 bookmarks.deactivate(repo)
6417 6417
6418 return ret 6418 return ret
6419 6419
6420 @command('verify', []) 6420 @command('verify', [])
6421 def verify(ui, repo): 6421 def verify(ui, repo):