Show More
@@ -474,6 +474,11 b' def branch(repo, subset, x):' | |||||
474 | :hg:`help revisions.patterns`. |
|
474 | :hg:`help revisions.patterns`. | |
475 | """ |
|
475 | """ | |
476 | getbi = repo.revbranchcache().branchinfo |
|
476 | getbi = repo.revbranchcache().branchinfo | |
|
477 | def getbranch(r): | |||
|
478 | try: | |||
|
479 | return getbi(r)[0] | |||
|
480 | except error.WdirUnsupported: | |||
|
481 | return repo[r].branch() | |||
477 |
|
482 | |||
478 | try: |
|
483 | try: | |
479 | b = getstring(x, '') |
|
484 | b = getstring(x, '') | |
@@ -486,21 +491,21 b' def branch(repo, subset, x):' | |||||
486 | # note: falls through to the revspec case if no branch with |
|
491 | # note: falls through to the revspec case if no branch with | |
487 | # this name exists and pattern kind is not specified explicitly |
|
492 | # this name exists and pattern kind is not specified explicitly | |
488 | if pattern in repo.branchmap(): |
|
493 | if pattern in repo.branchmap(): | |
489 |
return subset.filter(lambda r: matcher(getb |
|
494 | return subset.filter(lambda r: matcher(getbranch(r)), | |
490 | condrepr=('<branch %r>', b)) |
|
495 | condrepr=('<branch %r>', b)) | |
491 | if b.startswith('literal:'): |
|
496 | if b.startswith('literal:'): | |
492 | raise error.RepoLookupError(_("branch '%s' does not exist") |
|
497 | raise error.RepoLookupError(_("branch '%s' does not exist") | |
493 | % pattern) |
|
498 | % pattern) | |
494 | else: |
|
499 | else: | |
495 |
return subset.filter(lambda r: matcher(getb |
|
500 | return subset.filter(lambda r: matcher(getbranch(r)), | |
496 | condrepr=('<branch %r>', b)) |
|
501 | condrepr=('<branch %r>', b)) | |
497 |
|
502 | |||
498 | s = getset(repo, fullreposet(repo), x) |
|
503 | s = getset(repo, fullreposet(repo), x) | |
499 | b = set() |
|
504 | b = set() | |
500 | for r in s: |
|
505 | for r in s: | |
501 |
b.add(getb |
|
506 | b.add(getbranch(r)) | |
502 | c = s.__contains__ |
|
507 | c = s.__contains__ | |
503 |
return subset.filter(lambda r: c(r) or getb |
|
508 | return subset.filter(lambda r: c(r) or getbranch(r) in b, | |
504 | condrepr=lambda: '<branch %r>' % sorted(b)) |
|
509 | condrepr=lambda: '<branch %r>' % sorted(b)) | |
505 |
|
510 | |||
506 | @predicate('bumped()', safe=True) |
|
511 | @predicate('bumped()', safe=True) |
@@ -1294,6 +1294,35 b' Test working-directory integer revision ' | |||||
1294 | $ hg debugrevspec '0:wdir() & id(ffffffffffff)' |
|
1294 | $ hg debugrevspec '0:wdir() & id(ffffffffffff)' | |
1295 | BROKEN: should be '2147483647' |
|
1295 | BROKEN: should be '2147483647' | |
1296 |
|
1296 | |||
|
1297 | Test branch() with wdir() | |||
|
1298 | ||||
|
1299 | $ log '0:wdir() & branch("literal:é")' | |||
|
1300 | 8 | |||
|
1301 | 9 | |||
|
1302 | 2147483647 | |||
|
1303 | $ log '0:wdir() & branch("re:é")' | |||
|
1304 | 8 | |||
|
1305 | 9 | |||
|
1306 | 2147483647 | |||
|
1307 | $ log '0:wdir() & branch("re:^a")' | |||
|
1308 | 0 | |||
|
1309 | 2 | |||
|
1310 | $ log '0:wdir() & branch(8)' | |||
|
1311 | 8 | |||
|
1312 | 9 | |||
|
1313 | 2147483647 | |||
|
1314 | ||||
|
1315 | branch(wdir()) returns all revisions belonging to the working branch. The wdir | |||
|
1316 | itself isn't returned unless it is explicitly populated. | |||
|
1317 | ||||
|
1318 | $ log 'branch(wdir())' | |||
|
1319 | 8 | |||
|
1320 | 9 | |||
|
1321 | $ log '0:wdir() & branch(wdir())' | |||
|
1322 | 8 | |||
|
1323 | 9 | |||
|
1324 | 2147483647 | |||
|
1325 | ||||
1297 | $ log 'outgoing()' |
|
1326 | $ log 'outgoing()' | |
1298 | 8 |
|
1327 | 8 | |
1299 | 9 |
|
1328 | 9 |
General Comments 0
You need to be logged in to leave comments.
Login now