author | Denis Laxalde <denis.laxalde@logilab.fr> |
Wed, 13 Nov 2019 15:23:04 +0100 | |
changeset 43671 | af3e341dbf03 |
parent 43073 | 5c9c71cde1c9 |
child 43703 | 99e231afc29c |
permissions | -rwxr-xr-x |
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 | 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 | 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): |
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
|
18 |
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
|
19 |
libdir) |
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 |
|
39608
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
23 |
from hgdemandimport import tracing |
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
24 |
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
|
25 |
# 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
|
26 |
try: |
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
27 |
if sys.version_info[0] < 3 or sys.version_info >= (3, 6): |
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
28 |
import hgdemandimport; hgdemandimport.enable() |
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
29 |
except ImportError: |
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
30 |
sys.stderr.write("abort: couldn't find mercurial libraries in [%s]\n" % |
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
31 |
' '.join(sys.path)) |
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
32 |
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
|
33 |
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
|
34 |
|
39608
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
35 |
from mercurial import dispatch |
5e78c100a215
hg: wrap the highest layer in the `hg` script possible in trace event
Augie Fackler <augie@google.com>
parents:
34533
diff
changeset
|
36 |
dispatch.run() |