bookmark: deprecate direct del of a bookmark value
authorBoris Feld <boris.feld@octobus.net>
Mon, 10 Jul 2017 21:49:37 +0200
changeset 33518 712a85b3677f
parent 33517 08bf0ebc6c8e
child 33519 3b7e36f7e632
bookmark: deprecate direct del of a bookmark value We want all bookmark deletion to go through 'applychanges', so lets deprecate legacy ways of doing bookmark deletion.
mercurial/bookmarks.py
--- a/mercurial/bookmarks.py	Mon Jul 10 21:47:34 2017 +0200
+++ b/mercurial/bookmarks.py	Mon Jul 10 21:49:37 2017 +0200
@@ -112,6 +112,12 @@
         return dict.__setitem__(self, key, value)
 
     def __delitem__(self, key):
+        msg = ("'del bookmarks[name]' is deprecated, "
+               "use 'bookmarks.applychanges'")
+        self._repo.ui.deprecwarn(msg, '4.3')
+        self._del(key)
+
+    def _del(self, key):
         self._clean = False
         return dict.__delitem__(self, key)
 
@@ -122,7 +128,7 @@
         for name, node in changes:
             old = self.get(name)
             if node is None:
-                del self[name]
+                self._del(name)
             else:
                 self._set(name, node)
             if bmchanges is not None: