##// END OF EJS Templates
revset: extend fullreposet to make "null" revision magically appears in set...
Yuya Nishihara -
r24204:d2de20e1 default
parent child Browse files
Show More
@@ -323,8 +323,6 b' def _getrevsource(repo, r):'
323
323
324 def stringset(repo, subset, x):
324 def stringset(repo, subset, x):
325 x = repo[x].rev()
325 x = repo[x].rev()
326 if x == -1 and len(subset) == len(repo):
327 return baseset([-1])
328 if x in subset:
326 if x in subset:
329 return baseset([x])
327 return baseset([x])
330 return baseset()
328 return baseset()
@@ -3312,16 +3310,17 b' class spanset(abstractsmartset):'
3312 class fullreposet(spanset):
3310 class fullreposet(spanset):
3313 """a set containing all revisions in the repo
3311 """a set containing all revisions in the repo
3314
3312
3315 This class exists to host special optimization.
3313 This class exists to host special optimization and magic to handle virtual
3314 revisions such as "null".
3316 """
3315 """
3317
3316
3318 def __init__(self, repo):
3317 def __init__(self, repo):
3319 super(fullreposet, self).__init__(repo)
3318 super(fullreposet, self).__init__(repo)
3320
3319
3321 def __contains__(self, rev):
3320 def __contains__(self, rev):
3321 # assumes the given rev is valid
3322 hidden = self._hiddenrevs
3322 hidden = self._hiddenrevs
3323 return ((self._start <= rev < self._end)
3323 return not (hidden and rev in hidden)
3324 and not (hidden and rev in hidden))
3325
3324
3326 def __and__(self, other):
3325 def __and__(self, other):
3327 """As self contains the whole repo, all of the other set should also be
3326 """As self contains the whole repo, all of the other set should also be
@@ -187,6 +187,8 b' check that various commands work well wi'
187 [255]
187 [255]
188 $ hg debugrevspec 'rev(6)'
188 $ hg debugrevspec 'rev(6)'
189 $ hg debugrevspec 'rev(4)'
189 $ hg debugrevspec 'rev(4)'
190 $ hg debugrevspec 'null'
191 -1
190
192
191 Check that public changeset are not accounted as obsolete:
193 Check that public changeset are not accounted as obsolete:
192
194
@@ -478,8 +478,33 b' Test explicit numeric revision'
478 [255]
478 [255]
479
479
480 Test null revision
480 Test null revision
481 $ log '(null)'
482 -1
483 $ log '(null:0)'
484 -1
485 0
486 $ log '(0:null)'
487 0
488 -1
489 $ log 'null::0'
490 -1
491 0
492 $ log 'null:tip - 0:'
493 -1
494 $ log 'null: and null::' | head -1
495 -1
496 $ log 'null: or 0:' | head -2
497 -1
498 0
481 $ log 'ancestors(null)'
499 $ log 'ancestors(null)'
482 -1
500 -1
501 $ log 'reverse(null:)' | tail -2
502 0
503 -1
504 $ log 'first(null:)'
505 -1
506 $ log 'min(null:)'
507 -1
483 $ log 'tip:null and all()' | tail -2
508 $ log 'tip:null and all()' | tail -2
484 1
509 1
485 0
510 0
General Comments 0
You need to be logged in to leave comments. Login now