hg
author Pierre-Yves David <pierre-yves.david@octobus.net>
Wed, 07 Dec 2022 20:12:23 +0100
changeset 49783 e1953a34c110
parent 48957 edab75a4c1da
child 50534 057639af827c
permissions -rwxr-xr-x
bundle: emit full snapshot as is, without doing a redelta With the new `forced` delta-reused policy, it become important to be able to send full snapshot where full snapshot are needed. Otherwise, the fallback delta will simply be used on the client sideā€¦ creating monstrous delta chain, since revision that are meant as a reset of delta-chain chain becoming too complex are simply adding a new full delta-tree on the leaf of another one. In the `non-forced` cases, client process full snapshot from the bundle differently from deltas, so client will still try to convert the full snapshot into a delta if possible. So this will no lead to pathological storage explosion. I have considered making this configurable, but the impact seems limited enough that it does not seems to be worth it. Especially with the current sparse-revlog format that use "delta-tree" with multiple level snapshots, full snapshot are much less frequent and not that different from other intermediate snapshot that we are already sending over the wire anyway. CPU wise, this will help the bundling side a little as it will not need to reconstruct revisions and compute deltas. The unbundling side might save a tiny amount of CPU as it won't need to reconstruct the delta-base to reconstruct the revision full text. This only slightly visible in some of the benchmarks. And have no real impact on most of them. ### data-env-vars.name = pypy-2018-08-01-zstd-sparse-revlog # benchmark.name = perf-bundle # benchmark.variants.revs = last-40000 before: 11.467186 seconds just-emit-full: 11.190576 seconds (-2.41%) with-pull-force: 11.041091 seconds (-3.72%) # benchmark.name = perf-unbundle # benchmark.variants.revs = last-40000 before: 16.744862 just-emit-full:: 16.561036 seconds (-1.10%) with-pull-force: 16.389344 seconds (-2.12%) # benchmark.name = pull # benchmark.variants.revs = last-40000 before: 26.870569 just-emit-full: 26.391188 seconds (-1.78%) with-pull-force: 25.633184 seconds (-4.60%) Space wise (so network-wise) the impact is fairly small. When taking compression into account. Below are tests the size of `hg bundle --all` for a handful of benchmark repositories (with bzip, zstd compression and without it) This show a small increase in the bundle size, but nothing really significant except maybe for mozilla-try (+12%) that nobody really pulls large chunk of anyway. Mozilla-try is also the repository that benefit the most for not having to recompute deltas client size. ### mercurial: bzip-before: 26 406 342 bytes bzip-after: 26 691 543 bytes +1.08% zstd-before: 27 918 645 bytes zstd-after: 28 075 896 bytes +0.56% none-before: 98 675 601 bytes none-after: 100 411 237 bytes +1.76% ### pypy bzip-before: 201 295 752 bytes bzip-after: 209 780 282 bytes +4.21% zstd-before: 202 974 795 bytes zstd-after: 205 165 780 bytes +1.08% none-before: 871 070 261 bytes none-after: 993 595 057 bytes +14.07% ### netbeans bzip-before: 601 314 330 bytes bzip-after: 614 246 241 bytes +2.15% zstd-before: 604 745 136 bytes zstd-after: 615 497 705 bytes +1.78% none-before: 3 338 238 571 bytes none-after: 3 439 422 535 bytes +3.03% ### mozilla-central bzip-before: 1 493 006 921 bytes bzip-after: 1 549 650 570 bytes +3.79% zstd-before: 1 481 910 102 bytes zstd-after: 1 513 052 415 bytes +2.10% none-before: 6 535 929 910 bytes none-after: 7 010 191 342 bytes +7.26% ### mozilla-try bzip-before: 6 583 425 999 bytes bzip-after: 7 423 536 928 bytes +12.76% zstd-before: 6 021 009 212 bytes zstd-after: 6 674 922 420 bytes +10.86% none-before: 22 954 739 558 bytes none-after: 26 013 854 771 bytes +13.32%
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45830
c102b704edb5 global: use python3 in shebangs
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43659
diff changeset
     1
#!/usr/bin/env python3
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     2
#
1698
ad4a2eefe4d7 Update copyright notice
Matt Mackall <mpm@selenic.com>
parents: 515
diff changeset
     3
# mercurial - scalable distributed SCM
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     4
#
46819
d4ba4d51f85f contributor: change mentions of mpm to olivia
Raphaël Gomès <rgomes@octobus.net>
parents: 46055
diff changeset
     5
# Copyright 2005-2007 Olivia Mackall <olivia@selenic.com>
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     6
#
8225
46293a0c7e9f updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents: 7672
diff changeset
     7
