D11235: typing: add several assertions to dirstatemap to appease pytype
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Fri Jul 30 05:13:29 UTC 2021
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
I think it's been mentioned in IRC that these can't be None in this case. This
fixes:
File "/mnt/c/Users/Matt/hg/mercurial/dirstatemap.py", line 213, in addfile: unsupported operand type(s) for &: 'None' and 'int' [unsupported-operands]
No attribute '__and__' on None or '__rand__' on int
Called from (traceback):
line 290, in reset_state
File "/mnt/c/Users/Matt/hg/mercurial/dirstatemap.py", line 214, in addfile: unsupported operand type(s) for &: 'None' and 'int' [unsupported-operands]
No attribute '__and__' on None or '__rand__' on int
Called from (traceback):
line 290, in reset_state
REPOSITORY
rHG Mercurial
BRANCH
stable
REVISION DETAIL
https://phab.mercurial-scm.org/D11235
AFFECTED FILES
mercurial/dirstatemap.py
CHANGE DETAILS
diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -209,6 +209,9 @@
else:
assert size != FROM_P2
assert size != NONNORMAL
+ assert size is not None
+ assert mtime is not None
+
state = b'n'
size = size & rangemask
mtime = mtime & rangemask
To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list