annotate hg @ 51626:865efc020c33 default tip

dirstate: remove the python-side whitelist of allowed matchers This whitelist is too permissive because it allows matchers that contain disallowed ones deep inside, for example through `intersectionmatcher`. It is also too restrictive because it doesn't pass through some of the matchers we support, such as `patternmatcher`. It's also unnecessary because unsupported matchers raise `FallbackError` and we fall back anyway. Making this change makes more of the tests use rust code path, and therefore subtly change behavior. For example, rust status in largefiles repos seems to have strange behavior.
author Arseniy Alekseyev <aalekseyev@janestreet.com>
date Fri, 26 Apr 2024 19:10:35 +0100
parents 057639af827c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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
50534
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 48957
diff changeset
41 try:
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 48957
diff changeset
42 from hgdemandimport import tracing
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 48957
diff changeset
43 except ImportError:
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 48957
diff changeset
44 sys.stderr.write(
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 48957
diff changeset
45 "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: 48957
diff changeset
46 % ' '.join(sys.path)
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 48957
diff changeset
47 )
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 48957
diff changeset
48 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: 48957
diff changeset
49 sys.exit(-1)
43659
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
50
39592
5e78c100a215 hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents: 34533
diff changeset
51 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
52 # enable importing on demand to reduce startup time
50534
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 48957
diff changeset
53 import hgdemandimport
43659
99e231afc29c black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents: 43073
diff changeset
54
50534
057639af827c hg: move unreachable code to where it could be reached
Jason R. Coombs <jaraco@jaraco.com>
parents: 48957
diff changeset
55 hgdemandimport.enable()
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()