histedit: use more specific exceptions for more detailed exit codes
Differential Revision: https://phab.mercurial-scm.org/D11509
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
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
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
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
rust: Remove some obsolete doc-comments
About parameters that have been removed or replaced
Differential Revision: https://phab.mercurial-scm.org/D11492
dirstate: Remove return boolean from dirstatemap.dropfile
None of the remaining callers use it.
Differential Revision: https://phab.mercurial-scm.org/D11491
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
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
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