annotate tests/test-conflict.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 2371f4aea665
children 25d5a9ecbb85
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11797
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
1 $ hg init
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
2 $ echo "nothing" > a
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
3 $ hg add a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11797
diff changeset
4 $ hg commit -m ancestor
11797
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
5 $ echo "something" > a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11797
diff changeset
6 $ hg commit -m branch1
11797
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
7 $ hg co 0
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
8 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
9 $ echo "something else" > a
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11797
diff changeset
10 $ hg commit -m branch2
11797
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
11 created new head
346
f69a5d2d4fe1 merge3: fix argument order
mpm@selenic.com
parents:
diff changeset
12
11797
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
13 $ hg merge 1
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
14 merging a
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
15 warning: conflicts during merge.
15501
2371f4aea665 merge: give a special message for internal:merge failure (issue3105)
Matt Mackall <mpm@selenic.com>
parents: 12316
diff changeset
16 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
11797
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
17 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
12314
f2daa6ab514a merge: suggest 'hg up -C .' for discarding changes, not 'hg up -C'
Brodie Rao <brodie@bitheap.org>
parents: 12156
diff changeset
18 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
12316
4134686b83e1 tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents: 12314
diff changeset
19 [1]
11797
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
20
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
21 $ hg id
12156
4c94b6d0fb1c tests: remove unneeded -d flags
Martin Geisler <mg@lazybytes.net>
parents: 11797
diff changeset
22 32e80765d7fe+75234512624c+ tip
11797
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
23
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
24 $ cat a
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
25 <<<<<<< local
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
26 something else
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
27 =======
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
28 something
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
29 >>>>>>> other
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
30
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
31 $ hg status
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
32 M a
66e4e8e8b1e5 tests: unify test-conflict
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 4387
diff changeset
33 ? a.orig