diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -174,7 +174,9 @@ def func(repo, subset, a, b): # functions def node(repo, subset, x): + # i18n: "id" is a keyword l = getargs(x, 1, 1, _("id requires one argument")) + # i18n: "id" is a keyword n = getstring(l[0], _("id requires a string")) if len(n) == 40: rn = repo[n].rev() @@ -183,10 +185,13 @@ def node(repo, subset, x): return [r for r in subset if r == rn] def rev(repo, subset, x): + # i18n: "rev" is a keyword l = getargs(x, 1, 1, _("rev requires one argument")) try: + # i18n: "rev" is a keyword l = int(getstring(l[0], _("rev requires a number"))) except ValueError: + # i18n: "rev" is a keyword raise error.ParseError(_("rev expects a number")) return [r for r in subset if r == l] @@ -228,10 +233,13 @@ def minrev(repo, subset, x): return [] def limit(repo, subset, x): + # i18n: "limit" is a keyword l = getargs(x, 2, 2, _("limit requires two arguments")) try: + # i18n: "limit" is a keyword lim = int(getstring(l[1], _("limit requires a number"))) except ValueError: + # i18n: "limit" is a keyword raise error.ParseError(_("limit expects a number")) return getset(repo, subset, l[0])[:lim] @@ -254,11 +262,13 @@ def branch(repo, subset, x): return [r for r in subset if r in s or repo[r].branch() in b] def ancestor(repo, subset, x): + # i18n: "ancestor" is a keyword l = getargs(x, 2, 2, _("ancestor requires two arguments")) r = range(len(repo)) a = getset(repo, r, l[0]) b = getset(repo, r, l[1]) if len(a) != 1 or len(b) != 1: + # i18n: "ancestor" is a keyword raise error.ParseError(_("ancestor arguments must be single revisions")) an = [repo[a[0]].ancestor(repo[b[0]]).rev()] @@ -279,17 +289,20 @@ def descendants(repo, subset, x): return [r for r in subset if r in s] def follow(repo, subset, x): + # i18n: "follow" is a keyword getargs(x, 0, 0, _("follow takes no arguments")) p = repo['.'].rev() s = set(repo.changelog.ancestors(p)) | set([p]) return [r for r in subset if r in s] def date(repo, subset, x): + # i18n: "date" is a keyword ds = getstring(x, _("date requires a string")) dm = util.matchdate(ds) return [r for r in subset if dm(repo[r].date()[0])] def keyword(repo, subset, x): + # i18n: "keyword" is a keyword kw = getstring(x, _("keyword requires a string")).lower() l = [] for r in subset: @@ -301,6 +314,7 @@ def keyword(repo, subset, x): def grep(repo, subset, x): try: + # i18n: "grep" is a keyword gr = re.compile(getstring(x, _("grep requires a string"))) except re.error, e: raise error.ParseError(_('invalid match pattern: %s') % e) @@ -314,10 +328,12 @@ def grep(repo, subset, x): return l def author(repo, subset, x): + # i18n: "author" is a keyword n = getstring(x, _("author requires a string")).lower() return [r for r in subset if n in repo[r].user().lower()] def hasfile(repo, subset, x): + # i18n: "file" is a keyword pat = getstring(x, _("file requires a pattern")) m = matchmod.match(repo.root, repo.getcwd(), [pat]) s = [] @@ -329,6 +345,7 @@ def hasfile(repo, subset, x): return s def contains(repo, subset, x): + # i18n: "contains" is a keyword pat = getstring(x, _("contains requires a pattern")) m = matchmod.match(repo.root, repo.getcwd(), [pat]) s = [] @@ -373,27 +390,33 @@ def checkstatus(repo, subset, pat, field return s def modifies(repo, subset, x): + # i18n: "modifies" is a keyword pat = getstring(x, _("modifies requires a pattern")) return checkstatus(repo, subset, pat, 0) def adds(repo, subset, x): + # i18n: "adds" is a keyword pat = getstring(x, _("adds requires a pattern")) return checkstatus(repo, subset, pat, 1) def removes(repo, subset, x): + # i18n: "removes" is a keyword pat = getstring(x, _("removes requires a pattern")) return checkstatus(repo, subset, pat, 2) def merge(repo, subset, x): + # i18n: "merge" is a keyword getargs(x, 0, 0, _("merge takes no arguments")) cl = repo.changelog return [r for r in subset if cl.parentrevs(r)[1] != -1] def closed(repo, subset, x): + # i18n: "closed" is a keyword getargs(x, 0, 0, _("closed takes no arguments")) return [r for r in subset if repo[r].extra().get('close')] def head(repo, subset, x): + # i18n: "head" is a keyword getargs(x, 0, 0, _("head takes no arguments")) hs = set() for b, ls in repo.branchmap().iteritems(): @@ -412,6 +435,7 @@ def present(repo, subset, x): return [] def sort(repo, subset, x): + # i18n: "sort" is a keyword l = getargs(x, 1, 2, _("sort requires one or two arguments")) keys = "rev" if len(l) == 2: @@ -454,6 +478,7 @@ def sort(repo, subset, x): return [e[-1] for e in l] def getall(repo, subset, x): + # i18n: "all" is a keyword getargs(x, 0, 0, _("all takes no arguments")) return subset @@ -469,7 +494,9 @@ def roots(repo, subset, x): def outgoing(repo, subset, x): import hg # avoid start-up nasties + # i18n: "outgoing" is a keyword l = getargs(x, 0, 1, _("outgoing requires a repository path")) + # i18n: "outgoing" is a keyword dest = l and getstring(l[0], _("outgoing requires a repository path")) or '' dest = repo.ui.expandpath(dest or 'default-push', dest or 'default') dest, branches = hg.parseurl(dest) @@ -485,10 +512,12 @@ def outgoing(repo, subset, x): return [r for r in subset if r in o] def tag(repo, subset, x): + # i18n: "tag" is a keyword args = getargs(x, 0, 1, _("tag takes one or no arguments")) cl = repo.changelog if args: tn = getstring(args[0], + # i18n: "tag" is a keyword _('the argument to tag must be a string')) s = set([cl.rev(n) for t, n in repo.tagslist() if t == tn]) else: