comparison mercurial/revset.py @ 18495:8260fa9f30b9 stable

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.
author Kevin Bullock <kbullock@ringworld.org>
date Sun, 27 Jan 2013 14:24:37 -0600
parents 692cbda1eb50
children ae645d4f084c
comparison
equal deleted inserted replaced
18494:e945bcb87973 18495:8260fa9f30b9
6 # GNU General Public License version 2 or any later version. 6 # GNU General Public License version 2 or any later version.
7 7
8 import re 8 import re
9 import parser, util, error, discovery, hbisect, phases 9 import parser, util, error, discovery, hbisect, phases
10 import node 10 import node
11 import bookmarks as bookmarksmod
12 import match as matchmod 11 import match as matchmod
13 from i18n import _ 12 from i18n import _
14 import encoding 13 import encoding
15 import obsolete as obsmod 14 import obsolete as obsmod
16 import repoview 15 import repoview
373 bm = getstring(args[0], 372 bm = getstring(args[0],
374 # i18n: "bookmark" is a keyword 373 # i18n: "bookmark" is a keyword
375 _('the argument to bookmark must be a string')) 374 _('the argument to bookmark must be a string'))
376 kind, pattern, matcher = _stringmatcher(bm) 375 kind, pattern, matcher = _stringmatcher(bm)
377 if kind == 'literal': 376 if kind == 'literal':
378 bmrev = bookmarksmod.listbookmarks(repo).get(bm, None) 377 bmrev = repo._bookmarks.get(bm, None)
379 if not bmrev: 378 if not bmrev:
380 raise util.Abort(_("bookmark '%s' does not exist") % bm) 379 raise util.Abort(_("bookmark '%s' does not exist") % bm)
381 bmrev = repo[bmrev].rev() 380 bmrev = repo[bmrev].rev()
382 return [r for r in subset if r == bmrev] 381 return [r for r in subset if r == bmrev]
383 else: 382 else:
384 matchrevs = set() 383 matchrevs = set()
385 for name, bmrev in bookmarksmod.listbookmarks(repo).iteritems(): 384 for name, bmrev in repo._bookmarks.iteritems():
386 if matcher(name): 385 if matcher(name):
387 matchrevs.add(bmrev) 386 matchrevs.add(bmrev)
388 if not matchrevs: 387 if not matchrevs:
389 raise util.Abort(_("no bookmarks exist that match '%s'") 388 raise util.Abort(_("no bookmarks exist that match '%s'")
390 % pattern) 389 % pattern)
392 for bmrev in matchrevs: 391 for bmrev in matchrevs:
393 bmrevs.add(repo[bmrev].rev()) 392 bmrevs.add(repo[bmrev].rev())
394 return [r for r in subset if r in bmrevs] 393 return [r for r in subset if r in bmrevs]
395 394
396 bms = set([repo[r].rev() 395 bms = set([repo[r].rev()
397 for r in bookmarksmod.listbookmarks(repo).values()]) 396 for r in repo._bookmarks.values()])
398 return [r for r in subset if r in bms] 397 return [r for r in subset if r in bms]
399 398
400 def branch(repo, subset, x): 399 def branch(repo, subset, x):
401 """``branch(string or set)`` 400 """``branch(string or set)``
402 All changesets belonging to the given branch or the branches of the given 401 All changesets belonging to the given branch or the branches of the given