Skip to content
Snippets Groups Projects
  1. Mar 09, 2022
  2. Mar 10, 2022
  3. Mar 09, 2022
  4. Mar 04, 2022
    • Yuya Nishihara's avatar
      chgserver: remove Python 2 file descriptor logic · cf99c4af1079
      Yuya Nishihara authored
      Follows up 0bb28b7736bc "chgserver: remove Python 2 support code."
      
      On Python 2, we had to close newfp prior to restoring the original file
      description since "delete newfp" would otherwise close the file descriptor
      shared with the long-lived fp:
      
        in attachio():
          newfp = os.fdopen(fp.fileno(), mode, bufsize)
        in _restoreio():
          newfp.close()  # temporarily close newfp.fileno() (= fp.fileno())
          os.dup2(fd, fp.fileno())  # reopen fp.fileno() with original fd
      
      On the other hand, we shouldn't call newfp.close() on Python 3 since
      any function calls are proxied to the underlying file object by
      procutil.LineBufferedWrapper.
      cf99c4af1079
  5. Feb 08, 2022
    • Simon Sapin's avatar
      dirstate-tree: optimize HashMap lookups with raw_entry_mut · 11c0411bf4e2
      Simon Sapin authored
      This switches to using `HashMap` from the hashbrown crate,
      in order to use its `raw_entry_mut` method.
      The standard library’s `HashMap` is also based on this same crate,
      but `raw_entry_mut` is not yet stable there:
      https://github.com/rust-lang/rust/issues/56167
      
      Using version 0.9 because 0.10 is yanked and 0.11 requires Rust 1.49
      
      This replaces in `DirstateMap::get_or_insert_node` a call to
      `HashMap<K, V>::entry` with `K = WithBasename<Cow<'on_disk, HgPath>>`.
      
      `entry` takes and consumes an "owned" `key: K` parameter, in case a new entry
      ends up inserted. This key is converted by `to_cow` from a value that borrows
      the `'path` lifetime.
      
      When this function is called by `Dirstate::new_v1`, `'path` is in fact
      the same as `'on_disk` so `to_cow` can return an owned key that contains
      `Cow::Borrowed`.
      
      For other callers, `to_cow` needs to create a `Cow::Owned` and thus make
      a costly heap memory allocation. This is wasteful if this key was already
      present in the map. Even when inserting a new node this is typically the case
      for its ancestor nodes (assuming most directories have numerous descendants).
      
      Differential Revision: https://phab.mercurial-scm.org/D12317
      11c0411bf4e2
  6. Mar 04, 2022
  7. Feb 21, 2022
  8. Mar 02, 2022
  9. Feb 21, 2022
  10. Mar 03, 2022
  11. Feb 21, 2022
  12. Mar 02, 2022
  13. Feb 21, 2022
  14. Mar 08, 2022
  15. Mar 02, 2022
  16. Feb 21, 2022
  17. Mar 02, 2022
  18. Feb 21, 2022
Loading