Mercurial > hg
annotate tests/test-push-validation.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 | ef60083b5536 |
children | 2a03a365f645 |
rev | line source |
---|---|
12279 | 1 $ hg init test |
2 $ cd test | |
3 | |
4 $ cat > .hg/hgrc <<EOF | |
5 > [server] | |
6 > validate=1 | |
7 > EOF | |
8 | |
9 $ echo alpha > alpha | |
10 $ echo beta > beta | |
11 $ hg addr | |
12 adding alpha | |
13 adding beta | |
14 $ hg ci -m 1 | |
15 | |
16 $ cd .. | |
17 $ hg clone test test-clone | |
18 updating to branch default | |
19 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
20 | |
18422
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
21 Test spurious filelog entries: |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
22 |
12279 | 23 $ cd test-clone |
18422
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
24 $ echo blah >> beta |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
25 $ cp .hg/store/data/beta.i tmp1 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
26 $ hg ci -m 2 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
27 $ cp .hg/store/data/beta.i tmp2 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
28 $ hg -q rollback |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
29 $ mv tmp2 .hg/store/data/beta.i |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
30 $ echo blah >> beta |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
31 $ hg ci -m '2 (corrupt)' |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
32 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
33 Expected to fail: |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
34 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
35 $ hg verify |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
36 checking changesets |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
37 checking manifests |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
38 crosschecking files in changesets and manifests |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
39 checking files |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
40 beta@1: dddc47b3ba30 not in manifests |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
41 2 files, 2 changesets, 4 total revisions |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
42 1 integrity errors encountered! |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
43 (first damaged changeset appears to be 1) |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
44 [1] |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
45 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
46 $ hg push |
18506
ef60083b5536
tests: fix for windows - slashes and no serve
Mads Kiilerich <madski@unity3d.com>
parents:
18422
diff
changeset
|
47 pushing to $TESTTMP/test (glob) |
18422
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
48 searching for changes |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
49 adding changesets |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
50 adding manifests |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
51 adding file changes |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
52 transaction abort! |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
53 rollback completed |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
54 abort: received spurious file revlog entry |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
55 [255] |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
56 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
57 $ hg -q rollback |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
58 $ mv tmp1 .hg/store/data/beta.i |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
59 $ echo beta > beta |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
60 |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
61 Test missing filelog entries: |
f009804e2a43
validate: check for spurious incoming filelog entries
Sune Foldager <cryo@cyanite.org>
parents:
16913
diff
changeset
|
62 |
12279 | 63 $ cp .hg/store/data/beta.i tmp |
64 $ echo blah >> beta | |
65 $ hg ci -m '2 (corrupt)' | |
66 $ mv tmp .hg/store/data/beta.i | |
10418
5fc090ba08a6
localrepo: add optional validation (defaults to off) for incoming changes
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
67 |
12279 | 68 Expected to fail: |
69 | |
70 $ hg verify | |
71 checking changesets | |
72 checking manifests | |
73 crosschecking files in changesets and manifests | |
74 checking files | |
75 beta@1: dddc47b3ba30 in manifests not found | |
76 2 files, 2 changesets, 2 total revisions | |
77 1 integrity errors encountered! | |
78 (first damaged changeset appears to be 1) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
79 [1] |
10418
5fc090ba08a6
localrepo: add optional validation (defaults to off) for incoming changes
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
80 |
12279 | 81 $ hg push |
15447
9910f60a37ee
tests: make (glob) on windows accept \ instead of /
Mads Kiilerich <mads@kiilerich.com>
parents:
12640
diff
changeset
|
82 pushing to $TESTTMP/test (glob) |
12279 | 83 searching for changes |
84 adding changesets | |
85 adding manifests | |
86 adding file changes | |
87 transaction abort! | |
88 rollback completed | |
89 abort: missing file data for beta:dddc47b3ba30e54484720ce0f4f768a0f4b6efb9 - run hg verify | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
90 [255] |
12279 | 91 |
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15447
diff
changeset
|
92 $ cd .. |