##// END OF EJS Templates
revset: add id() and rev() to allow explicitly referring to changes by hash or rev
Augie Fackler -
r12716:c7e619e3 default
parent child Browse files
Show More
@@ -94,6 +94,9 b' The following predicates are supported:'
94 94 ``heads(set)``
95 95 Members of set with no children in set.
96 96
97 ``id(string)``
98 Revision non-ambiguously specified by the given hex string prefix
99
97 100 ``keyword(string)``
98 101 Search commit message, user name, and names of changed files for
99 102 string.
@@ -133,6 +136,9 b' The following predicates are supported:'
133 136 ``removes(pattern)``
134 137 Changesets which remove files matching pattern.
135 138
139 ``rev(number)``
140 Revision with the given numeric identifier.
141
136 142 ``reverse(set)``
137 143 Reverse order of set.
138 144
@@ -173,6 +173,23 b' def func(repo, subset, a, b):'
173 173
174 174 # functions
175 175
176 def node(repo, subset, x):
177 l = getargs(x, 1, 1, _("rev wants one argument"))
178 n = getstring(l[0], _("rev wants a string"))
179 if len(n) == 40:
180 rn = repo[n].rev()
181 else:
182 rn = repo.changelog.rev(repo.changelog._partialmatch(n))
183 return [r for r in subset if r == rn]
184
185 def rev(repo, subset, x):
186 l = getargs(x, 1, 1, _("rev wants one argument"))
187 try:
188 l = int(getstring(l[0], _("rev wants a number")))
189 except ValueError:
190 raise error.ParseError(_("rev expects a number"))
191 return [r for r in subset if r == l]
192
176 193 def p1(repo, subset, x):
177 194 ps = set()
178 195 cl = repo.changelog
@@ -501,6 +518,7 b' symbols = {'
501 518 "min": minrev,
502 519 "merge": merge,
503 520 "modifies": modifies,
521 "id": node,
504 522 "outgoing": outgoing,
505 523 "p1": p1,
506 524 "p2": p2,
@@ -508,6 +526,7 b' symbols = {'
508 526 "present": present,
509 527 "removes": removes,
510 528 "reverse": reverse,
529 "rev": rev,
511 530 "roots": roots,
512 531 "sort": sort,
513 532 "tag": tag,
@@ -247,6 +247,8 b' quoting needed'
247 247 6
248 248 $ log 'modifies(b)'
249 249 4
250 $ log 'id(5)'
251 2
250 252 $ log 'outgoing()'
251 253 8
252 254 9
@@ -276,6 +278,8 b' quoting needed'
276 278 4
277 279 3
278 280 2
281 $ log 'rev(5)'
282 5
279 283 $ log 'sort(limit(reverse(all()), 3))'
280 284 7
281 285 8
General Comments 0
You need to be logged in to leave comments. Login now