mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
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.
This commit is contained in:
parent
633c0af10d
commit
2f82753cb2
@ -360,7 +360,7 @@ def rebase(ui, repo, **opts):
|
||||
currentbookmarks = repo._bookmarks.copy()
|
||||
activebookmark = activebookmark or repo._bookmarkcurrent
|
||||
if activebookmark:
|
||||
bookmarks.unsetcurrent(repo)
|
||||
bookmarks.deactivate(repo)
|
||||
|
||||
extrafn = _makeextrafn(extrafns)
|
||||
|
||||
|
@ -61,7 +61,7 @@ def strip(ui, repo, revs, update=True, backup=True, force=None, bookmark=None):
|
||||
marks = repo._bookmarks
|
||||
if bookmark:
|
||||
if bookmark == repo._bookmarkcurrent:
|
||||
bookmarks.unsetcurrent(repo)
|
||||
bookmarks.deactivate(repo)
|
||||
del marks[bookmark]
|
||||
marks.write()
|
||||
ui.write(_("bookmark '%s' deleted\n") % bookmark)
|
||||
|
@ -84,7 +84,7 @@ class bmstore(dict):
|
||||
def _writerepo(self, repo):
|
||||
"""Factored out for extensibility"""
|
||||
if repo._bookmarkcurrent not in self:
|
||||
unsetcurrent(repo)
|
||||
deactivate(repo)
|
||||
|
||||
wlock = repo.wlock()
|
||||
try:
|
||||
@ -151,7 +151,10 @@ def setcurrent(repo, mark):
|
||||
wlock.release()
|
||||
repo._bookmarkcurrent = mark
|
||||
|
||||
def unsetcurrent(repo):
|
||||
def deactivate(repo):
|
||||
"""
|
||||
Unset the active bookmark in this reposiotry.
|
||||
"""
|
||||
wlock = repo.wlock()
|
||||
try:
|
||||
try:
|
||||
|
@ -980,7 +980,7 @@ def bookmark(ui, repo, *names, **opts):
|
||||
raise util.Abort(_("bookmark '%s' does not exist") %
|
||||
mark)
|
||||
if mark == repo._bookmarkcurrent:
|
||||
bookmarks.unsetcurrent(repo)
|
||||
bookmarks.deactivate(repo)
|
||||
del marks[mark]
|
||||
marks.write()
|
||||
|
||||
@ -1006,7 +1006,7 @@ def bookmark(ui, repo, *names, **opts):
|
||||
if newact is None:
|
||||
newact = mark
|
||||
if inactive and mark == repo._bookmarkcurrent:
|
||||
bookmarks.unsetcurrent(repo)
|
||||
bookmarks.deactivate(repo)
|
||||
return
|
||||
tgt = cur
|
||||
if rev:
|
||||
@ -1016,7 +1016,7 @@ def bookmark(ui, repo, *names, **opts):
|
||||
if not inactive and cur == marks[newact] and not rev:
|
||||
bookmarks.setcurrent(repo, newact)
|
||||
elif cur != tgt and newact == repo._bookmarkcurrent:
|
||||
bookmarks.unsetcurrent(repo)
|
||||
bookmarks.deactivate(repo)
|
||||
marks.write()
|
||||
|
||||
elif inactive:
|
||||
@ -1025,7 +1025,7 @@ def bookmark(ui, repo, *names, **opts):
|
||||
elif not repo._bookmarkcurrent:
|
||||
ui.status(_("no active bookmark\n"))
|
||||
else:
|
||||
bookmarks.unsetcurrent(repo)
|
||||
bookmarks.deactivate(repo)
|
||||
finally:
|
||||
wlock.release()
|
||||
else: # show bookmarks
|
||||
@ -6413,7 +6413,7 @@ def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False,
|
||||
if repo._bookmarkcurrent:
|
||||
ui.status(_("(leaving bookmark %s)\n") %
|
||||
repo._bookmarkcurrent)
|
||||
bookmarks.unsetcurrent(repo)
|
||||
bookmarks.deactivate(repo)
|
||||
|
||||
return ret
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user