Show More
@@ -325,14 +325,25 b' def branch(repo, subset, x):' | |||||
325 | """``branch(string or set)`` |
|
325 | """``branch(string or set)`` | |
326 | All changesets belonging to the given branch or the branches of the given |
|
326 | All changesets belonging to the given branch or the branches of the given | |
327 | changesets. |
|
327 | changesets. | |
|
328 | ||||
|
329 | If `string` starts with `re:`, the remainder of the name is treated as | |||
|
330 | a regular expression. To match a branch that actually starts with `re:`, | |||
|
331 | use the prefix `literal:`. | |||
328 | """ |
|
332 | """ | |
329 | try: |
|
333 | try: | |
330 | b = getstring(x, '') |
|
334 | b = getstring(x, '') | |
331 | if b in repo.branchmap(): |
|
|||
332 | return [r for r in subset if repo[r].branch() == b] |
|
|||
333 | except error.ParseError: |
|
335 | except error.ParseError: | |
334 | # not a string, but another revspec, e.g. tip() |
|
336 | # not a string, but another revspec, e.g. tip() | |
335 | pass |
|
337 | pass | |
|
338 | else: | |||
|
339 | kind, pattern, matcher = _stringmatcher(b) | |||
|
340 | if kind == 'literal': | |||
|
341 | # note: falls through to the revspec case if no branch with | |||
|
342 | # this name exists | |||
|
343 | if pattern in repo.branchmap(): | |||
|
344 | return [r for r in subset if matcher(repo[r].branch())] | |||
|
345 | else: | |||
|
346 | return [r for r in subset if matcher(repo[r].branch())] | |||
336 |
|
347 | |||
337 | s = getset(repo, range(len(repo)), x) |
|
348 | s = getset(repo, range(len(repo)), x) | |
338 | b = set() |
|
349 | b = set() |
@@ -233,6 +233,16 b' quoting needed' | |||||
233 | $ log 'branch(é)' |
|
233 | $ log 'branch(é)' | |
234 | 8 |
|
234 | 8 | |
235 | 9 |
|
235 | 9 | |
|
236 | $ log 'branch(a)' | |||
|
237 | 0 | |||
|
238 | $ hg log -r 'branch("re:a")' --template '{rev} {branch}\n' | |||
|
239 | 0 a | |||
|
240 | 2 a-b-c- | |||
|
241 | 3 +a+b+c+ | |||
|
242 | 4 -a-b-c- | |||
|
243 | 5 /a/b/c/ | |||
|
244 | 6 _a_b_c_ | |||
|
245 | 7 .a.b.c. | |||
236 | $ log 'children(ancestor(4,5))' |
|
246 | $ log 'children(ancestor(4,5))' | |
237 | 2 |
|
247 | 2 | |
238 | 3 |
|
248 | 3 |
General Comments 0
You need to be logged in to leave comments.
Login now