bookmark: deprecate 'recordchange' in favor of 'applychanges'
authorBoris Feld <boris.feld@octobus.net>
Mon, 10 Jul 2017 20:10:03 +0200
changeset 33515 3325c7dcabaa
parent 33514 169c97bbd94c
child 33516 f9e6e43c7987
bookmark: deprecate 'recordchange' in favor of 'applychanges' Now that we have migrated all in-core caller of 'recordchange' to 'applychanges', deprecate 'recordchange' so external callers will move to the new unified method.
hgext/share.py
mercurial/bookmarks.py
tests/test-obsolete.t
--- a/hgext/share.py	Mon Jul 10 20:06:15 2017 +0200
+++ b/hgext/share.py	Mon Jul 10 20:10:03 2017 +0200
@@ -141,7 +141,7 @@
 
 def extsetup(ui):
     extensions.wrapfunction(bookmarks, '_getbkfile', getbkfile)
-    extensions.wrapfunction(bookmarks.bmstore, 'recordchange', recordchange)
+    extensions.wrapfunction(bookmarks.bmstore, '_recordchange', recordchange)
     extensions.wrapfunction(bookmarks.bmstore, '_writerepo', writerepo)
     extensions.wrapcommand(commands.table, 'clone', clone)
 
--- a/mercurial/bookmarks.py	Mon Jul 10 20:06:15 2017 +0200
+++ b/mercurial/bookmarks.py	Mon Jul 10 20:10:03 2017 +0200
@@ -117,9 +117,15 @@
                 del self[name]
             else:
                 self[name] = node
-        self.recordchange(tr)
+        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
 
         The transaction is then responsible for updating the file content."""
--- a/tests/test-obsolete.t	Mon Jul 10 20:06:15 2017 +0200
+++ b/tests/test-obsolete.t	Mon Jul 10 20:10:03 2017 +0200
@@ -1149,7 +1149,7 @@
   >  bkmstoreinst._repo.currenttransaction().addpostclose('test_extension', trhook)
   >  orig(bkmstoreinst, *args, **kwargs)
   > def extsetup(ui):
-  >   extensions.wrapfunction(bookmarks.bmstore, 'recordchange',
+  >   extensions.wrapfunction(bookmarks.bmstore, '_recordchange',
   >                           _bookmarkchanged)
   > EOF