Skip to content
Snippets Groups Projects
  1. Dec 07, 2021
  2. Dec 08, 2021
  3. Dec 07, 2021
  4. Nov 07, 2021
  5. Dec 07, 2021
  6. Dec 10, 2021
    • Simon Sapin's avatar
      tests: add a short `sleep` in test-status.t · 04d756b7
      Simon Sapin authored
      With dirstate-v2 and rhg both enabled, this test would sometimes fail for me
      with:
      
      ```
      --- tests/test-status.t
      +++ tests/test-status.t#dirstate-v2.err
      @@ -943,7 +943,7 @@
         $ rm subdir/unknown
         $ hg status
         $ hg debugdirstate --all --no-dates | grep '^ '
      -      0         -1 set                 subdir
      +      0         -1 unset               subdir
      ```
      
      Meaning that `status` did not write a directory mtime in the dirstate
      as expected. This can happen if the observed mtime of the directory is
      the same as "current time" at the start of `status`. This current time
      is obtained by creating a temporary file and checking its mtime.
      
      Even with ext4 on my system being able to store nanosecond precision,
      identical mtime for successive but separate operations is still possible
      becuse the kernel may cache the current time:
      https://stackoverflow.com/a/14393315/1162888
      
      0.1 second should be enough for this cache to be updated, without
      significantly slowing down the test.
      
      Differential Revision: https://phab.mercurial-scm.org/D11900
      04d756b7
    • Simon Sapin's avatar
      rhg: Add support for `rhg status --copies` · 473af5cb
      Simon Sapin authored
      Copy sources are collected during `status()` rather than after the fact like
      in Python, because `status()` takes a `&mut` exclusive reference to the dirstate map
      (in order to potentially mutate it for directory mtimes) and returns `Cow<'_, HgPath>`
      that borrow the dirstate map.
      
      Even though with `Cow` only some shared borrows remain, the still extend the same
      lifetime of the initial `&mut` so the dirstate map cannot be borrowed again
      to access copy sources after the fact:
      
      https://doc.rust-lang.org/nomicon/lifetime-mismatch.html#limits-of-lifetimes
      
      Additionally, collecting copy sources during the dirstate tree traversal that
      `status()` already does avoids the cost of another traversal or other lookups
      (though I haven’t benchmarked that cost).
      
      Differential Revision: https://phab.mercurial-scm.org/D11899
      473af5cb
  7. Dec 06, 2021
  8. Dec 07, 2021
  9. Dec 06, 2021
  10. Dec 07, 2021
  11. Dec 06, 2021
  12. Dec 04, 2021
  13. Dec 03, 2021
  14. Dec 04, 2021
  15. Nov 26, 2021
  16. Nov 25, 2021
  17. Dec 04, 2021
  18. Nov 16, 2021
    • Arseniy Alekseyev's avatar
      rhg: add support for narrow clones and sparse checkouts · 005ae1a3
      Arseniy Alekseyev authored
      This adds a minimal support that can be implemented without parsing the narrowspec.
      We can parse the narrowspec and add support for more operations later.
      
      The reason we need so few code changes is as follows:
      
      Most operations need no special treatment of sparse because
      some of them only read dirstate (`rhg files` without `-r`),
      which bakes in the filtering,
      some of them only read store (`rhg files -r`, `rhg cat`),
      and some of them read no data at all (`rhg root`, `rhg debugrequirements`).
      
      `status` is the command that might care about sparse, so we just disable
      rhg on it.
      
      For narrow clones, `rhg files` clearly needs the narrowspec to work
      correctly, so we fall back.
      `rhg cat` seems to work consistently with `hg cat` if the file exists.
      If the file is hidden by narrow spec, the error message is different and confusing, so
      that's something that we should improve in follow-up patches.
      
      Differential Revision: https://phab.mercurial-scm.org/D11764
      005ae1a3
  19. Dec 03, 2021
  20. Nov 24, 2021
  21. Nov 23, 2021
  22. Nov 19, 2021
    • Pierre-Yves David's avatar
      dirstate: remove need_delay logic · 434de129
      Pierre-Yves David authored
      Now that all¹ stored mtime are non ambiguous, we no longer need to apply the `need_delay` step.
      The need delay logic was not great are mtime gathered during longer operation
      could be ambiguous but younger than the `dirstate.write` call time.
      
      So, we don't need that logic anymore and can drop it
      
      This make the code much simpler. The code related to the test extension faking
      the dirstate write is now obsolete and associated test will be migrated as
      follow up. They currently do not break.
      
      [1] except the ones from `hg update`, but `need_delay` no longer help for them
      either.
      
      Differential Revision: https://phab.mercurial-scm.org/D11796
      434de129
  23. Nov 18, 2021
    • Pierre-Yves David's avatar
      status: use filesystem time boundary to invalidate racy mtime · 322525db
      Pierre-Yves David authored
      We record the filesystem time at the start of the status walk and use that as a
      boundary to detect files that might be modified during (or right after) the
      status run without the mtime allowing that edition to be detected.  We
      currently do this at a second precision. In a later patch, we will use
      nanosecond precision when available.
      
      To cope with "broken" time on the file system where file could be in the
      future, we also keep mtime for file over one day in the future. See inline
      comment for details.
      
      Large file tests get a bit more confused as we reduce the odds for race
      condition.
      
      As a "side effect", the win32text extension is happy again.
      
      Differential Revision: https://phab.mercurial-scm.org/D11794
      322525db
    • Pierre-Yves David's avatar
      test: use a different timestamp for the updated file · 03644a92
      Pierre-Yves David authored
      In the test we want to trigger a write after the underlying dirstate changed. To
      do so, we need a write. And as we are about to make dirstate update smarter we
      need to meddle with the script a bit to make sure there will be a write.
      
      Differential Revision: https://phab.mercurial-scm.org/D11793
      03644a92
  24. Nov 23, 2021
  25. Nov 17, 2021
  26. Nov 22, 2021
    • Pierre-Yves David's avatar
      dirstate: do no use `set_clean` in revert · 9f1b9e12
      Pierre-Yves David authored
      The current `set_clean` usage is racy (the file might be modified between its
      restoration and the `set_clean` call).
      
      So we simply leave the file as ambiguous and the next status will fix that.
      
      We still have to make sure the copy information is dropped, so we teach dirstate
      how to do that.
      
      The win32txt extension is confused after this because current logic is broken in
      more location. However this series will ultimately fix that so we "ignore" it
      for now. Fixing it now is complicated without some extra fix landing later.
      
      Differential Revision: https://phab.mercurial-scm.org/D11788
      9f1b9e12
  27. Nov 17, 2021
  28. Oct 25, 2021
  29. Nov 23, 2021
Loading