changeset 33518:712a85b3677f

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.
author Boris Feld <boris.feld@octobus.net>
date Mon, 10 Jul 2017 21:49:37 +0200
parents 08bf0ebc6c8e
children 3b7e36f7e632
files mercurial/bookmarks.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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: