globalrevs: avoid scanning changelog when looking for commit with svnrev 0

Summary:
There is no commit associated with the Subversion revision 0 and therefore, we
can bail out early in this case.

Reviewed By: kulshrax

Differential Revision: D15838376

fbshipit-source-id: bed3bfb8af4ac177a67f33078778beccc83f0573
This commit is contained in:
Saurabh Singh 2019-06-14 18:23:39 -07:00 committed by Facebook Github Bot
parent 225b204f31
commit 458cf27e86

View File

@ -320,6 +320,13 @@ def _lookupglobalrev(repo, grev):
changelogrevision = cl.changelogrevision
tonode = cl.node
ui = repo.ui
startrev = ui.configint("globalrevs", "startrev")
# If the globalrevs start after 0, commit with global revision 0 cannot be
# associated with any commit because there exists no commit corresponding to
# a Subversion revision 0.
if startrev > 0 and grev == 0:
return []
def matchglobalrev(rev):
commitextra = changelogrevision(rev).extra
@ -340,7 +347,6 @@ def _lookupglobalrev(repo, grev):
return [hgnode]
matchedrevs = []
startrev = ui.configint("globalrevs", "startrev")
for rev in repo.revs("reverse(all())"):
# While using fast lookup, we have already searched the indexed commits
# upto lastrev and therefore, we can safely say that there is no commit