Patchwork [V2] bookmarks: drop deprecated methods (API)

login
register
mail settings
Submitter Matt Harbison
Date Feb. 3, 2018, 5:53 p.m.
Message ID <bd31f3bf6824a6dd7d29.1517680433@Envy>
Download mbox | patch
Permalink /patch/27270/
State Accepted
Headers show

Comments

Matt Harbison - Feb. 3, 2018, 5:53 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1517631655 18000
#      Fri Feb 02 23:20:55 2018 -0500
# Node ID bd31f3bf6824a6dd7d296f73f0b91e35d19f963a
# Parent  ed3a7300b7b5a427bdcffefd0c80aab65824bf4b
bookmarks: drop deprecated methods (API)

The ProgrammingError prevents accidental usage of the dict base class methods.

.. api::

   The following deprecated methods have been removed from bookmarks:
   __setitem__(), __delitem__(), update(), and recordchange().  Use
   bookmarks.applychanges() instead.
Yuya Nishihara - Feb. 4, 2018, 2:01 a.m.
On Sat, 03 Feb 2018 12:53:53 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1517631655 18000
> #      Fri Feb 02 23:20:55 2018 -0500
> # Node ID bd31f3bf6824a6dd7d296f73f0b91e35d19f963a
> # Parent  ed3a7300b7b5a427bdcffefd0c80aab65824bf4b
> bookmarks: drop deprecated methods (API)

Queued, thanks.

Patch

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -103,30 +103,21 @@ 
         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)
+        raise error.ProgrammingError("use 'bookmarks.applychanges' instead")
 
     def _set(self, key, value):
         self._clean = False
         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)
+        raise error.ProgrammingError("use 'bookmarks.applychanges' instead")
 
     def _del(self, key):
         self._clean = False
         return dict.__delitem__(self, key)
 
     def update(self, *others):
-        msg = ("bookmarks.update(...)' is deprecated, "
-               "use 'bookmarks.applychanges'")
-        self._repo.ui.deprecwarn(msg, '4.5')
-        return dict.update(self, *others)
+        raise error.ProgrammingError("use 'bookmarks.applychanges' instead")
 
     def applychanges(self, repo, tr, changes):
         """Apply a list of changes to bookmarks
@@ -146,12 +137,6 @@ 
                 bmchanges[name] = (old, node)
         self._recordchange(tr)
 
-    def recordchange(self, tr):
-        msg = ("'bookmarks.recorchange' is deprecated, "
-               "use 'bookmarks.applychanges'")
-        self._repo.ui.deprecwarn(msg, '4.3')
-        return self._recordchange(tr)
-
     def _recordchange(self, tr):
         """record that bookmarks have been changed in a transaction