Mercurial > hg
annotate tests/test-demandimport.py @ 24244:5918bb365c72
patch.pathtransform: add a prefix parameter
This is preparation for upcoming patches that will add support for applying a
patch within a subdirectory.
The prefix is applied after path components are stripped.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Fri, 06 Mar 2015 22:17:24 -0800 |
parents | 2205d00b6d2b |
children | 0d0f4070f6d7 |
rev | line source |
---|---|
4631
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
1 from mercurial import demandimport |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 demandimport.enable() |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
3 |
23643
2205d00b6d2b
demandimport: blacklist distutils.msvc9compiler (issue4475)
Augie Fackler <raf@durin42.com>
parents:
21025
diff
changeset
|
4 import os |
2205d00b6d2b
demandimport: blacklist distutils.msvc9compiler (issue4475)
Augie Fackler <raf@durin42.com>
parents:
21025
diff
changeset
|
5 if os.name != 'nt': |
2205d00b6d2b
demandimport: blacklist distutils.msvc9compiler (issue4475)
Augie Fackler <raf@durin42.com>
parents:
21025
diff
changeset
|
6 try: |
2205d00b6d2b
demandimport: blacklist distutils.msvc9compiler (issue4475)
Augie Fackler <raf@durin42.com>
parents:
21025
diff
changeset
|
7 import distutils.msvc9compiler |
2205d00b6d2b
demandimport: blacklist distutils.msvc9compiler (issue4475)
Augie Fackler <raf@durin42.com>
parents:
21025
diff
changeset
|
8 print ('distutils.msvc9compiler needs to be an immediate ' |
2205d00b6d2b
demandimport: blacklist distutils.msvc9compiler (issue4475)
Augie Fackler <raf@durin42.com>
parents:
21025
diff
changeset
|
9 'importerror on non-windows platforms') |
2205d00b6d2b
demandimport: blacklist distutils.msvc9compiler (issue4475)
Augie Fackler <raf@durin42.com>
parents:
21025
diff
changeset
|
10 distutils.msvc9compiler |
2205d00b6d2b
demandimport: blacklist distutils.msvc9compiler (issue4475)
Augie Fackler <raf@durin42.com>
parents:
21025
diff
changeset
|
11 except ImportError: |
2205d00b6d2b
demandimport: blacklist distutils.msvc9compiler (issue4475)
Augie Fackler <raf@durin42.com>
parents:
21025
diff
changeset
|
12 pass |
2205d00b6d2b
demandimport: blacklist distutils.msvc9compiler (issue4475)
Augie Fackler <raf@durin42.com>
parents:
21025
diff
changeset
|
13 |
4631
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
14 import re |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
15 |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
16 rsub = re.sub |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
17 def f(obj): |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
18 l = repr(obj) |
4802
3a4310e8fe72
test-demandimport: match upper-case hexadecimal
Patrick Mezard <pmezard@gmail.com>
parents:
4631
diff
changeset
|
19 l = rsub("0x[0-9a-fA-F]+", "0x?", l) |
4631
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
20 l = rsub("from '.*'", "from '?'", l) |
13083
c0290fc6b486
test-demandimport.py: PyPy support
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
12865
diff
changeset
|
21 l = rsub("'<[a-z]*>'", "'<whatever>'", l) |
4631
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
22 return l |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
23 |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
24 import os |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
25 |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
26 print "os =", f(os) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
27 print "os.system =", f(os.system) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
28 print "os =", f(os) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
29 |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
30 from mercurial import util |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
31 |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
32 print "util =", f(util) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
33 print "util.system =", f(util.system) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
34 print "util =", f(util) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
35 print "util.system =", f(util.system) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
36 |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
37 import re as fred |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
38 print "fred =", f(fred) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
39 |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
40 import sys as re |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
41 print "re =", f(re) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
42 |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
43 print "fred =", f(fred) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
44 print "fred.sub =", f(fred.sub) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
45 print "fred =", f(fred) |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
46 |
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
47 print "re =", f(re) |
9174
705278e70457
Fix test-demandimport and test-trusted under Windows
James Abbatiello <abbeyj at gmail.com>
parents:
8449
diff
changeset
|
48 print "re.stderr =", f(re.stderr) |
4631
e3afa670e484
demandimport: fix issue579 and add a test
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
49 print "re =", f(re) |
21025
54af51c18c4c
demandimport: make it possible to disable by setting HGDEMANDIMPORT=disable
Mads Kiilerich <madski@unity3d.com>
parents:
13083
diff
changeset
|
50 |
54af51c18c4c
demandimport: make it possible to disable by setting HGDEMANDIMPORT=disable
Mads Kiilerich <madski@unity3d.com>
parents:
13083
diff
changeset
|
51 demandimport.disable() |
54af51c18c4c
demandimport: make it possible to disable by setting HGDEMANDIMPORT=disable
Mads Kiilerich <madski@unity3d.com>
parents:
13083
diff
changeset
|
52 os.environ['HGDEMANDIMPORT'] = 'disable' |
54af51c18c4c
demandimport: make it possible to disable by setting HGDEMANDIMPORT=disable
Mads Kiilerich <madski@unity3d.com>
parents:
13083
diff
changeset
|
53 demandimport.enable() |
54af51c18c4c
demandimport: make it possible to disable by setting HGDEMANDIMPORT=disable
Mads Kiilerich <madski@unity3d.com>
parents:
13083
diff
changeset
|
54 from mercurial import node |
54af51c18c4c
demandimport: make it possible to disable by setting HGDEMANDIMPORT=disable
Mads Kiilerich <madski@unity3d.com>
parents:
13083
diff
changeset
|
55 print "node =", f(node) |