Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Sep 2021 09:46:37 +0200] rev 48058
dirstate: stop checking for path collision when adjusting parents
This was already checked at a earlier point when adding the file.
Differential Revision: https://phab.mercurial-scm.org/D11504
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Sep 2021 15:08:47 +0200] rev 48057
dirstate: drop the `_updatedfiles` set
This is a lot of book keeping for something that was only used to clear
ambiguous time. Since this is no no longer in use, we can drop it.
Differential Revision: https://phab.mercurial-scm.org/D11503
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Sep 2021 15:23:03 +0200] rev 48056
dirstate: drop the `clearambiguoustimes` method for the map
This is no longer called anywhere.
Differential Revision: https://phab.mercurial-scm.org/D11502
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 22 Sep 2021 14:54:42 +0200] rev 48055
dirstate: simplify the ambiguity clearing at write time
The serialization function is already doing this, so we don't need to do it
manually. We just need to propagate the right definition of "now".
Differential Revision: https://phab.mercurial-scm.org/D11501
Martin von Zweigbergk <martinvonz@google.com> [Tue, 28 Sep 2021 09:32:24 -0700] rev 48054
histedit: use more specific exceptions for more detailed exit codes
Differential Revision: https://phab.mercurial-scm.org/D11509
Martin von Zweigbergk <martinvonz@google.com> [Tue, 28 Sep 2021 09:25:05 -0700] rev 48053
histedit: remove redundant checks for unfinished histedit state
Both text-based and curses-based histedit already check for unfinished
operations (not just unfinished histedit), so there's no need to check
specifically for unfinished histedit.
Differential Revision: https://phab.mercurial-scm.org/D11508
Simon Sapin <simon.sapin@octobus.net> [Tue, 28 Sep 2021 13:43:14 +0200] rev 48052
dirstate: Appease pytype
test-check-pytype.t was failing since
98c0408324e6:
File "/home/simon/projects/hg/mercurial/dirstatemap.py", line 572, in
addfile: unsupported operand type(s) for &: 'size: None' and
'rangemask: int' [unsupported-operands]
No attribute '__and__' on 'size: None' or '__rand__' on 'rangemask: int'
File "/home/simon/projects/hg/mercurial/dirstatemap.py", line 573, in
addfile: unsupported operand type(s) for &: 'mtime: None' and
'rangemask: int' [unsupported-operands]
No attribute '__and__' on 'mtime: None' or '__rand__' on 'rangemask: int'
`None` is the default value of the `size` and `mtime` parameters of the
`addfile` method. However, the relevant lines are only used in a code path
where those defaults are never used. These `size` and `mtime` are passed
to `DirstateItem.new_normal` which (in the C implementation) calls
`dirstate_item_new_normal` which uses:
PyArg_ParseTuple(args, "iii", &mode, &size, &mtime)
So `None` values would cause an exception to be raised anyway.
The new `assert`s only move that exception earlier, and informs pytype
that we expect `None` to never happen in this code path.
Differential Revision: https://phab.mercurial-scm.org/D11500
Simon Sapin <simon.sapin@octobus.net> [Thu, 23 Sep 2021 18:29:40 +0200] rev 48051
dirstate: Pass the final DirstateItem to _rustmap.addfile()
Now that the Python DirstateItem class wraps a Rust DirstateEntry value,
use that value directly instead of converting through v1 data + 5 booleans.
Also remove propogating the return value. None of the callers look at it,
and it is always None.
Differential Revision: https://phab.mercurial-scm.org/D11494
Simon Sapin <simon.sapin@octobus.net> [Thu, 23 Sep 2021 15:36:43 +0200] rev 48050
dirstate: Replace dropfile with drop_item_and_copy_source
Those removing a DirstateItem and a copy source are always done together
Differential Revision: https://phab.mercurial-scm.org/D11493
Simon Sapin <simon.sapin@octobus.net> [Thu, 23 Sep 2021 15:29:38 +0200] rev 48049
rust: Remove some obsolete doc-comments
About parameters that have been removed or replaced
Differential Revision: https://phab.mercurial-scm.org/D11492
Simon Sapin <simon.sapin@octobus.net> [Thu, 23 Sep 2021 15:26:33 +0200] rev 48048
dirstate: Remove return boolean from dirstatemap.dropfile
None of the remaining callers use it.
Differential Revision: https://phab.mercurial-scm.org/D11491
Simon Sapin <simon.sapin@octobus.net> [Wed, 22 Sep 2021 18:56:58 +0200] rev 48047
dirstate: Propagate dirstate-v2 parse errors from set_dirstate_item
… so that Python sees a proper ValueError instead of only
`SystemError: Rust panic`
Differential Revision: https://phab.mercurial-scm.org/D11489
Simon Sapin <simon.sapin@octobus.net> [Wed, 22 Sep 2021 18:42:00 +0200] rev 48046
dirstate: Don’t drop unrelated data in DirstateMap::set_entry
For example, copy source are handled separately. Removing it goes through
the `copy_map_remove` method (exposed to Python as `.copymap.pop()`)
Differential Revision: https://phab.mercurial-scm.org/D11488
Simon Sapin <simon.sapin@octobus.net> [Wed, 22 Sep 2021 18:21:58 +0200] rev 48045
dirstate: Skip no-op conversion in Rust DirstateMap::set_v1
Now that the `DirstateItem` python class is implemented in Rust containing
a `DirstateEntry` value, use that value directly instead of reconstructing
it from v1 data.
Also rename from `set_v1` since dirstate-v1 data is not used anymore.
Differential Revision: https://phab.mercurial-scm.org/D11487
Simon Sapin <simon.sapin@octobus.net> [Wed, 22 Sep 2021 11:33:29 +0200] rev 48044
dirstate: Use the Rust implementation of DirstateItem when Rust is enabled
… instead of the C implementation, with C/Rust conversions at the FFI boundary
Differential Revision: https://phab.mercurial-scm.org/D11486
Simon Sapin <simon.sapin@octobus.net> [Wed, 22 Sep 2021 11:28:52 +0200] rev 48043
rust: Add Python bindings for DirstateEntry as rustext.dirstate.DirstateItem
Differential Revision: https://phab.mercurial-scm.org/D11485
Simon Sapin <simon.sapin@octobus.net> [Mon, 20 Sep 2021 19:18:21 +0200] rev 48042
rust: Align DirstateEntry internals with Python/C DirstateItem
This propagate to this Rust struct the similar change that was made recently
to the Python classe and C struct. Namely, instead of storing a four-valued
`state` field we now store seven (bit-packed) booleans that give lower-level
information.
Additionally, the marker values -1 and -2 for mtime and size should not
be used internally anymore. They are replaced by some combinations of booleans
For now, all uses of of `DirstateEntry` still use the compatibility APIs
with `state` and marker values. Later the Rust API for DirstateMap
will be increasingly updated to the new style.
Also change the expected result of the test_non_normal_other_parent_entries
unit test. Only a `DirstateEntry` with `size == -2 && mtime != -1` is
affected, but this case never occurs outside of unit tests.
`size == -2` was the marker value for "from other parent" entries,
where no meaningful mtime is stored.
Differential Revision: https://phab.mercurial-scm.org/D11484
Raphaël Gomès <rgomes@octobus.net> [Tue, 28 Sep 2021 09:40:57 +0200] rev 48041
branching: merge stable into default
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Sep 2021 18:18:56 +0200] rev 48040
manifestlog: also monitor `00manifest.n` when applicable
This let the locarepo's file cache detect outdated nodemap docket and reload the
manifestlog after `localrepo.invalidate` when applicable.
The same problem than
issue6554 could affect the Manifest too.
Differential Revision: https://phab.mercurial-scm.org/D11483
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Sep 2021 18:03:37 +0200] rev 48039
changelog: also monitor `00changelog.n` when applicable (
issue6554)
This let the locarepo's file cache detect outdated nodemap docket and reload the
changelog after `localrepo.invalidate` when applicable.
Differential Revision: https://phab.mercurial-scm.org/D11482
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Sep 2021 21:18:50 +0200] rev 48038
persistent-nodemap: introduce a test to highlight possible race
Weakness in the current file caching of the changelog means that a writer can
end up using an outdated docket. This might result in "committed"
persistent-nodemap data from a previous writer to be overwritten by a later
writer. This break the strong "append only" assumption of the persistent nodemap
and can result in confused reader.
The race windows are quite narrow. See the test documentation for details.
The issues is fixed in the next changeset.
Differential Revision: https://phab.mercurial-scm.org/D11481
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Sep 2021 21:18:44 +0200] rev 48037
test: enable share-safe in test-persistent-nodemap
We will use some share in this test and I would rather have them safe.
Differential Revision: https://phab.mercurial-scm.org/D11480
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 21 Sep 2021 18:02:07 +0200] rev 48036
filecache: abstract the fetching of the list of tracked file
We will need it for a coming fix that will requires to check a variable list of
file for the changelog.
Differential Revision: https://phab.mercurial-scm.org/D11479
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Sep 2021 18:18:15 +0200] rev 48035
persistent-nodemap: use quiet upgrade in tests
This make them less verbose while keeping the important information in the
checked output.
Differential Revision: https://phab.mercurial-scm.org/D11478
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 20 Sep 2021 18:08:46 +0200] rev 48034
persistent-nodemap: fix a typo in a test comment
oops.
Differential Revision: https://phab.mercurial-scm.org/D11477
Valentin Gatien-Baron <valentin.gatienbaron@gmail.com> [Wed, 22 Sep 2021 17:14:54 -0400] rev 48033
bookmarks: add an option to make pull mirror remote bookmarks
For backups for instance. Merging bookmarks is not a useful behavior
in that case.
Differential Revision: https://phab.mercurial-scm.org/D11490
Martin von Zweigbergk <martinvonz@google.com> [Thu, 23 Sep 2021 09:42:20 -0700] rev 48032
errors: use InputError for bad path arguments to `hg annotate`
Differential Revision: https://phab.mercurial-scm.org/D11498
Martin von Zweigbergk <martinvonz@google.com> [Thu, 23 Sep 2021 09:40:01 -0700] rev 48031
errors: use InputError for bad --similarity value
Differential Revision: https://phab.mercurial-scm.org/D11497
Martin von Zweigbergk <martinvonz@google.com> [Thu, 23 Sep 2021 09:38:45 -0700] rev 48030
errors: use InputError for some invalid revsets and such
Differential Revision: https://phab.mercurial-scm.org/D11496
Augie Fackler <augie@google.com> [Thu, 23 Sep 2021 17:05:37 -0400] rev 48029
merge: with stable
Yuya Nishihara <yuya@tcha.org> [Thu, 23 Sep 2021 16:52:35 +0900] rev 48028
dirstate: fix leak of entry object in dirstate_item_from_v1_data()
Yuya Nishihara <yuya@tcha.org> [Thu, 23 Sep 2021 16:44:17 +0900] rev 48027
dirstate: fix parse_dirstate() to error out if NULL entry created
Since
83f0e93ec34b "dirstate-item: move the C implementation to the same
logic", dirstate_item_from_v1_data() gets more likely to return NULL, and
the fuzzer crashes because of that.
Simon Sapin <simon.sapin@octobus.net> [Mon, 20 Sep 2021 20:55:38 +0200] rev 48026
rust: Remove EntryState::Unknown
This enum variant represented the `state == '?'` case, which was used
to represent the absence of a dirstate entry/item (and therefore of that
entry’s state).
Now that previous refactors have removed this use in the Python/Rust
FFI APIs, the remaining uses can be removed by replacing `EntryState`
by `Option<EntryState>` where appropriate, using `None` to represent
the absence of an entry.
Differential Revision: https://phab.mercurial-scm.org/D11465
Simon Sapin <simon.sapin@octobus.net> [Mon, 20 Sep 2021 20:21:35 +0200] rev 48025
dirstate: Remove the `state == ' '` special case
Previously this was used to create a `DirstateItem` representing dirstate tree
nodes that semantically don’t have an associated `DirtateItem`.
This isn’t used anymore now that `dirstatemap.debug_iter` yields plain tuples.
Differential Revision: https://phab.mercurial-scm.org/D11464
Simon Sapin <simon.sapin@octobus.net> [Mon, 20 Sep 2021 20:20:55 +0200] rev 48024
debugsate: Change debug_iter() to yield tuples instead of DirstateItem
This removes the need for `DirstateItem` to support the `state == ' '`
special case which represents dirstate tree nodes without an item.
Differential Revision: https://phab.mercurial-scm.org/D11463
Simon Sapin <simon.sapin@octobus.net> [Mon, 20 Sep 2021 19:59:09 +0200] rev 48023
debugstate: Always call dirstatemap.debug_iter()
… passing it a new `all` argument for the `--all` CLI option,
instead of conditionally calling `.debug_iter()` or `.items()`
This prepares for the next commit.
Differential Revision: https://phab.mercurial-scm.org/D11462
Simon Sapin <simon.sapin@octobus.net> [Fri, 17 Sep 2021 13:33:45 +0200] rev 48022
rust: Make the fields of DirstateEntry private
This is a first step toward making its internal structure equivalent to
Python’s DirstateItem.
Differential Revision: https://phab.mercurial-scm.org/D11461
Simon Sapin <simon.sapin@octobus.net> [Mon, 20 Sep 2021 13:16:36 +0200] rev 48021
rust: Remove support for passing a dict to the Rust pathutil.dirs()
That is only used by the Python dirstatemap, which not used when Rust
is enabled.
This allows removing the private `extract_dirstate` function which
creates `DirstateEntry` values. This in turn will make easier upcoming
changes to `DirstateEntry`.
Differential Revision: https://phab.mercurial-scm.org/D11460
Simon Sapin <simon.sapin@octobus.net> [Mon, 20 Sep 2021 12:52:32 +0200] rev 48020
rust: Remove the `rustext.parsers` module
It only exported Rust implementations of the parse_dirstate and pack_dirtate
functions, which are only used (anymore) when Rust is not enabled.
fakedirstatewritetime.py was detecting the presence of `rustext.parsers`
but what it really wants to know is whether the Rust implementation of
`dirstatemap` is used. This changes it to detect `rustext.dirstate` instead.
Differential Revision: https://phab.mercurial-scm.org/D11459
Simon Sapin <simon.sapin@octobus.net> [Fri, 17 Sep 2021 14:36:54 +0200] rev 48019
dirstate: remove now-unused .directories() method
It calls _rustmap.directories() which was already removed
Differential Revision: https://phab.mercurial-scm.org/D11458
Simon Sapin <simon.sapin@octobus.net> [Fri, 17 Sep 2021 12:42:24 +0200] rev 48018
rust: Move DirstateEntry to its own module
… and RawEntry to the dirstate::parsers module, the only one that uses it.
Differential Revision: https://phab.mercurial-scm.org/D11457
Raphaël Gomès <rgomes@octobus.net> [Mon, 20 Sep 2021 15:16:10 +0200] rev 48017
patchbomb: fix traceback on outgoing when not specifying revisions
A user reported that `hg email -n -o` raised with the following traceback:
```
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 3.8.12 (default, Sep 13 2021, 22:12:54) [GCC 7.5.0]
** Mercurial Distributed SCM (version 5.9.1)
** Extensions loaded: patchbomb
Traceback (most recent call last):
File "/usr/pkg/bin/hg", line 61, in <module>
dispatch.run()
File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 144, in run
status = dispatch(req)
File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 250, in dispatch
status = _rundispatch(req)
File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 294, in _rundispatch
ret = _runcatch(req) or 0
File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 470, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 480, in _callcatch
return scmutil.callcatch(ui, func)
File "/usr/pkg/lib/python3.8/site-packages/mercurial/scmutil.py", line 153, in callcatch
return func()
File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 460, in _runcatchfunc
return _dispatch(req)
File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 1273, in _dispatch
return runcommand(
File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 918, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 1285, in _runcommand
return cmdfunc()
File "/usr/pkg/lib/python3.8/site-packages/mercurial/dispatch.py", line 1271, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "/usr/pkg/lib/python3.8/site-packages/mercurial/util.py", line 1886, in check
return func(*args, **kwargs)
File "/usr/pkg/lib/python3.8/site-packages/hgext/patchbomb.py", line 817, in email
revs = _getoutgoing(repo, dest, revs)
File "/usr/pkg/lib/python3.8/site-packages/hgext/patchbomb.py", line 537, in _getoutgoing
safe_paths = [urlutil.hidepassword(p.rawloc) for p in paths]
File "/usr/pkg/lib/python3.8/site-packages/hgext/patchbomb.py", line 537, in <listcomp>
safe_paths = [urlutil.hidepassword(p.rawloc) for p in paths]
File "/usr/pkg/lib/python3.8/site-packages/mercurial/utils/urlutil.py", line 501, in get_push_paths
msg %= dest
TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'NoneType'
```
This is due to patchbomb passing `[None]` in the `dests` parameter of the
multi-paths outgoing function, we fix this in this change and add a
non-regression test.
Differential Revision: https://phab.mercurial-scm.org/D11456
Matt Harbison <matt_harbison@yahoo.com> [Mon, 20 Sep 2021 14:21:18 -0400] rev 48016
extensions: prevent a crash on py3 with a `minimumhgversion` str value
The expectation is that this field is bytes, but unported extensions are a thing
and it shouldn't explode on a bad value. We already do this transformation in
the version reporting mechanism.
Differential Revision: https://phab.mercurial-scm.org/D11476
Matt Harbison <matt_harbison@yahoo.com> [Mon, 20 Sep 2021 14:16:10 -0400] rev 48015
extensions: prevent a crash on py3 when testing a bad extension minimum
A `None` placeholder is populated for each missing component by
`util.versiontuple()`, which could safely be used with `>` on py2, but not py3.
I guess there's another hole here where if the string is entirely bogus (i.e no
numbers), it will be treated as 0.0, and always load. But that's always been
the case.
Differential Revision: https://phab.mercurial-scm.org/D11475
Matt Harbison <matt_harbison@yahoo.com> [Mon, 20 Sep 2021 11:22:27 -0400] rev 48014
typing: drop annotations on `mercurial/logcmdutil.walkopts` attributes
Pytype 2021-09-09 must have learned some things about `@attr`, because while
these were presumably required to help it before (
c1d0f83d62c4::
9a26fea2b518 and
c11099cc1de4::
224c786f4fce), these instances now get flagged as an assignment
mismatch:
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 717, in walkopts: Type annotation for pats does not match type of assignment [annotation-type-mismatch]
Annotation: List[bytes]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 718, in walkopts: Type annotation for opts does not match type of assignment [annotation-type-mismatch]
Annotation: Dict[bytes, Any]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 722, in walkopts: Type annotation for revspec does not match type of assignment [annotation-type-mismatch]
Annotation: List[bytes]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 725, in walkopts: Type annotation for bookmarks does not match type of assignment [annotation-type-mismatch]
Annotation: List[bytes]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 726, in walkopts: Type annotation for branches does not match type of assignment [annotation-type-mismatch]
Annotation: List[bytes]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 727, in walkopts: Type annotation for date does not match type of assignment [annotation-type-mismatch]
Annotation: Optional[bytes]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 728, in walkopts: Type annotation for keywords does not match type of assignment [annotation-type-mismatch]
Annotation: List[bytes]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 729, in walkopts: Type annotation for no_merges does not match type of assignment [annotation-type-mismatch]
Annotation: bool
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 730, in walkopts: Type annotation for only_merges does not match type of assignment [annotation-type-mismatch]
Annotation: bool
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 731, in walkopts: Type annotation for prune_ancestors does not match type of assignment [annotation-type-mismatch]
Annotation: List[bytes]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 732, in walkopts: Type annotation for users does not match type of assignment [annotation-type-mismatch]
Annotation: List[bytes]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 735, in walkopts: Type annotation for include_pats does not match type of assignment [annotation-type-mismatch]
Annotation: List[bytes]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 736, in walkopts: Type annotation for exclude_pats does not match type of assignment [annotation-type-mismatch]
Annotation: List[bytes]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 739, in walkopts: Type annotation for follow does not match type of assignment [annotation-type-mismatch]
Annotation: int
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 743, in walkopts: Type annotation for force_changelog_traversal does not match type of assignment [annotation-type-mismatch]
Annotation: bool
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 747, in walkopts: Type annotation for filter_revisions_by_pats does not match type of assignment [annotation-type-mismatch]
Annotation: bool
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 750, in walkopts: Type annotation for sort_revisions does not match type of assignment [annotation-type-mismatch]
Annotation: Optional[bytes]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 753, in walkopts: Type annotation for limit does not match type of assignment [annotation-type-mismatch]
Annotation: Optional[int]
Assignment: mercurial.thirdparty.attr._make._CountingAttr
Differential Revision: https://phab.mercurial-scm.org/D11474
Matt Harbison <matt_harbison@yahoo.com> [Mon, 20 Sep 2021 11:05:30 -0400] rev 48013
util: eliminate the possibility of returning None from `versiontuple()`
This fixes the following error flagged by pytype:
File "/mnt/c/Users/Matt/hg/mercurial/extensions.py", line 228, in load: unsupported operand types for > [unsupported-operands]
Primitive types 'Optional[tuple]' and 'curver: Optional[tuple]' are not comparable.
Differential Revision: https://phab.mercurial-scm.org/D11473
Matt Harbison <matt_harbison@yahoo.com> [Mon, 20 Sep 2021 11:03:46 -0400] rev 48012
archival: force a `CompressionError` to bytes before passing to `error.Abort`
I'm not sure what changed before pytype 09-09-2021 (from 04-15-2021), but this
started getting flagged.
This fixes:
File "/mnt/c/Users/Matt/hg/mercurial/archival.py", line 199, in taropen: Function bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
Expected: (self, ints: Iterable[int])
Actually passed: (self, ints: tarfile.CompressionError)
Attributes of protocol Iterable[int] are not implemented on tarfile.CompressionError: __iter__
Differential Revision: https://phab.mercurial-scm.org/D11472
Matt Harbison <matt_harbison@yahoo.com> [Mon, 20 Sep 2021 10:59:26 -0400] rev 48011
parser: force a `ValueError` to bytes before passing to `error.ParseError`
I'm not sure what changed before pytype 09-09-2021 (from 04-15-2021), but this
started getting flagged. I think there's a pytype bug here, because I don't
see how `.lower()` can be getting called on a `ValueError` after it is forced to
a byte string. That's suppressed for now to make progress.
This fixes:
File "/mnt/c/Users/Matt/hg/mercurial/parser.py", line 219, in unescapestr: Function bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
Expected: (self, ints: Iterable[int])
Actually passed: (self, ints: ValueError)
Attributes of protocol Iterable[int] are not implemented on ValueError: __iter__
File "/mnt/c/Users/Matt/hg/mercurial/parser.py", line 219, in unescapestr: No attribute 'lower' on ValueError [attribute-error]
In Union[ValueError, mercurial.pycompat.bytestr]
Differential Revision: https://phab.mercurial-scm.org/D11471
Matt Harbison <matt_harbison@yahoo.com> [Mon, 20 Sep 2021 10:46:35 -0400] rev 48010
util: avoid a name-error warning in the `mmapread` exception handler
Newly caught by pytype 2021-09-09.
File "/mnt/c/Users/Matt/hg/mercurial/util.py", line 458, in mmapread: Name 'fd' is not defined [name-error]
Differential Revision: https://phab.mercurial-scm.org/D11470
Matt Harbison <matt_harbison@yahoo.com> [Mon, 20 Sep 2021 10:45:18 -0400] rev 48009
typing: suppress an name-error warning in `mercurial/windows.py`
Newly caught by pytype 2021-09-09.
Differential Revision: https://phab.mercurial-scm.org/D11469
Matt Harbison <matt_harbison@yahoo.com> [Mon, 20 Sep 2021 10:44:25 -0400] rev 48008
typing: suppress an import-error warning in `mercurial/utils/resourceutil.py`
Newly caught by pytype 2021-09-09.
Differential Revision: https://phab.mercurial-scm.org/D11468
Matt Harbison <matt_harbison@yahoo.com> [Mon, 20 Sep 2021 10:42:38 -0400] rev 48007
encoding: force a few Errors to bytes before passing to `error.Abort`
I'm not sure what changed before pytype 09-09-2021 (from 04-15-2021), but these
started getting flagged. PyCharm also flagged these. This fixes the following:
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 243, in fromlocal: Function Abort.__init__ was called with the wrong arguments [wrong-arg-types]
Expected: (self, message: Union[bytearray, bytes, memoryview], ...)
Actually passed: (self, message: LookupError, ...)
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 309, in lower: Function Abort.__init__ was called with the wrong arguments [wrong-arg-types]
Expected: (self, message: Union[bytearray, bytes, memoryview], ...)
Actually passed: (self, message: LookupError, ...)
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 336, in upperfallback: Function Abort.__init__ was called with the wrong arguments [wrong-arg-types]
Expected: (self, message: Union[bytearray, bytes, memoryview], ...)
Actually passed: (self, message: LookupError, ...)
Called from (traceback):
line 391, in current file
line 348, in get
line 318, in upper
Differential Revision: https://phab.mercurial-scm.org/D11467
Matt Harbison <matt_harbison@yahoo.com> [Tue, 21 Sep 2021 00:16:35 -0400] rev 48006
typing: add a fake `__init__()` to bytestr to distract pytype
I'm not sure what changed before pytype 09-09-2021 (from 04-15-2021), but these
started getting flagged. This wrapping an exception in a `bytestr` pattern has
been flagged before, and I've fixed it then with `stringutil.forcebytestr()`.
But that doesn't work here, because it would create a circular import.
I suspect the issue is `bytes.__new__()` wants `Iterable[int]`, so it just
assumes the subclass will also take that. The referenced pytype bug isn't an
exact match, but seems related and the suggested workaround helps.
The specific warnings fixed are:
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 212, in tolocal: Function bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
Expected: (self, ints: Iterable[int])
Actually passed: (self, ints: LookupError)
Attributes of protocol Iterable[int] are not implemented on LookupError: __iter__
Called from (traceback):
line 353, in current file
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 240, in fromlocal: Function bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
Expected: (self, ints: Iterable[int])
Actually passed: (self, ints: UnicodeDecodeError)
Attributes of protocol Iterable[int] are not implemented on UnicodeDecodeError: __iter__
Differential Revision: https://phab.mercurial-scm.org/D11466
Augie Fackler <augie@google.com> [Mon, 20 Sep 2021 15:51:23 -0400] rev 48005
merge: with stable
Raphaël Gomès <rgomes@octobus.net> [Thu, 09 Sep 2021 10:42:28 +0200] rev 48004
pep-517: remove the `build-backend` key to allow for users to build extensions
PEP 517 changed how projects should define their build dependencies.
The presence of a `pyproject.toml` file changes the behavior of `pip` to
conform to PEP 517.
Since we haven't updated the `setup.py` file yet (I'm not even sure we're not
an edge case which would make it harder/impossible, I have not tried yet), this
is a workaround to
issue6589: it allows users to pass `--no-use-pep517` to pip
to revert to the legacy installer. The build backend is simply assumed to be
the `build_meta:__legacy__` one.
Differential Revision: https://phab.mercurial-scm.org/D11393
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Sep 2021 18:41:38 +0200] rev 48003
dirstate: drop the `dirstatemap.dropfile` method
All use have been migrated.
Differential Revision: https://phab.mercurial-scm.org/D11443
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Sep 2021 15:21:22 +0200] rev 48002
dirstate: use `reset_state` instead of `dropfile` in test-rebuildstate.t
As `dirstatemap.dropfile` is on its way out.
Differential Revision: https://phab.mercurial-scm.org/D11442
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 16 Sep 2021 15:20:28 +0200] rev 48001
dirstate: use `reset_state` instead of `dropfile` in largefile
As `dirstatemap.dropfile` is on its way out.
Differential Revision: https://phab.mercurial-scm.org/D11441
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Sep 2021 18:40:25 +0200] rev 48000
dirstate: use `reset_state` in `rebuild` instead of `dropfile`
As `dirstatemap.dropfile` is on its way out.
Differential Revision: https://phab.mercurial-scm.org/D11440
Pierre-Yves David <pierre-yves.david@octobus.net> [Wed, 15 Sep 2021 18:38:24 +0200] rev 47999
dirstate: use `reset_state` to drop file in `update_file_p1`
The `dropfile` function is on its way out.
Differential Revision: https://phab.mercurial-scm.org/D11439