I'm going to add another caller in the next patch.
Details
- Reviewers
lothiraldan pulkit - Group Reviewers
hg-reviewers - Commits
- rHG531b86cc8fb3: shortest: make isrev() a top-level function
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Event Timeline
mercurial/scmutil.py | ||
---|---|---|
492 | This looks unrelated here. |
mercurial/scmutil.py | ||
---|---|---|
492 | Not completely unrelated. I moved it down here because it's no longer needed until here. It was used on line 478 before (and given Python scoping rules, it could have been moved down even before this patch, but that makes it harder to read IMO). |
+def mayberevnum(repo, prefix):
+ """Checks if the given prefix may be mistaken for a revision number"""
+ try:
+ i = int(prefix)
+ # if we are a pure int, then starting with zero will not be
+ # confused as a rev; or, obviously, if the int is larger
+ # than the value of the tip rev
+ if prefix[0:1] == b'0' or i > len(repo.changelog):
len(repo) should be better since repo.changelog over repoview isn't
instant. Another option is to pass in an unfiltered repo as before.
This looks unrelated here.