Mercurial > hg
comparison mercurial/cmdutil.py @ 51715:7601978f9e9f
typing: add type hints to `cmdutil.findrepo()`
Since 10db46e128d4, pytype almost figured this out, going from `Any` -> `_T0`,
but the intent is obvious.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 18 Jul 2024 19:55:51 -0400 |
parents | ca7bde5dbafb |
children | 278af66e6595 |
comparison
equal
deleted
inserted
replaced
51714:45d5e9a0f6a6 | 51715:7601978f9e9f |
---|---|
1110 hg.update(repo, newid[0], quietempty=True) | 1110 hg.update(repo, newid[0], quietempty=True) |
1111 | 1111 |
1112 ui.status(_(b"changed branch on %d changesets\n") % len(replacements)) | 1112 ui.status(_(b"changed branch on %d changesets\n") % len(replacements)) |
1113 | 1113 |
1114 | 1114 |
1115 def findrepo(p): | 1115 def findrepo(p: bytes) -> Optional[bytes]: |
1116 while not os.path.isdir(os.path.join(p, b".hg")): | 1116 while not os.path.isdir(os.path.join(p, b".hg")): |
1117 oldp, p = p, os.path.dirname(p) | 1117 oldp, p = p, os.path.dirname(p) |
1118 if p == oldp: | 1118 if p == oldp: |
1119 return None | 1119 return None |
1120 | 1120 |