##// END OF EJS Templates
revset: handle wdir() in `roots()`...
Matt Harbison -
r50405:e02dcc62 default
parent child Browse files
Show More
@@ -2342,9 +2342,14 b' def roots(repo, subset, x):'
2342 parents = repo.changelog.parentrevs
2342 parents = repo.changelog.parentrevs
2343
2343
2344 def filter(r):
2344 def filter(r):
2345 for p in parents(r):
2345 try:
2346 if 0 <= p and p in s:
2346 for p in parents(r):
2347 return False
2347 if 0 <= p and p in s:
2348 return False
2349 except error.WdirUnsupported:
2350 for p in repo[None].parents():
2351 if p.rev() in s:
2352 return False
2348 return True
2353 return True
2349
2354
2350 return subset & s.filter(filter, condrepr=b'<roots>')
2355 return subset & s.filter(filter, condrepr=b'<roots>')
@@ -1481,6 +1481,13 b' prepare repository that has "default" br'
1481 $ hg init namedbranch
1481 $ hg init namedbranch
1482 $ cd namedbranch
1482 $ cd namedbranch
1483
1483
1484 $ log 'roots(.)'
1485 -1
1486 $ log 'roots(. or wdir())'
1487 -1
1488 $ log 'roots(wdir())'
1489 2147483647
1490
1484 $ echo default0 >> a
1491 $ echo default0 >> a
1485 $ hg ci -Aqm0
1492 $ hg ci -Aqm0
1486 $ echo default1 >> a
1493 $ echo default1 >> a
@@ -1498,6 +1505,11 b' prepare repository that has "default" br'
1498 $ echo default5 >> a
1505 $ echo default5 >> a
1499 $ hg ci -m5
1506 $ hg ci -m5
1500
1507
1508 $ log 'roots(. or wdir())'
1509 5
1510 $ log 'roots(wdir())'
1511 2147483647
1512
1501 "null" revision belongs to "default" branch (issue4683)
1513 "null" revision belongs to "default" branch (issue4683)
1502
1514
1503 $ log 'branch(null)'
1515 $ log 'branch(null)'
General Comments 0
You need to be logged in to leave comments. Login now