Show More
@@ -31,7 +31,7 b' branching.' | |||
|
31 | 31 | from mercurial.i18n import _ |
|
32 | 32 | from mercurial.node import nullid, nullrev, bin, hex, short |
|
33 | 33 | from mercurial import util, commands, repair, extensions, pushkey, hg, url |
|
34 |
from mercurial import |
|
|
34 | from mercurial import encoding | |
|
35 | 35 | from mercurial import bookmarks |
|
36 | 36 | import os |
|
37 | 37 | |
@@ -353,27 +353,6 b' def updatecurbookmark(orig, ui, repo, *a' | |||
|
353 | 353 | bookmarks.setcurrent(repo, rev) |
|
354 | 354 | return res |
|
355 | 355 | |
|
356 | def bmrevset(repo, subset, x): | |
|
357 | """``bookmark([name])`` | |
|
358 | The named bookmark or all bookmarks. | |
|
359 | """ | |
|
360 | # i18n: "bookmark" is a keyword | |
|
361 | args = revset.getargs(x, 0, 1, _('bookmark takes one or no arguments')) | |
|
362 | if args: | |
|
363 | bm = revset.getstring(args[0], | |
|
364 | # i18n: "bookmark" is a keyword | |
|
365 | _('the argument to bookmark must be a string')) | |
|
366 | bmrev = bookmarks.listbookmarks(repo).get(bm, None) | |
|
367 | if bmrev: | |
|
368 | bmrev = repo.changelog.rev(bin(bmrev)) | |
|
369 | return [r for r in subset if r == bmrev] | |
|
370 | bms = set([repo.changelog.rev(bin(r)) | |
|
371 | for r in bookmarks.listbookmarks(repo).values()]) | |
|
372 | return [r for r in subset if r in bms] | |
|
373 | ||
|
374 | def extsetup(ui): | |
|
375 | revset.symbols['bookmark'] = bmrevset | |
|
376 | ||
|
377 | 356 | cmdtable = { |
|
378 | 357 | "bookmarks": |
|
379 | 358 | (bookmark, |
@@ -385,6 +364,3 b' cmdtable = {' | |||
|
385 | 364 | } |
|
386 | 365 | |
|
387 | 366 | colortable = {'bookmarks.current': 'green'} |
|
388 | ||
|
389 | # tell hggettext to extract docstrings from these functions: | |
|
390 | i18nfunctions = [bmrevset] |
@@ -7,6 +7,7 b'' | |||
|
7 | 7 | |
|
8 | 8 | import re |
|
9 | 9 | import parser, util, error, discovery |
|
10 | import bookmarks as bookmarksmod | |
|
10 | 11 | import match as matchmod |
|
11 | 12 | from i18n import _, gettext |
|
12 | 13 | |
@@ -664,12 +665,31 b' def tag(repo, subset, x):' | |||
|
664 | 665 | def tagged(repo, subset, x): |
|
665 | 666 | return tag(repo, subset, x) |
|
666 | 667 | |
|
668 | def bookmark(repo, subset, x): | |
|
669 | """``bookmark([name])`` | |
|
670 | The named bookmark or all bookmarks. | |
|
671 | """ | |
|
672 | # i18n: "bookmark" is a keyword | |
|
673 | args = getargs(x, 0, 1, _('bookmark takes one or no arguments')) | |
|
674 | if args: | |
|
675 | bm = getstring(args[0], | |
|
676 | # i18n: "bookmark" is a keyword | |
|
677 | _('the argument to bookmark must be a string')) | |
|
678 | bmrev = bookmarksmod.listbookmarks(repo).get(bm, None) | |
|
679 | if bmrev: | |
|
680 | bmrev = repo[bmrev].rev() | |
|
681 | return [r for r in subset if r == bmrev] | |
|
682 | bms = set([repo[r].rev() | |
|
683 | for r in bookmarksmod.listbookmarks(repo).values()]) | |
|
684 | return [r for r in subset if r in bms] | |
|
685 | ||
|
667 | 686 | symbols = { |
|
668 | 687 | "adds": adds, |
|
669 | 688 | "all": getall, |
|
670 | 689 | "ancestor": ancestor, |
|
671 | 690 | "ancestors": ancestors, |
|
672 | 691 | "author": author, |
|
692 | "bookmark": bookmark, | |
|
673 | 693 | "branch": branch, |
|
674 | 694 | "children": children, |
|
675 | 695 | "closed": closed, |
General Comments 0
You need to be logged in to leave comments.
Login now