Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bookmarks.py @ 24400:03c84c966ef5
bookmarks: rewrite comparing bookmarks in commands.summary() by compare()
This patch adds utility function "summary()", to replace comparing
bookmarks in "commands.summary()". This replacement finishes
centralizing the logic to compare bookmarks into "bookmarks.compare()".
This patch also adds test to check summary output with
incoming/outgoing bookmarks, because "hg summary --remote" is not
tested yet on the repository with incoming/outgoing bookmarks.
This test uses "(glob)" to ignore summary about incoming/outgoing
changesets.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Thu, 19 Mar 2015 23:36:06 +0900 |
parents | 3993eb47ea49 |
children | 3d7c512b258d |
line wrap: on
line diff
--- a/mercurial/bookmarks.py Thu Mar 19 23:36:05 2015 +0900 +++ b/mercurial/bookmarks.py Thu Mar 19 23:36:06 2015 +0900 @@ -498,6 +498,16 @@ return 0 +def summary(repo, other): + '''Compare bookmarks between repo and other for "hg summary" output + + This returns "(# of incoming, # of outgoing)" tuple. + ''' + r = compare(repo, other.listkeys('bookmarks'), repo._bookmarks, + dsthex=hex) + addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = r + return (len(addsrc), len(adddst)) + def validdest(repo, old, new): """Is the new bookmark destination a valid update from the old one""" repo = repo.unfiltered()