# This software may be used and distributed according to the terms of the
10263
25e572394f5c Update license to GPLv2+
Matt Mackall <mpm@selenic.com>
parents: 8225
diff changeset
     8
# GNU General Public License version 2 or any later version.
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     9
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    10
import os
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    11
import sys
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    12
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    13
libdir = '@LIBDIR@'
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    14
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    15
if libdir != '@' 'LIBDIR' '@':
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    16
    if not os.path.isabs(libdir):
43659
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
    17
        libdir = os.path.join(
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
    18
            os.path.dirname(os.path.realpath(__file__)), libdir
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
    19
        )
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    20
        libdir = os.path.abspath(libdir)
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    21
    sys.path.insert(0, libdir)
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    22
46055
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45830
diff changeset
    23
# Make `pip install --user ...` packages available to the official Windows
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45830
diff changeset
    24
# build.  Most py2 packaging installs directly into the system python
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45830
diff changeset
    25
# environment, so no changes are necessary for other platforms.  The Windows
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45830
diff changeset
    26
# py2 package uses py2exe, which lacks a `site` module.  Hardcode it according
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45830
diff changeset
    27
# to the documentation.
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45830
diff changeset
    28
if getattr(sys, 'frozen', None) == 'console_exe':
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45830
diff changeset
    29
    vi = sys.version_info
47880
769cd5703b2c hg: don't attempt to extend `sys.path` with the user site without `APPDATA`
Matt Harbison <matt_harbison@yahoo.com>
parents: 46819
diff changeset
    30
    appdata = os.environ.get('APPDATA')
769cd5703b2c hg: don't attempt to extend `sys.path` with the user site without `APPDATA`
Matt Harbison <matt_harbison@yahoo.com>
parents: 46819
diff changeset
    31
    if appdata:
769cd5703b2c hg: don't attempt to extend `sys.path` with the user site without `APPDATA`
Matt Harbison <matt_harbison@yahoo.com>
parents: 46819
diff changeset
    32
        sys.path.append(
769cd5703b2c hg: don't attempt to extend `sys.path` with the user site without `APPDATA`
Matt Harbison <matt_harbison@yahoo.com>
parents: 46819
diff changeset
    33
            os.path.join(
769cd5703b2c hg: don't attempt to extend `sys.path` with the user site without `APPDATA`
Matt Harbison <matt_harbison@yahoo.com>
parents: 46819
diff changeset
    34
                appdata,
769cd5703b2c hg: don't attempt to extend `sys.path` with the user site without `APPDATA`
Matt Harbison <matt_harbison@yahoo.com>
parents: 46819
diff changeset
    35
                'Python',
769cd5703b2c hg: don't attempt to extend `sys.path` with the user site without `APPDATA`
Matt Harbison <matt_harbison@yahoo.com>
parents: 46819
diff changeset
    36
                'Python%d%d' % (vi[0], vi[1]),
769cd5703b2c hg: don't attempt to extend `sys.path` with the user site without `APPDATA`
Matt Harbison <matt_harbison@yahoo.com>
parents: 46819
diff changeset
    37
                'site-packages',
769cd5703b2c hg: don't attempt to extend `sys.path` with the user site without `APPDATA`
Matt Harbison <matt_harbison@yahoo.com>
parents: 46819
diff changeset
    38
            )
46055
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45830
diff changeset
    39
        )
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45830
diff changeset
    40
39592
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
    41
from hgdemandimport import tracing
43659
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
    42
39592
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
    43
with tracing.log('hg script'):
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
    44
    # enable importing on demand to reduce startup time
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
    45
    try:
48957
edab75a4c1da hg: always import hgdemandimport
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48875
diff changeset
    46
        import hgdemandimport
43659
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
    47
48957
edab75a4c1da hg: always import hgdemandimport
Gregory Szorc <gregory.szorc@gmail.com>
parents: 48875
diff changeset
    48
        hgdemandimport.enable()
39592
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
    49
    except ImportError:
43659
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
    50
        sys.stderr.write(
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
    51
            "abort: couldn't find mercurial libraries in [%s]\n"
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
    52
            % ' '.join(sys.path)
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
    53
        )
39592
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
    54
        sys.stderr.write("(check your install and PYTHONPATH)\n")
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
    55
        sys.exit(-1)
5197
55860a45bbf2 Enable demandimport only in scripts, not in importable modules (issue605)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5178
diff changeset
    56
39592
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
    57
    from mercurial import dispatch
43659
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
    58
39592
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
    59
    dispatch.run()