Mercurial > hg-stable
annotate hg @ 48258:c62e4397eb28
copy: recommend `--at-rev .` if target was added in parent commit
If the target file was added in the working copy parent, it's much
more likely that the user meant to use `--at-rev .` (to record the
copy/rename in the that commit) than `--force` (to replace the
just-added file by another file).
Differential Revision: https://phab.mercurial-scm.org/D11667
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 14 Oct 2021 10:58:39 -0700 |
parents | 769cd5703b2c |
children | 6000f5b25c9b |
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 | 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 | 8 # GNU General Public License version 2 or any later version. |
33914
1900381b6a6e
hg: update top-level script to use modern import conventions
Augie Fackler <raf@durin42.com>
parents:
32462
diff
changeset
|
9 from __future__ import absolute_import |
0
9117c6561b0b
Add back links from file revisions to changeset revisions
mpm@selenic.com
parents:
diff
changeset
|
10 |
12661
10da5a1f25dd
setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
10263
diff
changeset
|
11 import os |
10da5a1f25dd
setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
10263
diff
changeset
|
12 import sys |
10da5a1f25dd
setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
10263
diff
changeset
|
13 |
10da5a1f25dd
setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
10263
diff
changeset
|
14 libdir = '@LIBDIR@' |
10da5a1f25dd
setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
10263
diff
changeset
|
15 |
10da5a1f25dd
setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
10263
diff
changeset
|
16 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
|
17 if not os.path.isabs(libdir): |
43703
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
18 libdir = os.path.join( |
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
19 os.path.dirname(os.path.realpath(__file__)), libdir |
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
20 ) |
12661
10da5a1f25dd
setup/hg: always load Mercurial from where it was installed.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
10263
diff
changeset
|
21 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
|
22 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
|
23 |
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
|
24 # 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
|
25 # 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
|
26 # 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
|
27 # 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
|
28 # 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
|
29 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
|
30 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
|
31 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
|
32 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
|
33 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
|
34 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
|
35 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
|
36 '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
|
37 '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
|
38 '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
|
39 ) |
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
|
40 ) |
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
|
41 |
39608
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
42 from hgdemandimport import tracing |
43703
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
43 |
39608
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
44 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
|
45 # 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
|
46 try: |
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
47 if sys.version_info[0] < 3 or sys.version_info >= (3, 6): |
43703
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
48 import hgdemandimport |
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
49 |
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
50 hgdemandimport.enable() |
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 except ImportError: |
43703
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
52 sys.stderr.write( |
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
53 "abort: couldn't find mercurial libraries in [%s]\n" |
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
54 % ' '.join(sys.path) |
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
55 ) |
39608
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
56 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
|
57 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
|
58 |
39608
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
59 from mercurial import dispatch |
43703
99e231afc29c
black: blacken scripts
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43073
diff
changeset
|
60 |
39608
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
61 dispatch.run() |