Mercurial > hg
annotate tests/test-merge-internal-tools-pattern.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 | b63f6422d2a7 |
children | ff12a6c63c3d |
rev | line source |
---|---|
12328
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
1 Make sure that the internal merge tools (internal:fail, internal:local, and |
b63f6422d2a7
tests: fix a bunch of pointless #s in unified tests
Matt Mackall <mpm@selenic.com>
parents:
12316
diff
changeset
|
2 internal:other) are used when matched by a merge-pattern in hgrc |
6521
a3668330f14a
test that internal merge tools are used when set for a merge-pattern in hgrc
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
3 |
12257
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
4 Make sure HGMERGE doesn't interfere with the test: |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
5 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
6 $ unset HGMERGE |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
7 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
8 $ hg init |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
9 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
10 Initial file contents: |
6521
a3668330f14a
test that internal merge tools are used when set for a merge-pattern in hgrc
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
11 |
12257
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
12 $ echo "line 1" > f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
13 $ echo "line 2" >> f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
14 $ echo "line 3" >> f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
15 $ hg ci -Am "revision 0" |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
16 adding f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
17 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
18 $ cat f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
19 line 1 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
20 line 2 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
21 line 3 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
22 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
23 Branch 1: editing line 1: |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
24 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
25 $ sed 's/line 1/first line/' f > f.new |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
26 $ mv f.new f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
27 $ hg ci -Am "edited first line" |
6521
a3668330f14a
test that internal merge tools are used when set for a merge-pattern in hgrc
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
28 |
12257
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
29 Branch 2: editing line 3: |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
30 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
31 $ hg update 0 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
32 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
33 $ sed 's/line 3/third line/' f > f.new |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
34 $ mv f.new f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
35 $ hg ci -Am "edited third line" |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
36 created new head |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
37 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
38 Merge using internal:fail tool: |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
39 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
40 $ echo "[merge-patterns]" > .hg/hgrc |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
41 $ echo "* = internal:fail" >> .hg/hgrc |
6521
a3668330f14a
test that internal merge tools are used when set for a merge-pattern in hgrc
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
42 |
12257
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
43 $ hg merge |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
44 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:
12257
diff
changeset
|
45 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
|
46 [1] |
12257
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
47 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
48 $ cat f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
49 line 1 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
50 line 2 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
51 third line |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
52 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
53 $ hg stat |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
54 M f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
55 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
56 Merge using internal:local tool: |
6521
a3668330f14a
test that internal merge tools are used when set for a merge-pattern in hgrc
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
57 |
12257
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
58 $ hg update -C 2 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
59 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
60 $ sed 's/internal:fail/internal:local/' .hg/hgrc > .hg/hgrc.new |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
61 $ mv .hg/hgrc.new .hg/hgrc |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
62 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
63 $ hg merge |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
64 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
65 (branch merge, don't forget to commit) |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
66 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
67 $ cat f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
68 line 1 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
69 line 2 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
70 third line |
6521
a3668330f14a
test that internal merge tools are used when set for a merge-pattern in hgrc
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
71 |
12257
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
72 $ hg stat |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
73 M f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
74 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
75 Merge using internal:other tool: |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
76 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
77 $ hg update -C 2 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
78 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
79 $ sed 's/internal:local/internal:other/' .hg/hgrc > .hg/hgrc.new |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
80 $ mv .hg/hgrc.new .hg/hgrc |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
81 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
82 $ hg merge |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
83 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
84 (branch merge, don't forget to commit) |
6521
a3668330f14a
test that internal merge tools are used when set for a merge-pattern in hgrc
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
85 |
12257
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
86 $ cat f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
87 first line |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
88 line 2 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
89 line 3 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
90 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
91 $ hg stat |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
92 M f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
93 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
94 Merge using default tool: |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
95 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
96 $ hg update -C 2 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
97 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
98 $ rm .hg/hgrc |
6521
a3668330f14a
test that internal merge tools are used when set for a merge-pattern in hgrc
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
99 |
12257
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
100 $ hg merge |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
101 merging f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
102 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
103 (branch merge, don't forget to commit) |
6521
a3668330f14a
test that internal merge tools are used when set for a merge-pattern in hgrc
Dov Feldstern <dfeldstern@fastimap.com>
parents:
diff
changeset
|
104 |
12257
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
105 $ cat f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
106 first line |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
107 line 2 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
108 third line |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
109 |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
110 $ hg stat |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
111 M f |
470e0b1ddc6e
tests: unify test-merge-internal-tools-pattern
Adrian Buehlmann <adrian@cadifra.com>
parents:
12156
diff
changeset
|
112 |