hg
author Gregory Szorc <gregory.szorc@gmail.com>
Fri, 08 Jan 2016 10:58:04 -0800
changeset 27738 a0e783d26e81
parent 21812 73e4a02e6d23
child 29172 2ea9c9aa6e60
permissions -rwxr-xr-x
exchange: make clone bundles non-experimental and enabled by default The clone bundles feature was introduced in Mercurial 3.6 behind an experimental and disabled by default flag. The feature has been enabled on hg.mozilla.org for a few months and has served many terabytes of clones. Users have been encouraged to use the feature and reception has been very positive (mainly due to faster clones as a result of connecting to a CDN). I have heard no feedback about changing the feature other than inquiries about when it will be enabled by default. So, I think the feature is ready to be enabled by default. This patch renames experimental.clonebundles to ui.clonebundles, documents the option, and enables it by default. References to the experimental state of clone bundles have been removed. The remaining config option docs in clonebundles.py have been removed because they are redudant with `hg help config`. There are some oddities with behavior of clone bundles. Because clones with clone bundles are effectively 2 `hg pull` operations, there may be 2 transactions. This could result in hooks running twice. If the subsequent pull is aborted, it could result in partial rollback and an incomplete clone. This behavior is a bit wonky and should probably be documented. If this patch is accepted, I'll send a follow-up to document it. I don't think this behavior should prevent the feature being enabled by default. Reworking the clone mechanism to support interrupted or multi-part clones feels like a major new feature and something that when implemented can change the hook and rollback semantics of clone bundles. Besides, partial clone is better than full rollback and hooks running on initial clone are likely rare, so I think the impact is minimal.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
9117c6561b0b Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff changeset
     1
#!/usr/bin/env python
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
#
4635
63b9d2deed48 Updated copyright notices and add "and others" to "hg version"
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3877
diff changeset
     5
# Copyright 2005-2007 Matt Mackall <mpm@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
21812
73e4a02e6d23 hg: add support for HGUNICODEPEDANTRY environment variable
Augie Fackler <raf@durin42.com>
parents: 14233
diff changeset
    13
if os.environ.get('HGUNICODEPEDANTRY', False):
73e4a02e6d23 hg: add support for HGUNICODEPEDANTRY environment variable
Augie Fackler <raf@durin42.com>
parents: 14233
diff changeset
    14
    reload(sys)
73e4a02e6d23 hg: add support for HGUNICODEPEDANTRY environment variable
Augie Fackler <raf@durin42.com>
parents: 14233
diff changeset
    15
    sys.setdefaultencoding("undefined")
73e4a02e6d23 hg: add support for HGUNICODEPEDANTRY environment variable
Augie Fackler <raf@durin42.com>
parents: 14233
diff changeset
    16
73e4a02e6d23 hg: add support for HGUNICODEPEDANTRY environment variable
Augie Fackler <raf@durin42.com>
parents: 14233
diff changeset
    17
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    18
libdir = '@LIBDIR@'
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    19
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    20
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
    21
    if not os.path.isabs(libdir):
12805
cae1c187abd4 setup/hg: handle hg being a symlink when appending relative libdir to sys.path
L. David Baron <dbaron@dbaron.org>
parents: 12661
diff changeset
    22
        libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
cae1c187abd4 setup/hg: handle hg being a symlink when appending relative libdir to sys.path
L. David Baron <dbaron@dbaron.org>
parents: 12661
diff changeset
    23
                              libdir)
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
    24
        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
    25
    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
    26
5197
55860a45bbf2 Enable demandimport only in scripts, not in importable modules (issue605)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5178
diff changeset
    27
# enable importing on demand to reduce startup time
7672
523c7816c33a Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents: 5531
diff changeset
    28
try:
523c7816c33a Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents: 5531
diff changeset
    29
    from mercurial import demandimport; demandimport.enable()
523c7816c33a Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents: 5531
diff changeset
    30
except ImportError:
523c7816c33a Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents: 5531
diff changeset
    31
    import sys
523c7816c33a Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents: 5531
diff changeset
    32
    sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" %
523c7816c33a Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents: 5531
diff changeset
    33
                     ' '.join(sys.path))
523c7816c33a Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents: 5531
diff changeset
    34
    sys.stderr.write("(check your install and PYTHONPATH)\n")
523c7816c33a Give a useful message about PYTHONPATH if startup fails
Matt Mackall <mpm@selenic.com>
parents: 5531
diff changeset
    35
    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
    36
5531
a3fe91b4f6eb Change standard streams mode to binary at hg startup
Patrick Mezard <pmezard@gmail.com>
parents: 5197
diff changeset
    37
import mercurial.util
5178
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 4635
diff changeset
    38
import mercurial.dispatch
5531
a3fe91b4f6eb Change standard streams mode to binary at hg startup
Patrick Mezard <pmezard@gmail.com>
parents: 5197
diff changeset
    39
a3fe91b4f6eb Change standard streams mode to binary at hg startup
Patrick Mezard <pmezard@gmail.com>
parents: 5197
diff changeset
    40
for fp in (sys.stdin, sys.stdout, sys.stderr):
14233
659f34b833b9 rename util.set_binary to setbinary
Adrian Buehlmann <adrian@cadifra.com>
parents: 12805
diff changeset
    41
    mercurial.util.setbinary(fp)
5531
a3fe91b4f6eb Change standard streams mode to binary at hg startup
Patrick Mezard <pmezard@gmail.com>
parents: 5197
diff changeset
    42
5178
18a9fbb5cd78 dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents: 4635
diff changeset
    43
mercurial.dispatch.run()