Mercurial > hg
annotate tests/test-identify.t @ 19933:621a26eb3a99
demandimport: allow extensions to import own modules by absolute name
Before this patch, python modules of each extensions can't import
another one in own extension by absolute name, because root modules of
each extensions are loaded with "hgext_" prefix.
For example, "import extroot.bar" in "extroot/foo.py" of "extroot"
extension fails, even though "import bar" in it succeeds.
Installing extensions into site-packages of python library path can
avoid this problem, but this solution is not reasonable in some cases:
using binary package of Mercurial on Windows, for example.
This patch retries to import with "hgext_" prefix after ImportError,
if the module in the extension may try to import another one in own
extension.
This patch doesn't change some "_import()"/"_origimport()" invocations
below, because ordinary extensions shouldn't cause such invocations.
- invocation of "_import()" when root module imports sub-module by
absolute path without "fromlist"
for example, "import a.b" in "a.__init__.py".
extensions are loaded with "hgext_" prefix, and this causes
execution of another (= fixed by this patch) code path.
- invocation of "_origimport()" when "level != -1" with "fromlist"
for example, importing after "from __future__ import
absolute_import" (level == 0), or "from . import b" or "from .a
import b" (0 < level),
for portability between python versions and environments,
extensions shouldn't cause "level != -1".
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 05 Oct 2013 01:02:22 +0900 |
parents | 50fbe9063ff2 |
children | b93791e0de25 |
rev | line source |
---|---|
17014
50fbe9063ff2
tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
1 $ "$TESTDIR/hghave" serve || exit 80 |
50fbe9063ff2
tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
2 |
50fbe9063ff2
tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
3 #if no-outer-repo |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
4 |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
5 no repo |
7757
af6a63438a8a
identify: have consistent output for local repositories
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
6 |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
7 $ hg id |
12070 | 8 abort: there is no Mercurial repository here (.hg not found) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12070
diff
changeset
|
9 [255] |
7830
55bd03e2e13c
test-identify: require no-outer-repo
Mads Kiilerich <mads@kiilerich.com>
parents:
7759
diff
changeset
|
10 |
17014
50fbe9063ff2
tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
11 #endif |
50fbe9063ff2
tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
12 |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
13 create repo |
7757
af6a63438a8a
identify: have consistent output for local repositories
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
14 |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
15 $ hg init test |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
16 $ cd test |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
17 $ echo a > a |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
18 $ hg ci -Ama |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
19 adding a |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
20 |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
21 basic id usage |
7757
af6a63438a8a
identify: have consistent output for local repositories
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
22 |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
23 $ hg id |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
24 cb9a9f314b8b tip |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
25 $ hg id --debug |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
26 cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b tip |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
27 $ hg id -q |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
28 cb9a9f314b8b |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
29 $ hg id -v |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
30 cb9a9f314b8b tip |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
31 |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
32 with options |
7757
af6a63438a8a
identify: have consistent output for local repositories
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
33 |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
34 $ hg id -r. |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
35 cb9a9f314b8b tip |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
36 $ hg id -n |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
37 0 |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
38 $ hg id -t |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
39 tip |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
40 $ hg id -b |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
41 default |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
42 $ hg id -i |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
43 cb9a9f314b8b |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
44 $ hg id -n -t -b -i |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
45 cb9a9f314b8b 0 default tip |
7757
af6a63438a8a
identify: have consistent output for local repositories
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
46 |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
47 with modifications |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
48 |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
49 $ echo b > a |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
50 $ hg id -n -t -b -i |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
51 cb9a9f314b8b+ 0+ default tip |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
52 |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
53 other local repo |
7757
af6a63438a8a
identify: have consistent output for local repositories
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
54 |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
55 $ cd .. |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
56 $ hg -R test id |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
57 cb9a9f314b8b+ tip |
17014
50fbe9063ff2
tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
58 #if no-outer-repo |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
59 $ hg id test |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
60 cb9a9f314b8b+ tip |
17014
50fbe9063ff2
tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
61 #endif |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
62 |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
63 with remote http repo |
7757
af6a63438a8a
identify: have consistent output for local repositories
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
64 |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
65 $ cd test |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
66 $ hg serve -p $HGPORT1 -d --pid-file=hg.pid |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
67 $ cat hg.pid >> $DAEMON_PIDS |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
68 $ hg id http://localhost:$HGPORT1/ |
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
69 cb9a9f314b8b |
7757
af6a63438a8a
identify: have consistent output for local repositories
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
70 |
13477
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13447
diff
changeset
|
71 remote with rev number? |
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13447
diff
changeset
|
72 |
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13447
diff
changeset
|
73 $ hg id -n http://localhost:$HGPORT1/ |
13644
7e6c2f58ad56
identify: list bookmarks for remote repositories
Nils Adermann <naderman@naderman.de>
parents:
13477
diff
changeset
|
74 abort: can't query remote revision number, branch, or tags |
13477
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13447
diff
changeset
|
75 [255] |
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13447
diff
changeset
|
76 |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
77 remote with tags? |
7759
50baf8215942
tests: fix for test-identify returning 255
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7757
diff
changeset
|
78 |
11796
141e2e964705
tests: unify test-identify
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
7830
diff
changeset
|
79 $ hg id -t http://localhost:$HGPORT1/ |
13644
7e6c2f58ad56
identify: list bookmarks for remote repositories
Nils Adermann <naderman@naderman.de>
parents:
13477
diff
changeset
|
80 abort: can't query remote revision number, branch, or tags |
13477
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13447
diff
changeset
|
81 [255] |
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13447
diff
changeset
|
82 |
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13447
diff
changeset
|
83 remote with branch? |
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13447
diff
changeset
|
84 |
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13447
diff
changeset
|
85 $ hg id -b http://localhost:$HGPORT1/ |
13644
7e6c2f58ad56
identify: list bookmarks for remote repositories
Nils Adermann <naderman@naderman.de>
parents:
13477
diff
changeset
|
86 abort: can't query remote revision number, branch, or tags |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12070
diff
changeset
|
87 [255] |
13447
931a72e00efa
introduce new RequirementError (issue2649)
Adrian Buehlmann <adrian@cadifra.com>
parents:
12346
diff
changeset
|
88 |
13645
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
89 test bookmark support |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
90 |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
91 $ hg bookmark Y |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
92 $ hg bookmark Z |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
93 $ hg bookmarks |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
94 Y 0:cb9a9f314b8b |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
95 * Z 0:cb9a9f314b8b |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
96 $ hg id |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
97 cb9a9f314b8b+ tip Y/Z |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
98 $ hg id --bookmarks |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
99 Y Z |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
100 |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
101 test remote identify with bookmarks |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
102 |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
103 $ hg id http://localhost:$HGPORT1/ |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
104 cb9a9f314b8b Y/Z |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
105 $ hg id --bookmarks http://localhost:$HGPORT1/ |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
106 Y Z |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
107 $ hg id -r . http://localhost:$HGPORT1/ |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
108 cb9a9f314b8b Y/Z |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
109 $ hg id --bookmarks -r . http://localhost:$HGPORT1/ |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
110 Y Z |
3786b810ea75
tests: add tests for bookmarks support in hg identify
David Soria Parra <dsp@php.net>
parents:
13644
diff
changeset
|
111 |
13447
931a72e00efa
introduce new RequirementError (issue2649)
Adrian Buehlmann <adrian@cadifra.com>
parents:
12346
diff
changeset
|
112 Make sure we do not obscure unknown requires file entries (issue2649) |
931a72e00efa
introduce new RequirementError (issue2649)
Adrian Buehlmann <adrian@cadifra.com>
parents:
12346
diff
changeset
|
113 |
931a72e00efa
introduce new RequirementError (issue2649)
Adrian Buehlmann <adrian@cadifra.com>
parents:
12346
diff
changeset
|
114 $ echo fake >> .hg/requires |
931a72e00efa
introduce new RequirementError (issue2649)
Adrian Buehlmann <adrian@cadifra.com>
parents:
12346
diff
changeset
|
115 $ hg id |
14746
72e4fcb43227
requirements: show all missing features in the error message.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
14483
diff
changeset
|
116 abort: unknown repository format: requires features 'fake' (upgrade Mercurial)! |
13447
931a72e00efa
introduce new RequirementError (issue2649)
Adrian Buehlmann <adrian@cadifra.com>
parents:
12346
diff
changeset
|
117 [255] |
931a72e00efa
introduce new RequirementError (issue2649)
Adrian Buehlmann <adrian@cadifra.com>
parents:
12346
diff
changeset
|
118 |
931a72e00efa
introduce new RequirementError (issue2649)
Adrian Buehlmann <adrian@cadifra.com>
parents:
12346
diff
changeset
|
119 $ cd .. |
17014
50fbe9063ff2
tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
120 #if no-outer-repo |
13447
931a72e00efa
introduce new RequirementError (issue2649)
Adrian Buehlmann <adrian@cadifra.com>
parents:
12346
diff
changeset
|
121 $ hg id test |
14746
72e4fcb43227
requirements: show all missing features in the error message.
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
14483
diff
changeset
|
122 abort: unknown repository format: requires features 'fake' (upgrade Mercurial)! |
13447
931a72e00efa
introduce new RequirementError (issue2649)
Adrian Buehlmann <adrian@cadifra.com>
parents:
12346
diff
changeset
|
123 [255] |
17014
50fbe9063ff2
tests: convert some 'hghave no-outer-repo' to #if
Mads Kiilerich <mads@kiilerich.com>
parents:
15446
diff
changeset
|
124 #endif |