Skip to content
Snippets Groups Projects
  1. Nov 04, 2022
    • Matt Harbison's avatar
      util: implement `writelines()` on atomictempfile · c4f07a011714
      Matt Harbison authored
      With typehints on the vfs objects, pytype will flag this:
      
          FAILED: /mnt/c/Users/Matt/hg/.pytype/pyi/mercurial/patch.pyi
          /usr/bin/python3.8 -m pytype.single
              --imports_info /mnt/c/Users/Matt/hg/.pytype/imports/mercurial.patch.imports
              --module-name mercurial.patch -V 3.7
              -o /mnt/c/Users/Matt/hg/.pytype/pyi/mercurial/patch.pyi
              --analyze-annotated --nofail --quick
              /mnt/c/Users/Matt/hg/mercurial/patch.py
          File "/mnt/c/Users/Matt/hg/mercurial/patch.py", line 535, in writerej:
              No attribute 'writelines' on mercurial.util.atomictempfile [attribute-error]
            In Union[
                mercurial.util.atomictempfile,
                mercurial.vfs.checkambigatclosing,
                mercurial.vfs.delayclosedfile,
                mercurial.windows.fdproxy,
                mercurial.windows.mixedfilemodewrapper
            ]
      
      It's not a real problem there (atomictempfile is only created by passing
      different args), but it's reasonable for this to implement the function and
      behave like a normal file.  There are other functions missing that can be added
      if/when needed.
      c4f07a011714
  2. Nov 02, 2022
    • Matt Harbison's avatar
      typing: add basic type hints to localrepo.py · 8fa3f7c3a9ad
      Matt Harbison authored
      There's a lot more that could be done, but this sticks to the obviously correct
      stuff that is either related to existing imports or primitives.  Hopefully this
      helps smoke out more path related bytes vs str issues in TortoiseHg.
      
      I'm avoiding the interfaces for now, because they seem to confuse pytype and/or
      PyCharm.  It might be worth typing the return of `makelocalrepository` to
      `localrepository`, but that leaks an implementation detail, so that can be
      revisited later.
      8fa3f7c3a9ad
  3. Nov 05, 2022
    • Matt Harbison's avatar
      check-code: drop the check for whitespace around named parameters · 3a2b6158374a
      Matt Harbison authored
      This check flags py3 annotations of named parameters, because `black` adds
      spaces around the assignment in this case.  Since the chosen formatter has
      opinions (and pylint also wants the space in the case of annotations), drop the
      check so we can use py3 annotations.
      3a2b6158374a
  4. Oct 19, 2022
    • Raphaël Gomès's avatar
      rust-status: query fs traversal metadata lazily · da48f170d203
      Raphaël Gomès authored
      Currently, any time the status algorithm needs to read a directory from the
      filesystem (because the stat-only optimization is not available), it also
      stats each directory entry eagerly.
      
      Stat'ing the entries is only needed in a few cases (like when checking
      the mtime of a directory for caching): this patch creates a wrapper struct
      `DirEntry` that only stats the directory entry it represents when needed.
      
      Excerpt of an `strace` before this change on Mozilla Central:
      
      ```
      openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
      newfstatat(3, "", {st_mode=S_IFDIR|0755, st_size=3540, ...}, AT_EMPTY_PATH) = 0
      getdents64(3, 0x55dc970bd440 /* 139 entries */, 32768) = 5072
      statx(3, ".hg", AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=772, ...}) = 0
      
      [... 135 other successful `statx` calls]
      
      getdents64(3, 0x55dc970bd440 /* 0 entries */, 32768) = 0
      close(3)                                = 0
      ```
      
      After this change:
      
      ```
      openat(AT_FDCWD, ".", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
      newfstatat(3, "", {st_mode=S_IFDIR|0755, st_size=3540, ...}, AT_EMPTY_PATH) = 0
      getdents64(3, 0x561567c10190 /* 139 entries */, 32768) = 5072
      getdents64(3, 0x561567c10190 /* 0 entries */, 32768) = 0
      close(3)                                = 0
      ```
      da48f170d203
    • Raphaël Gomès's avatar
      6b32d39e9a67
  5. Sep 22, 2022
  6. Oct 31, 2022
  7. Oct 19, 2022
    • Matt Harbison's avatar
      mr-template: wrap the instructions inside a comment block · 7b6d3a9bd7be
      Matt Harbison authored
      At least in preview mode, this hides the text so the user doesn't have to delete
      it.  It's still visible in edit mode, so the user sees it.
      7b6d3a9bd7be
    • Matt Harbison's avatar
      revlog: use the user facing filename as the display_id for filelogs · 92892dff03f3
      Matt Harbison authored
      I had trouble isolating some LFS blob corruption detected by `hg verify` because
      the traceback referenced a file, but with the `data/` prefix in the `.hg/store`
      path, so it couldn't be located with the `file()` revset:
      
      ```
          Traceback (most recent call last):
            File "/mnt/d/mercurial/mercurial/revlog.py", line 3209, in verifyintegrity
              _verify_revision(self, skipflags, state, node)
            File "/mnt/d/mercurial/hgext/lfs/wrapper.py", line 246, in _verify_revision
              orig(rl, skipflags, state, node)
            File "/mnt/d/mercurial/mercurial/revlog.py", line 158, in _verify_revision
              rl.revision(node)
            File "/mnt/d/mercurial/mercurial/revlog.py", line 1816, in revision
              return self._revisiondata(nodeorrev, _df)
            File "/mnt/d/mercurial/mercurial/revlog.py", line 1870, in _revisiondata
              self.checkhash(text, node, rev=rev)
            File "/mnt/d/mercurial/mercurial/revlog.py", line 1996, in checkhash
              % (self.display_id, pycompat.bytestr(revornode))
          mercurial.error.RevlogError: integrity check failed on data/EXE/PPC/shrinksrec.exe:0
      ```
      
      (I'm a little surprised it resulted in a stacktrace instead of just a message,
      but that's a different issue.  I'm also not sure how to trigger the simplestore
      case, since IIUC, it's also a revlog based store.)
      
      It's not clear how to handle the changelog and manifest (because the user
      doesn't interact with them as a file), so those cases are left alone.  The other
      thing that would be nice to improve somehow is to indicate that the ":0" is a
      revlog revision, not the changeset revision that users are used to.  I'm not
      sure how to handle the "or node" part though.
      92892dff03f3
    • Matt Harbison's avatar
      revlog: drop an unused variable assignment · 8d6c8a9a91f8
      Matt Harbison authored
      It's assigned again 2 lines later.
      8d6c8a9a91f8
  8. Oct 20, 2022
    • Matt Harbison's avatar
      lfs: improve an exception message for blob corruption detected on transfer · 250d9c8aaf10
      Matt Harbison authored
      The message about the server crash originated in 0ee0a3f6a990 (after support for
      serving blobs was added), but was copied from the Facebook repo that forked
      prior to server side support.  Therefore, this message only displayed in their
      client, so it was safe to assume the server crashed.  But that was never the
      case for vanilla Mercurial, as I saw this in a server log.
      
      Also, display the blob reference so that it's easier to figure out where the
      problem was when a bunch of blobs are transferred at once.
      250d9c8aaf10
  9. Oct 24, 2022
  10. Oct 20, 2022
  11. Oct 19, 2022
  12. Oct 18, 2022
  13. Oct 10, 2022
    • Arseniy Alekseyev's avatar
      dirstate-v2: skip evaluation of hgignore regex on cached directories · eb02decdf0ab
      Arseniy Alekseyev authored
      By making the computation of [has_ignored_ancestor] lazy we're eliding
      its computation in the common case when none of its descendants have
      changed on disk.
      
      On a ~400k files repo, with a cached status, we saw a ~64% reduction
      in CPU time, resulting in a speedup of ~10-15% (on ZFS), and a speedup
      of ~38% of XFS (XFS has faster stat operations for some reason).
      eb02decdf0ab
  14. Sep 30, 2022
    • Craig Ozancin's avatar
      releasenotes: use re.MULTILINE mode when checking admonitions · 943509a58d29
      Craig Ozancin authored
      Release note admonitions must start at the beginning of a line within
      the changeset description:
      
      .. admonitions::
      
      The checkadmonitions function search for and validates admonitions.
      
      Unfortunately, since the ctx.description is multi-line, the regex search
      always fails unless the admonition is on the first line.
      
      This changeset adds re.MULTILINE to the re.compile to make the re opbject
      multi-line.
      943509a58d29
  15. Oct 10, 2022
  16. Oct 05, 2022
    • Arseniy Alekseyev's avatar
      rhg: parallellize computation of [unsure_is_modified] · 52464a20add0
      Arseniy Alekseyev authored
      [unsure_is_modified] is called for every file for which we can't
      determine its status based on its size and mtime alone.
      
      In particular, this happens if the mtime of the file changes
      without its contents changing.
      
      Parallellizing this improves performance significantly when
      we have many of these files.
      
      Here's an example run (on a repo with ~400k files after dropping FS caches)
      
      ```
      before:
      real	0m53.901s
      user	0m27.806s
      sys	0m31.325s
      
      after:
      real	0m32.017s
      user	0m34.277s
      sys	1m26.250s
      ```
      
      Another example run (a different FS):
      
      ```
      before:
      real	3m28.479s
      user	0m31.800s
      sys	0m25.324s
      
      after:
      real	0m29.751s
      user	0m41.814s
      sys	1m15.387s
      ```
      52464a20add0
  17. Sep 21, 2022
  18. Sep 22, 2022
  19. Sep 20, 2022
  20. Sep 22, 2022
  21. Sep 20, 2022
  22. Oct 04, 2022
    • Matt Harbison's avatar
      revset: handle wdir() in `sort(..., -topo)` · 117dcc4a0e67
      Matt Harbison authored
      The last apparent usage of `repo.changelog.parentrevs` in revsets is in
      `children()`, but since the sets being operated on never include wdir(), it's
      never called with `wdirrev` and the wdir() arg on the command line is
      effectively ignored instead of aborting there.  I'm not sure how to fix that.
      
      Before (on a clone of hg):
      
          $ python3.8 hg perf::revset --config extensions.perf=contrib/perf.py 'sort(all(), -topo)'
          ! wall 0.123663 comb 0.130000 user 0.130000 sys 0.000000 (best of 76)
      
      After:
      
          $ python3.8 hg perf::revset --config extensions.perf=contrib/perf.py 'sort(all(), -topo)'
          ! wall 0.123838 comb 0.130000 user 0.130000 sys 0.000000 (best of 75)
      117dcc4a0e67
  23. Oct 03, 2022
    • Matt Harbison's avatar
      revset: handle wdir() in `roots()` · e02dcc625171
      Matt Harbison authored
      This is already handled in `heads()`, and both are needed to determine if a set
      is contiguous.
      
      I'm guessing the `0 <= p` check was to try to filter out the null revision, but
      it looks like that comes through in the corner case of a new repo with no
      commits.  But that was already the case, as shown by the tests.
      
      Before (on a clone of hg):
      
          $ python3.8 hg perf::revset --config extensions.perf=contrib/perf.py 'roots(all())'
          ! wall 0.059301 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
      
      After:
      
          $ python3.8 hg perf::revset --config extensions.perf=contrib/perf.py 'roots(all())'
          ! wall 0.059387 comb 0.060000 user 0.060000 sys 0.000000 (best of 100)
      e02dcc625171
  24. Sep 20, 2022
  25. Jul 25, 2022
    • Euxane TRAN-GIRARD's avatar
      contrib: add pull_logger extension · 791050360486
      Euxane TRAN-GIRARD authored
      This extension logs the pull parameters, i.e. the remote and common heads,
      when pulling from the local repository.
      
      The collected data should give an idea of the state of a pair of repositories
      and allow replaying past synchronisations between them. This is particularly
      useful for working on data exchange, bundling and caching-related
      optimisations.
      791050360486
  26. Oct 04, 2022
  27. Oct 03, 2022
  28. Sep 28, 2022
    • Matt Harbison's avatar
      tests: migrate the pytype test to a shell script for easier CI processing · 08c3ecd899ae
      Matt Harbison authored
      There have been recent hangs and timeout, but it's hard to debug because the *.t
      test redirects output to a file and only prints it if `pytype` actually exits.
      This shell script can be run directly by CI, and will allow more flexibility to
      try to cache and restore type stubs for further speed increases.
      08c3ecd899ae
Loading