Skip to content
Snippets Groups Projects
  1. Jan 17, 2020
    • Matt Harbison's avatar
      phabricator: use .arcconfig for `phabricator.url` if not set locally · ff396501e841
      Matt Harbison authored
      This setting is also per repo; see the previous commit for details.
      
      The existing `conduit_uri` setting is the previous name of `phabricator.uri`[1]
      and while it could easily be queried before the latter for compatibility, the
      config in this repo has '/api' appended. That's already done in `callconduit()`,
      which would clearly end up giving the wrong result. It looks like the path of
      the URL is now ignored in user configs[2], so add the modern setting without it
      to this repo's .arcconfig.
      
      Sadly, we still need to have contributors configure `auth.hg.phabtoken` (and
      therefore `auth.hg.prefix` to link it to `phabricator.url`) in order to submit
      patches, but at least now it's localized to a single section.
      
      [1] https://secure.phabricator.com/book/phabricator/article/arcanist_new_project/
      [2] https://github.com/phacility/arcanist/blob/cc850163f30c4697e925df0d6212469679600a2c/scripts/arcanist.php#L271
      
      Differential Revision: https://phab.mercurial-scm.org/D7935
      ff396501e841
    • Matt Harbison's avatar
      phabricator: use .arcconfig for the callsign if not set locally (issue6243) · 59b3fe1e2021
      Matt Harbison authored
      This makes things easier for people working with more than one repository
      because this file can be committed to each repository.  The bug report asks to
      read <repo>/.arcrc, but AFAICT, that file lives in ~/ and holds the credentials.
      And we already track an .arcconfig file.  Any callsign set globally is still
      used if that is all that is present, but .arcconfig will override it if
      available.  The idea behind letting the local hgrc override .arcconfig is that
      the developer may need to do testing against another server, and not dirty the
      working directory.
      
      Originally I was going to just try to read the callsign in `getrepophid()` if it
      wasn't present in the hg config.  That works fine, but I think it also makes
      sense to read the URL from this file too.  That would have worked less well
      because `readurltoken()` doesn't have access to the repo object to know where to
      find the file.  Supplimenting the config mechanism is less magical because it
      reports the source and value of the properties used, and it doesn't need to read
      the file twice.
      
      Invalid hgrc files generally cause the program to abort.  I only flagged it as a
      warning here because it's not our config file, not crucial to the whole program
      operating, and really shouldn't be corrupt in the typical case where it is
      checked into the repo.
      
      Differential Revision: https://phab.mercurial-scm.org/D7934
      59b3fe1e2021
    • Matt Harbison's avatar
      config: add a function to insert non-file based, but overridable settings · e2278581b1c6
      Matt Harbison authored
      This will be used in the next patch.
      
      Until relatively recently (473510bf0575), there was no official way for
      extensions to inject per-repo config data, so it probably makes sense that
      `ui.setconfig()` items are sticky, and not affected by loading more config
      files.  But that makes it cumbersome if the extension wants to allow the data it
      might add to be overridden by any data in the local hgrc file.  The only thing I
      could get to work was to load the local hgrc first, and then check if the source
      for the config item that should be overridden was *not* the local hgrc file
      name.  But that's brittle because in addition to the file name, the source
      contains the line number, there are the usual '\' vs '/' platform differences,
      etc.
      
      Differential Revision: https://phab.mercurial-scm.org/D7933
      e2278581b1c6
    • Matt Harbison's avatar
      tests: restore phabricator tests and regenerate the recordings · a5e3f38407cb
      Matt Harbison authored
      These contain the new API chatter.  Most of the changes are because some new
      commits were created, but they're pretty obviously equivalent.  I have no idea
      why the last recording contains real data, whereas it previously looked fake.
      
      Differential Revision: https://phab.mercurial-scm.org/D7920
      a5e3f38407cb
  2. Jan 07, 2020
  3. Jan 18, 2020
  4. Jan 21, 2020
    • Gregory Szorc's avatar
      hgdemandimport: apply lazy module loading to sys.meta_path finders · f81c17ec303c
      Gregory Szorc authored
      Python's `sys.meta_path` finders are the primary objects whose job it
      is to find a module at import time. When `import` is called, Python
      iterates objects in this list and calls `o.find_spec(...)` to find
      a `ModuleSpec` (or None if the module couldn't be found by that
      finder). If no meta path finder can find a module, import fails.
      
      One of the default meta path finders is `PathFinder`. Its job is to
      import modules from the filesystem and is probably the most important
      importer. This finder looks at `sys.path` and `sys.path_hooks` to do
      its job.
      
      The `ModuleSpec` returned by `MetaPathImporter.find_spec()` has a
      `loader` attribute, which defines the concrete module loader to use.
      `sys.path_hooks` is a hook point for teaching `PathFinder` to
      instantiate custom loader types.
      
      Previously, we injected a custom `sys.path_hook` that told `PathFinder`
      to wrap the default loaders with a loader that creates a module object
      that is lazy.
      
      This approach worked. But its main limitation was that it only applied
      to the `PathFinder` meta path importer. There are other meta path
      importers that are registered. And in the case of PyOxidizer loading
      modules from memory, `PathFinder` doesn't come into play since
      PyOxidizer's own meta path importer was handling all imports.
      
      This commit changes our approach to lazy module loading by proxying
      all meta path importers. Specifically, we overload the `find_spec()`
      method to swap in a wrapped loader on the `ModuleSpec` before it
      is returned. The end result of this is all meta path importers should
      be lazy.
      
      As much as I would have loved to utilize .__class__ manipulation to
      achieve this, some meta path importers are implemented in C/Rust
      in such a way that they cannot be monkeypatched. This is why we
      use __getattribute__ to define a proxy.
      
      Also, this change could theoretically open us up to regressions in
      meta path importers whose loader is creating module objects which
      can't be monkeypatched. But I'm not aware of any of these in the
      wild. So I think we'll be safe.
      
      According to hyperfine, this change yields a decent startup time win of
      5-6ms:
      
      ```
      Benchmark #1: ~/.pyenv/versions/3.6.10/bin/python ./hg version
        Time (mean ± σ):      86.8 ms ±   0.5 ms    [User: 78.0 ms, System: 8.7 ms]
        Range (min … max):    86.0 ms …  89.1 ms    50 runs
      
        Time (mean ± σ):      81.1 ms ±   2.7 ms    [User: 74.5 ms, System: 6.5 ms]
        Range (min … max):    77.8 ms …  90.5 ms    50 runs
      
      Benchmark #2: ~/.pyenv/versions/3.7.6/bin/python ./hg version
        Time (mean ± σ):      78.9 ms ±   0.6 ms    [User: 70.2 ms, System: 8.7 ms]
        Range (min … max):    78.1 ms …  81.2 ms    50 runs
      
        Time (mean ± σ):      73.4 ms ±   0.6 ms    [User: 65.3 ms, System: 8.0 ms]
        Range (min … max):    72.4 ms …  75.7 ms    50 runs
      
      Benchmark #3: ~/.pyenv/versions/3.8.1/bin/python ./hg version
        Time (mean ± σ):      78.1 ms ±   0.6 ms    [User: 70.2 ms, System: 7.9 ms]
        Range (min … max):    77.4 ms …  80.9 ms    50 runs
      
        Time (mean ± σ):      72.1 ms ±   0.4 ms    [User: 64.4 ms, System: 7.6 ms]
        Range (min … max):    71.4 ms …  74.1 ms    50 runs
      ```
      
      Differential Revision: https://phab.mercurial-scm.org/D7954
      f81c17ec303c
    • Gregory Szorc's avatar
      hgdemandimport: disable on Python 3.5 · c5e0a9b97b8a
      Gregory Szorc authored
      The demand importer functionality isn't working at all on Python 3.5.
      I'm not sure what's wrong.
      
      Since it isn't working, let's disable it completely.
      
      ```
      $ HGRCPATH= hyperfine -w 1 -r 50 -- "~/.pyenv/versions/3.5.9/bin/python ./hg version" \
        "HGDEMANDIMPORT=disable ~/.pyenv/versions/3.5.9/bin/python ./hg version"
      Benchmark #1: ~/.pyenv/versions/3.5.9/bin/python ./hg version
        Time (mean ± σ):     163.7 ms ±   2.2 ms    [User: 148.5 ms, System: 15.7 ms]
        Range (min … max):   161.0 ms … 170.2 ms    50 runs
      
      Benchmark #2: HGDEMANDIMPORT=disable ~/.pyenv/versions/3.5.9/bin/python ./hg version
        Time (mean ± σ):     164.3 ms ±   1.4 ms    [User: 148.2 ms, System: 16.6 ms]
        Range (min … max):   161.4 ms … 169.8 ms    50 runs
      ```
      
      Differential Revision: https://phab.mercurial-scm.org/D7953
      c5e0a9b97b8a
  5. Jan 18, 2020
    • Gregory Szorc's avatar
      py3: suppress unraisable exceptions in test-worker.t · b5aaa09be18c
      Gregory Szorc authored
      Python 3.8 calls sys.unraisablehook when an unraisable
      exception is encountered. The default behavior is to print a
      warning.
      
      test-worker.t was triggering this hook due to a race between
      a newly forked process exiting and that process's
      _os.register_at_fork handlers running. I was seeing the
      stdlib's random module in the stack re-seeding itself. Although
      there could be other after-fork handlers in the mix.
      
      This commit defines sys.unraisablehook to effectively no-op.
      This suppresses the warning and makes test output on Python 3.8
      consistent with prior versions. test-worker.t now passes on
      Python 3.8.
      
      Differential Revision: https://phab.mercurial-scm.org/D7949
      b5aaa09be18c
  6. Jan 20, 2020
  7. Jan 18, 2020
  8. Nov 21, 2019
  9. Nov 17, 2019
    • Pierre-Yves David's avatar
      localrepo: recognize trivial request for '.' · bfaf4c673bec
      Pierre-Yves David authored
      Same logic as for `null`, this is a command request and skipping the revset
      logic can avoid triggering the changelog filtering logic.
      
      Differential Revision: https://phab.mercurial-scm.org/D7495
      bfaf4c673bec
    • Pierre-Yves David's avatar
      localrepo: fastpath access to "." · d86dede17392
      Pierre-Yves David authored
      "." is just an alias for `p1(wdir())`, let us handle it that way.
      
      Differential Revision: https://phab.mercurial-scm.org/D7494
      d86dede17392
    • Pierre-Yves David's avatar
      localrepo: also fastpath access to working copy parents when possible · 85c4cd73996b
      Pierre-Yves David authored
      If the filter level guarantee that the working copy parents will be visible, we
      allow fast path access to them. With this change multiple commands can now run
      without triggering filtering.
      
      After using the quick access mechanism introduced, the whole series results in
      pretty good performance gain:
      
      ```
      All benchmarks:
      
             before           after         ratio
           [8e09551206f5]       [36b2f659]
      -       711±0.8ms       60.7±0.2ms     0.09  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -       712±0.8ms       61.6±0.2ms     0.09  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         690±1ms       93.5±0.3ms     0.14  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         688±1ms       93.8±0.3ms     0.14  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         714±1ms       60.7±0.8ms     0.09  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         713±1ms       60.9±0.3ms     0.09  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         689±1ms       93.7±0.2ms     0.14  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         687±2ms       92.8±0.2ms     0.14  simple_command.read.diff.empty.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         799±2ms       98.1±0.6ms     0.12  simple_command.read.export.bare.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -       800±0.8ms      100.0±0.4ms     0.12  simple_command.read.export.bare.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -       711±0.9ms        111±0.2ms     0.16  simple_command.read.export.bare.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         711±1ms        112±0.3ms     0.16  simple_command.read.export.bare.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         760±1ms       59.8±0.1ms     0.08  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         763±2ms       62.2±0.3ms     0.08  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         689±1ms       93.1±0.3ms     0.14  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         688±1ms       94.3±0.3ms     0.14  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 1) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -         763±1ms       60.1±0.2ms     0.08  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -         763±1ms       62.1±0.4ms     0.08  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py2.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      -       689±0.8ms       93.2±0.2ms     0.14  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYc-HGWITHRUSTEXTcpython]
      -       687±0.9ms       94.1±0.3ms     0.14  simple_command.read.status.wc_clean.default.time_bench('mercurial-filtered-2019-11-22', 'zstd', 'default', True, True, True, True, True, 2) [citrea/virtualenv-py3.7-pyyaml-HGMODULEPOLICYrust+c-HGWITHRUSTEXTcpython]
      ```
      
      Differential Revision: https://phab.mercurial-scm.org/D7492
      85c4cd73996b
  10. Jan 16, 2020
  11. Dec 26, 2019
  12. Jan 14, 2020
  13. Jan 16, 2020
  14. Jan 15, 2020
  15. Dec 28, 2019
    • Matt Harbison's avatar
      tests: stabilize test-subrepo-svn.t on Windows · e598c874b4af
      Matt Harbison authored
      This partially reverts 991e4404e910, because the URL form of `C:\...` gets
      escaped to `C%3A/...`, which breaks the substitution of $TESTTMP.
      
      The forget command on 'notafile*' errored out with:
      
         notafile*: The filename, directory name, or volume label syntax is incorrect
      
      which I think is because '*' isn't a legal character in a file name (though I
      can't trigger this directly from MSYS or cmd.exe for some reason).
      
      Differential Revision: https://phab.mercurial-scm.org/D7816
      e598c874b4af
  16. Jan 13, 2020
  17. Dec 30, 2019
  18. Dec 27, 2019
    • Martin von Zweigbergk's avatar
      graftcopies: remove `skip` and `repo` arguments · 833210fbd900
      Martin von Zweigbergk authored
      The `skip` argument was added in 2ba6c9b4e0eb (rebase: fix bug that
      caused transitive copy records to disappear (issue4192), 2014-06-07)
      in order to fix https://bz.mercurial-scm.org/show_bug.cgi?id=4192. I
      ran tests at that commit without the `skiprev` argument and the only
      difference I noticed was that `test-rebase-collapse.t` failed
      differently, in the call that is now on line 501. Without the
      `skiprev` argument, that call would end up creating another commit
      because it tried to record an invalid copy. With the previous patch in
      this series, such invalid copies are no longer recorded, so it seems
      we don't need the `skip` argument anymore.
      
      I also removed the `repo` argument since that also becomes unused with
      the removal of the `skip` argument.
      
      Differential Revision: https://phab.mercurial-scm.org/D7860
      833210fbd900
    • Martin von Zweigbergk's avatar
      graftcopies: use _filter() for filtering out invalid copies · 3df0bd706c40
      Martin von Zweigbergk authored
      `graftcopies()` (formerly called `duplicatecopies()`) checked that the
      copy destination existed in the working copy, but it didn't check that
      copy source existed in the parent of the working copy. In
      `test-graft.t` we can see that as warnings about not finding ancestors
      of the copied files, and also empty commits getting created.
      
      This patch uses the existing `_filter()` function for filtering out
      invalid copies. In addition to the aforementioned types, that also
      includes copies where source and destination is the same.
      
      Differential Revision: https://phab.mercurial-scm.org/D7859
      3df0bd706c40
  19. Jan 06, 2020
  20. Dec 27, 2019
Loading