annotate hg @ 53040:cdd7bf612c7b stable tip

bundle-spec: properly format boolean parameter (issue6960) This was breaking automatic clone bundle generation. This changeset fixes it and add a test to catch it in the future.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 11 Mar 2025 02:29:42 +0100
parents 33e06272ff1a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
45849
c102b704edb5 global: use python3 in shebangs
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43703
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: 46059
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
51901
f4733654f144 typing: add `from __future__ import annotations` to most files
Matt Harbison <matt_harbison@yahoo.com>
parents: 50568
diff changeset
10 from __future__ import annotations
f4733654f144 typing: add `from __future__ import annotations` to most files
Matt Harbison <matt_harbison@yahoo.com>
parents: 50568
diff changeset
11
12661
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
12 import os
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
13 import sys
10da5a1f25dd setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 10263
diff changeset
14
46059
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45849
diff changeset
15 # 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: 45849
diff changeset
16 # 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: 45849
diff changeset
17 # 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: 45849
diff changeset
18 # 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: 45849
diff changeset
19 # 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: 45849
diff changeset
20 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: 45849
diff changeset
21 vi = sys.version_info
47865
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
22 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
23 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
24 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
25 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
26 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
27 '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
28 '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
29 '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
30 )
46059
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45849
diff changeset
31 )
7740d5102760 hg: add user-site to `sys.path` on Windows to allow pip-installed extensions
Matt Harbison <matt_harbison@yahoo.com>
parents: 45849
diff changeset
32
50568
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 49048
diff changeset
33 try:
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 49048
diff changeset
34 from hgdemandimport import tracing
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 49048
diff changeset
35 except ImportError:
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 49048
diff changeset
36 sys.stderr.write(
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 49048
diff changeset
37 "abort: couldn't find mercurial libraries in [%s]\n"
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 49048
diff changeset
38 % ' '.join(sys.path)
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 49048
diff changeset
39 )
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 49048
diff changeset
40 sys.stderr.write("(check your install and PYTHONPATH)\n")
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 49048
diff changeset
41 sys.exit(-1)
43703
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
42
39608
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
50568
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 49048
diff changeset
45 import hgdemandimport
43703
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
46
50568
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 49048
diff changeset
47 hgdemandimport.enable()
5197
55860a45bbf2 Enable demandimport only in scripts, not in importable modules (issue605)
Thomas Arendsen Hein <thomas@intevation.de>
parents: 5178
diff changeset
48
39608
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
49 from mercurial import dispatch
43703
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
50
39608
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
51 dispatch.run()