# HG changeset patch # User Boris Feld # Date 2017-07-10 19:47:34 # Node ID 08bf0ebc6c8e613a69251d300272a6be0dc27ea8 # Parent f9e6e43c7987c27c2d0dceebd313b1ecb606dacb bookmark: deprecate direct set of a bookmark value We want all bookmark update to go through 'applychanges', so lets deprecate legacy ways of doing bookmark update. diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -102,8 +102,14 @@ class bmstore(dict): self._aclean = False def __setitem__(self, *args, **kwargs): + msg = ("'bookmarks[name] = node' is deprecated, " + "use 'bookmarks.applychanges'") + self._repo.ui.deprecwarn(msg, '4.3') + self._set(*args, **kwargs) + + def _set(self, key, value): self._clean = False - return dict.__setitem__(self, *args, **kwargs) + return dict.__setitem__(self, key, value) def __delitem__(self, key): self._clean = False @@ -118,7 +124,7 @@ class bmstore(dict): if node is None: del self[name] else: - self[name] = node + self._set(name, node) if bmchanges is not None: # if a previous value exist preserve the "initial" value previous = bmchanges.get(name)