##// END OF EJS Templates
revrange: build balanced tree of addsets from revisions (issue4565)...
Yuya Nishihara -
r25385:a26a5540 default
parent child Browse files
Show More
@@ -709,7 +709,7 b' def revrange(repo, revs):'
709 return defval
709 return defval
710 return repo[val].rev()
710 return repo[val].rev()
711
711
712 l = revset.baseset([])
712 subsets = []
713
713
714 revsetaliases = [alias for (alias, _) in
714 revsetaliases = [alias for (alias, _) in
715 repo.ui.configitems("revsetalias")]
715 repo.ui.configitems("revsetalias")]
@@ -725,7 +725,7 b' def revrange(repo, revs):'
725 raise error.RepoLookupError
725 raise error.RepoLookupError
726
726
727 if isinstance(spec, int):
727 if isinstance(spec, int):
728 l = l + revset.baseset([spec])
728 subsets.append(revset.baseset([spec]))
729 continue
729 continue
730
730
731 if _revrangesep in spec:
731 if _revrangesep in spec:
@@ -738,27 +738,21 b' def revrange(repo, revs):'
738 if end == nullrev and start < 0:
738 if end == nullrev and start < 0:
739 start = nullrev
739 start = nullrev
740 rangeiter = repo.changelog.revs(start, end)
740 rangeiter = repo.changelog.revs(start, end)
741 if not l:
741 l = revset.baseset(rangeiter)
742 # by far the most common case: revs = ["-1:0"]
742 subsets.append(l)
743 l = revset.baseset(rangeiter)
744 continue
745 l = l + revset.baseset(rangeiter)
746 continue
743 continue
747 elif spec and spec in repo: # single unquoted rev
744 elif spec and spec in repo: # single unquoted rev
748 rev = revfix(repo, spec, None)
745 rev = revfix(repo, spec, None)
749 l = l + revset.baseset([rev])
746 subsets.append(revset.baseset([rev]))
750 continue
747 continue
751 except error.RepoLookupError:
748 except error.RepoLookupError:
752 pass
749 pass
753
750
754 # fall through to new-style queries if old-style fails
751 # fall through to new-style queries if old-style fails
755 m = revset.match(repo.ui, spec, repo)
752 m = revset.match(repo.ui, spec, repo)
756 if l:
753 subsets.append(m(repo))
757 l = l + m(repo)
758 else:
759 l = m(repo)
760
754
761 return l
755 return revset._combinesets(subsets)
762
756
763 def expandpats(pats):
757 def expandpats(pats):
764 '''Expand bare globs when running on windows.
758 '''Expand bare globs when running on windows.
@@ -1084,6 +1084,13 b' test that chained `or` operations never '
1084 0
1084 0
1085 1
1085 1
1086
1086
1087 test that repeated `-r` options never eat up stack (issue4565)
1088 (uses `-r 0::1` to avoid possible optimization at old-style parser)
1089
1090 $ hg log -T '{rev}\n' `python -c "for i in xrange(500): print '-r 0::1 ',"`
1091 0
1092 1
1093
1087 check that conversion to only works
1094 check that conversion to only works
1088 $ try --optimize '::3 - ::1'
1095 $ try --optimize '::3 - ::1'
1089 (minus
1096 (minus
General Comments 0
You need to be logged in to leave comments. Login now