changeset 33515:3325c7dcabaa

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.
author Boris Feld <boris.feld@octobus.net>
date Mon, 10 Jul 2017 20:10:03 +0200
parents 169c97bbd94c
children f9e6e43c7987
files hgext/share.py mercurial/bookmarks.py tests/test-obsolete.t
diffstat 3 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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