# HG changeset patch # User Kevin Bullock # Date 2013-01-27 20:24:37 # Node ID 8260fa9f30b952048ed8961bbb76a62204334b98 # Parent e945bcb87973ca663c1d84dc9a85508e51aaa489 bookmarks: don't use bookmarks.listbookmarks in local computations bookmarks.listbookmarks is for wire-protocol use. The normal way to get all the bookmarks on a local repository is repo._bookmarks. diff --git a/mercurial/repoview.py b/mercurial/repoview.py --- a/mercurial/repoview.py +++ b/mercurial/repoview.py @@ -9,7 +9,7 @@ import copy import phases import util -import obsolete, bookmarks, revset +import obsolete, revset def hideablerevs(repo): @@ -32,7 +32,7 @@ def computehidden(repo): if r not in hideable] for par in repo[None].parents(): blockers.append(par.rev()) - for bm in bookmarks.listbookmarks(repo).values(): + for bm in repo._bookmarks.values(): blockers.append(repo[bm].rev()) blocked = cl.ancestors(blockers, inclusive=True) return frozenset(r for r in hideable if r not in blocked) diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -8,7 +8,6 @@ import re import parser, util, error, discovery, hbisect, phases import node -import bookmarks as bookmarksmod import match as matchmod from i18n import _ import encoding @@ -375,14 +374,14 @@ def bookmark(repo, subset, x): _('the argument to bookmark must be a string')) kind, pattern, matcher = _stringmatcher(bm) if kind == 'literal': - bmrev = bookmarksmod.listbookmarks(repo).get(bm, None) + bmrev = repo._bookmarks.get(bm, None) if not bmrev: raise util.Abort(_("bookmark '%s' does not exist") % bm) bmrev = repo[bmrev].rev() return [r for r in subset if r == bmrev] else: matchrevs = set() - for name, bmrev in bookmarksmod.listbookmarks(repo).iteritems(): + for name, bmrev in repo._bookmarks.iteritems(): if matcher(name): matchrevs.add(bmrev) if not matchrevs: @@ -394,7 +393,7 @@ def bookmark(repo, subset, x): return [r for r in subset if r in bmrevs] bms = set([repo[r].rev() - for r in bookmarksmod.listbookmarks(repo).values()]) + for r in repo._bookmarks.values()]) return [r for r in subset if r in bms] def branch(repo, subset, x): diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t --- a/tests/test-bookmarks-pushpull.t +++ b/tests/test-bookmarks-pushpull.t @@ -171,6 +171,18 @@ divergent bookmarks Y 0:4e3505fd9583 Z 1:0d2164f0ce0d +revsets should not ignore divergent bookmarks + + $ hg bookmark -fr 1 Z + $ hg log -r 'bookmark()' --template '{rev}:{node|short} {bookmarks}\n' + 0:4e3505fd9583 Y + 1:9b140be10808 @ X Z foobar + 2:0d2164f0ce0d @foo X@foo + $ hg log -r 'bookmark("X@foo")' --template '{rev}:{node|short} {bookmarks}\n' + 2:0d2164f0ce0d @foo X@foo + $ hg log -r 'bookmark("re:X@foo")' --template '{rev}:{node|short} {bookmarks}\n' + 2:0d2164f0ce0d @foo X@foo + update a remote bookmark from a non-head to a head $ hg up -q Y @@ -299,7 +311,7 @@ hgweb @ 9b140be1080824d768c5a4691a564088eede71f9 X 9b140be1080824d768c5a4691a564088eede71f9 Y c922c0139ca03858f655e4a2af4dd02796a63969 - Z 0d2164f0ce0d8f1d6f94351eba04b794909be66c + Z 9b140be1080824d768c5a4691a564088eede71f9 foo 0000000000000000000000000000000000000000 foobar 9b140be1080824d768c5a4691a564088eede71f9 $ hg out -B http://localhost:$HGPORT/ diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -1210,6 +1210,14 @@ bookmarks prevent a changeset being hidd $ hg log --template '{rev}:{node}\n' 1:a765632148dc55d38c35c4f247c618701886cb2f 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 + $ hg bookmark -d X + +divergent bookmarks are not hidden + + $ hg bookmark --hidden -r 1 X@foo + $ hg log --template '{rev}:{node}\n' + 1:a765632148dc55d38c35c4f247c618701886cb2f + 0:9f758d63dcde62d547ebfb08e1e7ee96535f2b05 clear extensions configuration $ echo '[extensions]' >> $HGRCPATH