Skip to content
Snippets Groups Projects
  1. Feb 21, 2025
  2. Feb 18, 2025
  3. Feb 07, 2025
    • Mitchell Kember's avatar
      rhg-annotate: support whitespace options · 874c64e041b5
      Mitchell Kember authored
      This adds support to rhg annotate for all the whitespace options:
      
          -w, --ignore-all-space
          -b, --ignore-space-change
          -B, --ignore-blank-lines
          -Z, --ignore-space-at-eol
      
      Note that --ignore-blank-lines has no effect on annotate so it is ignored. You
      can see this in dagop.py _annotepair which only checks if blocks are '=' or not,
      whereas the effect of --ignore-blank-lines is to change some '!' into '~'.
      
      When the other 3 are combined, we use the strongest option since -w implies -b
      and -b implies -Z. This is not explicit in the Python implementation, but I have
      verified that's how it behaves.
      874c64e041b5
  4. Feb 18, 2025
  5. Feb 13, 2025
    • Raphaël Gomès's avatar
      index: remember the generaldelta config instead of getting it from the revlog · 8de68446a5bd
      Raphaël Gomès authored
      The code (especially the Rust code) was jumping in 4 dimensions to make sense
      of what was going on because it wrongly assumed that we needed to somehow
      be able to ask a generaldelta index for a non-generaldelta delta chain, which
      doesn't make any sense.
      
      Removing the cargo-culted/vestigial code, this is cleaner and less confusing.
      8de68446a5bd
  6. Feb 06, 2025
    • Georges Racinet's avatar
      rust-pyo3-dirstate: status · 38e16da74aea
      Georges Racinet authored
      This finally makes use of the latest `path` utilities.
      As a side note, `paths_py_list` cannot use `PyHgPathRef` itself
      because by calling `as_ref()` it would make the compiler believe
      it returns code owner by the inner `map` closure.
      Also, `status_path_py_list(py, &status_res.modified)?` can
      probably be replaced by
      
      ```
      PyList::new(status_res.modified.iter().map(|p| PyHgPathRef(p)))?
      ```
      
      with (granted) little benefit, but it could spare us a new utility
      each time there is a new collection type to return.
      38e16da74aea
  7. Feb 05, 2025
  8. Feb 04, 2025
    • Georges Racinet's avatar
      aa2cfeed65c9
    • Georges Racinet's avatar
      rust-pyo3-dirstate: CopyMap iterators · c917656a259d
      Georges Racinet authored
      This requires yet another `Sync` marker in `hg-core`.
      
      Of course we are leveraging the new `py_shared_iterator!` for this.
      c917656a259d
    • Georges Racinet's avatar
      rust-pyo3-dirstate: CopyMap without proxy methods · 6b38ff460f2a
      Georges Racinet authored
      It turns out that it is fairly easy to call the core `DirstateMap`
      methods from a `CopyMap` PyO3 object, hence we do not need to introduce
      proxy methods on the FFI `DirstateMap` as was done in `rust-cpython`.
      It is more straightforward, and is somewhat easier to make with PyO3
      because we have all these intermediates between the Rust and Python layers
      (`Bound`, `Py<T>`).
      
      From the Python side, a difference with the `hg-cpython` version is that
      `CopyMap` would be instantiable also directly as `CopyMap(dirstate_map)`.
      Reproducing the `from_inner`, with refcount increase the responsibility in the
      `DirstateMap.copymap()` method would have been less natural (as there is
      no need with the separate `from_inner` in PyO3 constructors) and somehow
      we felt it was sounder to force the ref cloning from `CopyMap`.
      6b38ff460f2a
  9. Jan 30, 2025
  10. Feb 05, 2025
  11. Feb 06, 2025
  12. Jan 29, 2025
  13. Feb 04, 2025
    • Georges Racinet's avatar
      rust-pyo3-sharedref: macro to define Python iterators · 8f6d25439bdc
      Georges Racinet authored
      This convenience will help reducing the boilerplate for one of
      the most common use cases of the `pyo3_sharedref` crate.
      
      It is an improved adaptation of a similar macro that was in `hg-cpython`
      (but not in `rust-cpython`). The improvement is that it takes care of
      the constructor, sparing the `share_map` to the caller.
      8f6d25439bdc
  14. Jan 29, 2025
  15. Feb 06, 2025
    • Georges Racinet's avatar
      rust-pyo3: new module for conversions of HgPath and friends · c60f69556924
      Georges Racinet authored
      Same as `PyRevision`, the `PyHgPathRef` new-type wrapper is not
      a Python type, but it implements `IntoPyObject`, which will spare
      us tedious uses of `PyBytes::new`.
      
      The `paths_py_list` function is the the analog of `revs_py_list`
      for paths. There was one similar utility in `hg-cpython`, within
      the `dirstate::status` module. We feel it should be in a more global
      location, and have a name consistent with utilities for revisions.
      
      The `paths_pyiter_collect` function is similarly the analog of
      `revs_pyiter_collect`.
      c60f69556924
  16. Jan 29, 2025
    • Georges Racinet's avatar
      rust-pyo3-dirsate: DirstateMap definition and constructors · e7b825893e1b
      Georges Racinet authored
      With rust-cpython, using `Option<T>` in the Rust signature would
      translate automatically into a Python keyword argument, leading
      to unpleasantness on the Rust side in some cases (not here, though).
      with PyO3, though the signature can be specified explicitly (positional
      in this case) and there is even a warning that the implicit keywords
      style is deprecated.
      e7b825893e1b
  17. Feb 06, 2025
    • Georges Racinet's avatar
      rust-pyo3: implementing IntoPyObject for Node · e2d2961b8383
      Georges Racinet authored
      It will be simpler to go through the `PyNode` new-type, than to call
      `PyBytes::new(py, node.as_bytes())`. This also opens up many implicit usages,
      e.g, by `PyList::new` and the various "protocol" methods
      `PyAnyMethods::set_item`.
      
      Also we made the inner `Node` public because we feel `PyNode(n)` to
      be nicer than `n.into::<PyNode>()` as typically a bare `n.into()` will
      not be enough for `into_pyobject()` to know what to do.
      e2d2961b8383
  18. Jan 29, 2025
    • Georges Racinet's avatar
      rust-pyo3-dirstate: DirstateItem class · 138e4ce24680
      Georges Racinet authored
      The rust-cpython version was using `Cell`, which is not `Sync`, hence
      we replace it with the pervasive `RwLock`. This brings in turn some
      minor simplification, as we can access a mutable reference to the inner
      data directly, and do not need the `update()` method (a shortcut to
      perform the `get`/`set` dance of the `Cell`).
      
      Tighter signature control in PyO3 means that `set_fallback_exec` can
      probably be simplified, which we might do once everything is validated
      by the tests.
      138e4ce24680
    • Georges Racinet's avatar
      rust-pyo3-dirstate: DirstateIdentity class · 4e5efcaa7e60
      Georges Racinet authored
      4e5efcaa7e60
    • Georges Racinet's avatar
      c6707e112d96
    • Georges Racinet's avatar
      rust-pyo3: making PyBytesDeref Sync · 6b3b69b32a41
      Georges Racinet authored
      This parallels what we have done earlier with the version in rust-cpython.
      It was not needed until now because the previous use of this struct
      was in `InnerRevlog` for the single revision cache, and which is shielded in
      `hg-core` behind a `Mutex`.
      
      But `DirstateMap` is needing its `owner` to be `Sync` more directly.
      In turn it means that maybe we could remove the `Mutex` of `hg-core`.
      6b3b69b32a41
    • Georges Racinet's avatar
      rust-pyo3-dirstate: making bytes slices in core Sync · d9d6ae9b9722
      Georges Racinet authored
      For the purposes of providing PyO3 bindings, the data fields that will be
      exposed to Python  have to be `Sync`, hence that is the case of
      `OwningDirstateMap` and its `owner` field.
      
      We had to do something similar for the PyO3 bindings of `revlog`.
      
      In this case, it forces us to adapt the `Deref` wrapper of `PyBytes` used
      in `hg-cpython`, because it must itself now be `Sync` and raw pointers are
      not.
      
      This looks even uglier than it used to, but it does not matter much, because
      our ultimate goal is to remove the rust-cpython bindings altogether.
      d9d6ae9b9722
  19. Jan 24, 2025
  20. Jan 07, 2025
  21. Jan 06, 2025
  22. Jan 05, 2025
  23. Jan 07, 2025
Loading