Show More
@@ -31,7 +31,7 b' branching.' | |||||
31 | from mercurial.i18n import _ |
|
31 | from mercurial.i18n import _ | |
32 | from mercurial.node import nullid, nullrev, bin, hex, short |
|
32 | from mercurial.node import nullid, nullrev, bin, hex, short | |
33 | from mercurial import util, commands, repair, extensions, pushkey, hg, url |
|
33 | from mercurial import util, commands, repair, extensions, pushkey, hg, url | |
34 |
from mercurial import |
|
34 | from mercurial import encoding | |
35 | from mercurial import bookmarks |
|
35 | from mercurial import bookmarks | |
36 | import os |
|
36 | import os | |
37 |
|
37 | |||
@@ -353,27 +353,6 b' def updatecurbookmark(orig, ui, repo, *a' | |||||
353 | bookmarks.setcurrent(repo, rev) |
|
353 | bookmarks.setcurrent(repo, rev) | |
354 | return res |
|
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 | cmdtable = { |
|
356 | cmdtable = { | |
378 | "bookmarks": |
|
357 | "bookmarks": | |
379 | (bookmark, |
|
358 | (bookmark, | |
@@ -385,6 +364,3 b' cmdtable = {' | |||||
385 | } |
|
364 | } | |
386 |
|
365 | |||
387 | colortable = {'bookmarks.current': 'green'} |
|
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 | import re |
|
8 | import re | |
9 | import parser, util, error, discovery |
|
9 | import parser, util, error, discovery | |
|
10 | import bookmarks as bookmarksmod | |||
10 | import match as matchmod |
|
11 | import match as matchmod | |
11 | from i18n import _, gettext |
|
12 | from i18n import _, gettext | |
12 |
|
13 | |||
@@ -664,12 +665,31 b' def tag(repo, subset, x):' | |||||
664 | def tagged(repo, subset, x): |
|
665 | def tagged(repo, subset, x): | |
665 | return tag(repo, subset, x) |
|
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 | symbols = { |
|
686 | symbols = { | |
668 | "adds": adds, |
|
687 | "adds": adds, | |
669 | "all": getall, |
|
688 | "all": getall, | |
670 | "ancestor": ancestor, |
|
689 | "ancestor": ancestor, | |
671 | "ancestors": ancestors, |
|
690 | "ancestors": ancestors, | |
672 | "author": author, |
|
691 | "author": author, | |
|
692 | "bookmark": bookmark, | |||
673 | "branch": branch, |
|
693 | "branch": branch, | |
674 | "children": children, |
|
694 | "children": children, | |
675 | "closed": closed, |
|
695 | "closed": closed, |
General Comments 0
You need to be logged in to leave comments.
Login now