Patchwork [07,of,10] bookmark: deprecate 'recordchange' in favor of 'applychanges'

login
register
mail settings
Submitter Boris Feld
Date July 15, 2017, 11:42 a.m.
Message ID <94da61e581672f5c9616.1500118975@FB>
Download mbox | patch
Permalink /patch/22400/
State Accepted
Headers show

Comments

Boris Feld - July 15, 2017, 11:42 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1499710203 -7200
#      Mon Jul 10 20:10:03 2017 +0200
# Node ID 94da61e581672f5c9616f1ad1336cfaadbdc96a9
# Parent  d8f4f481d22c4fd4b606c2635c9b2f0fada67e8c
# EXP-Topic tr.changes.bookmarks
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.

Patch

diff -r d8f4f481d22c -r 94da61e58167 hgext/share.py
--- 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)
 
diff -r d8f4f481d22c -r 94da61e58167 mercurial/bookmarks.py
--- 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."""
diff -r d8f4f481d22c -r 94da61e58167 tests/test-obsolete.t
--- 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