changeset 30587:94de83ed250e

bookmarks: rename `compare()` to `comparebookmarks()` (API) Next commit will remove optional parameters from `compare()` function. Let's rename `compare()` to `comparebookmarks()` to avoid ambiguity from callers from external extensions.
author Stanislau Hlebik <stash@fb.com>
date Tue, 22 Nov 2016 01:33:31 -0800
parents 43a9e02a7b7f
children 8f8211903b83
files mercurial/bookmarks.py mercurial/exchange.py
diffstat 2 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Mon Dec 05 17:40:01 2016 +0100
+++ b/mercurial/bookmarks.py	Tue Nov 22 01:33:31 2016 -0800
@@ -323,8 +323,8 @@
     finally:
         lockmod.release(tr, l, w)
 
-def compare(repo, srcmarks, dstmarks,
-            srchex=None, dsthex=None, targets=None):
+def comparebookmarks(repo, srcmarks, dstmarks,
+                     srchex=None, dsthex=None, targets=None):
     '''Compare bookmarks between srcmarks and dstmarks
 
     This returns tuple "(addsrc, adddst, advsrc, advdst, diverge,
@@ -443,7 +443,7 @@
     ui.debug("checking for updated bookmarks\n")
     localmarks = repo._bookmarks
     (addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same
-     ) = compare(repo, remotemarks, localmarks, dsthex=hex)
+     ) = comparebookmarks(repo, remotemarks, localmarks, dsthex=hex)
 
     status = ui.status
     warn = ui.warn
@@ -505,8 +505,8 @@
     '''
     ui.status(_("searching for changed bookmarks\n"))
 
-    r = compare(repo, other.listkeys('bookmarks'), repo._bookmarks,
-                dsthex=hex)
+    r = comparebookmarks(repo, other.listkeys('bookmarks'), repo._bookmarks,
+                         dsthex=hex)
     addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
 
     incomings = []
@@ -547,8 +547,8 @@
     '''
     ui.status(_("searching for changed bookmarks\n"))
 
-    r = compare(repo, repo._bookmarks, other.listkeys('bookmarks'),
-                srchex=hex)
+    r = comparebookmarks(repo, repo._bookmarks, other.listkeys('bookmarks'),
+                         srchex=hex)
     addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
 
     outgoings = []
@@ -592,8 +592,8 @@
 
     This returns "(# of incoming, # of outgoing)" tuple.
     '''
-    r = compare(repo, other.listkeys('bookmarks'), repo._bookmarks,
-                dsthex=hex)
+    r = comparebookmarks(repo, other.listkeys('bookmarks'), repo._bookmarks,
+                         dsthex=hex)
     addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r
     return (len(addsrc), len(adddst))
 
--- a/mercurial/exchange.py	Mon Dec 05 17:40:01 2016 +0100
+++ b/mercurial/exchange.py	Tue Nov 22 01:33:31 2016 -0800
@@ -603,7 +603,8 @@
     explicit = set([repo._bookmarks.expandname(bookmark)
                     for bookmark in pushop.bookmarks])
 
-    comp = bookmod.compare(repo, repo._bookmarks, remotebookmark, srchex=hex)
+    comp = bookmod.comparebookmarks(repo, repo._bookmarks,
+                                    remotebookmark, srchex=hex)
     addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = comp
     for b, scid, dcid in advsrc:
         if b in explicit: