Skip to content
Snippets Groups Projects
  1. Nov 02, 2022
  2. Aug 30, 2022
  3. Aug 29, 2022
  4. Nov 14, 2022
  5. Nov 10, 2022
  6. Nov 12, 2022
    • Pierre-Yves David's avatar
      tags-fnode-cache: skip building a changectx in getfnode · 08fe5c4d4471
      Pierre-Yves David authored
      Building a changectx object is costly, doing it just to retrieve the revision
      number is suboptimal. Directly fetching the revision number from the changelog
      provide a sizeable speedup to `hg debugupdatecache`.
      
      ### data-env-vars.name           = mercurial-2018-08-01-zstd-sparse-revlog
        # benchmark.name               = debug-update-cache
        # benchmark.variants.pre-state = warm
      before: 0.213229 seconds
      after:  0.165577 seconds  (-22.35%)
        # data-env-vars.name           = mercurial-filtered-2019-11-22-zstd-sparse-revlog
      before: 1.200383 seconds
      after:  1.071618 seconds  (-10.73%)
        # data-env-vars.name           = mozilla-central-2018-08-01-zstd-sparse-revlog
      before: 1.465735 seconds
      after:  0.923128 seconds  (-37.02%)
        # data-env-vars.name           = mozilla-try-2019-02-18-zstd-sparse-revlog
      before: 6.511771 seconds
      after:  4.507316 seconds  (-30.78%)
        # data-env-vars.name           = netbeans-2018-08-01-zstd-sparse-revlog
      before: 1.023007 seconds
      after:  0.645026 seconds  (-36.95%)
        # data-env-vars.name           = pypy-2018-08-01-zstd-sparse-revlog
      before: 0.381141 seconds
      after:  0.268654 seconds  (-29.51%)
      08fe5c4d4471
    • Pierre-Yves David's avatar
      tags-fnode-cache: do not repeatedly open the filelog in a loop · 15a89b722937
      Pierre-Yves David authored
      While getting multiple hgtagsfnodecache entries, we were opening (and closing)
      the `.hgtags` filelog for each iteration. The meant repeatedly reading and
      parsing the version same information from disk. A quite costly operation.
      
      We no longer do this, leading to a sizable improvement in `hg debugupdatecache`
      run for an already warm repositories.
      
      ### data-env-vars.name           = mercurial-2018-08-01-zstd-sparse-revlog
        # benchmark.name               = debug-update-cache
        # benchmark.variants.pre-state = warm
      before:  1.711778 seconds
      after:   0.213229 seconds  (-87.54%)
        # data-env-vars.name           = pypy-2018-08-01-zstd-sparse-revlog
      before:  4.010817 seconds
      after:   0.381141 seconds  (-90.50%)
        # data-env-vars.name           = netbeans-2018-08-01-zstd-sparse-revlog
      before: 13.574141
      after:   1.023007 seconds  (-92.46%)
        # data-env-vars.name           = mozilla-central-2018-08-01-zstd-sparse-revlog
      before: 18.884656
      after:   1.465735 seconds  (-92.24%)
        # data-env-vars.name           = mozilla-try-2019-02-18-zstd-sparse-revlog
      before: 88.924823
      after:   6.511771 seconds  (-92.68%)
      15a89b722937
    • Pierre-Yves David's avatar
      profile: prevent a crash when line number is unknown · aab3d4c05720
      Pierre-Yves David authored
      For some unknown reason, `self.lineno` can be None. The previous code crashed in
      such case, we now ignore the case, as we do for other error in this function.
      
      We also fallback to using `-1` in the output when this lack of line number
      makes it to the display code.
      
      The reason of unknown line-numbers is… unknown.
      aab3d4c05720
  7. Nov 07, 2022
    • Mathias De Mare's avatar
      configitems: enable pullbundles by default · 53e4f44ba0e8
      Mathias De Mare authored
      The use of pullbundles is already protected: they are only used
      when a pullbundles.manifest file is created on the server.
      
      Having an additional flag doesn't really make sense
      and can confuse users (as indicated in the mercurial mailing list
      on the topic "Can't get pull-bundles working").
      53e4f44ba0e8
  8. Nov 06, 2022
    • Matt Harbison's avatar
      upgrade: byteify requirement changes written to output · d12446766a35
      Matt Harbison authored
      ui.write() expects bytes, and internally uses `b''` as the default when getting
      the `label` keyword from `*args`.  So either we're missing test coverage, or
      there's some very subtle conversion from unicode somewhere.
      
      Also, slip in a type hint to flag this in the future.
      d12446766a35
  9. Nov 05, 2022
  10. Nov 04, 2022
    • Matt Harbison's avatar
      vfs: make the default opener mode binary · 2506c3ac73f4
      Matt Harbison authored
      The default was already binary for `abstractvfs`, and the `vfs` implementation
      adds binary mode if the caller didn't supply it.  Therefore, it should be safe
      for all vfs objects (and I don't think we want text reads anyway).
      2506c3ac73f4
  11. Nov 02, 2022
    • Matt Harbison's avatar
      typing: add basic type hints to vfs.py · cc9a60050a07
      Matt Harbison authored
      Again, there's a lot more that could be done, but this sticks to the obviously
      correct stuff that is related to primitives or `vfs` objects.  Hopefully this
      helps smoke out more path related bytes vs str issues in TortoiseHg.
      
      PyCharm seems smart enough to apply hints from annotated superclass functions,
      but pytype isn't (according to the *.pyi file generated), so those are annotated
      too.
      
      There was some discussion about changing the default path arg from `None` to
      `b''` in order to avoid the more verbose `Optional` declarations.  This would be
      more in line with `os.path.join()` (which rejects `None`, but ignores empty
      strings), and still not change the behavior for callers still passing `None`
      (because the check is `if path` instead of an explicit check for `None`).  But I
      didn't want to hold this up while discussing that, so this documents what _is_.
      cc9a60050a07
  12. 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
  13. 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
  14. 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
  15. Nov 03, 2022
  16. 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
  17. Nov 03, 2022
  18. Oct 16, 2022
    • Pierre-Yves David's avatar
      perf-unbundle: do a quick and dirty fix to make it run on more commit · 27bff60887fe
      Pierre-Yves David authored
      Without this change, the perf commands fails within the
      f67741e8264b::18415fc918a1 range (boundary excluded).
      
      Check inline comment for details.
      
      With this fix, the command is able to run on this range, with a slightly
      different behavior (as no revset is "uninlined"). However this is still much
      better than not being able to run anything in this range. Especially because
      that range do see some performance regression for unbundle.
      27bff60887fe
  19. Oct 18, 2022
  20. Oct 19, 2022
  21. Nov 03, 2022
    • Raphaël Gomès's avatar
      rhg: fallback when encountering ellipsis revisions · 7787174f0a5a
      Raphaël Gomès authored
      Ellipsis revisions are still experimental and buggy in non-trivial
      histories. We currently have no plans to improve this situation nor
      to add support for ellipsis revisions in `rhg`.
      
      Falling back should be done carefully (since we may have already done
      some work that is visible to the user), but in this case it's highly
      unlikely that we're doing anything useful with a repo with ellipsis
      revisions, so this should be strictly better, also since the
      error message is more explicit.
      7787174f0a5a
  22. Nov 02, 2022
  23. Nov 03, 2022
  24. Oct 19, 2022
  25. Sep 22, 2022
  26. Nov 04, 2022
    • Pierre-Yves David's avatar
      upgrade: no longer keep all revlogs in memory at any point · 1994842955db
      Pierre-Yves David authored
      Keeping all object open is unsustainable, so we will open them on demand. This
      mean opening them multiple times, but this is a lesser evil.
      
      Each revlog consume a small amount of memory (index content, associated nodemap,
      etc). While there are few "big" revlog, the sheer amount of small filelog can
      become a significant issue memory wise, consuming multiple GB of memory.  If you
      combines this extra usage with the use of multiprocessing, this usage can
      quickly get out of control. This can effectively block the upgrade of larger
      repository. This changeset fixes this issue.
      1994842955db
  27. Nov 02, 2022
    • Matt Harbison's avatar
      demandimport: convert ignored modules from bytes -> str in extensions · 5f22c92dcf3d
      Matt Harbison authored
      The default list of ignored modules are str, and test for bypassing the lazy
      import is `module.__name__ in ignores`, so these were effectively NOT ignored.
      Most of these date back to the grand byteification in 687b865b95ad, with some
      subsequent additions that followed the existing example.
      
      I have no idea if these modules in fact need to bypass lazy importing, but at
      least it follows the intent of the code.
      5f22c92dcf3d
  28. Oct 26, 2022
    • Raphaël Gomès's avatar
      dirstate-v2: fix edge case where entries aren't sorted · fc719967efd0
      Raphaël Gomès authored
      See previous commit for more details.
      fc719967efd0
    • Raphaël Gomès's avatar
      dirstate-v2: highlight a bug when Python-packed but used in `rhg` · e255a5355971
      Raphaël Gomès authored
      The Python packer creates unsorted entries in the edge case that a file
      starts with the same name as a sibling folder.
      
      This bug has no effect on the Python `hg status` since Python ignores
      directories. `rhg` assumes that all on-disk entries are sorted (which is
      a property of the format) including folder, hence the issue highlighted.
      
      This is also technically broken in Rust-augmented `hg status`, but it
      makes setting up the test more complex than necessary, since it requires
      the packing to be Python only (which it isn't if you have Rust extensions).
      
      Fix is in the next commit.
      e255a5355971
Loading