##// END OF EJS Templates
tests/*: avoid losing the original settings from $HGRCPATH
Alexis S. L. Carvalho -
r5523:5db73047 default
parent child Browse files
Show More
@@ -1,6 +1,6 b''
1 #!/bin/sh
1 #!/bin/sh
2
2
3 cat > $HGRCPATH <<EOF
3 cat >> $HGRCPATH <<EOF
4 [extensions]
4 [extensions]
5 alias=
5 alias=
6
6
@@ -11,7 +11,7 b' hg cat'
11
11
12 echo '% [defaults]'
12 echo '% [defaults]'
13 hg cat a
13 hg cat a
14 cat > $HGRCPATH <<EOF
14 cat >> $HGRCPATH <<EOF
15 [defaults]
15 [defaults]
16 cat = -v
16 cat = -v
17 EOF
17 EOF
@@ -47,12 +47,13 b' cd ..'
47 hg clone a b
47 hg clone a b
48
48
49 hg bar
49 hg bar
50 echo 'foobar = !' >> $HGRCPATH
50
51
51 echo '% module/__init__.py-style'
52 echo '% module/__init__.py-style'
52 echo '[extensions]' > $HGRCPATH
53 echo "barfoo = $barfoopath" >> $HGRCPATH
53 echo "barfoo = $barfoopath" >> $HGRCPATH
54 cd a
54 cd a
55 hg foo
55 hg foo
56 echo 'barfoo = !' >> $HGRCPATH
56
57
57 cd ..
58 cd ..
58 cat > empty.py <<EOF
59 cat > empty.py <<EOF
@@ -61,9 +62,9 b' cat > empty.py <<EOF'
61 cmdtable = {}
62 cmdtable = {}
62 EOF
63 EOF
63 emptypath=`pwd`/empty.py
64 emptypath=`pwd`/empty.py
64 echo '[extensions]' > $HGRCPATH
65 echo "empty = $emptypath" >> $HGRCPATH
65 echo "empty = $emptypath" >> $HGRCPATH
66 hg help empty
66 hg help empty
67 echo 'empty = !' >> $HGRCPATH
67
68
68 cat > debugextension.py <<EOF
69 cat > debugextension.py <<EOF
69 '''only debugcommands
70 '''only debugcommands
@@ -75,7 +76,7 b' def debugfoobar(ui, repo, *args, **opts)'
75 cmdtable = {"debugfoobar": (debugfoobar, (), "hg debugfoobar")}
76 cmdtable = {"debugfoobar": (debugfoobar, (), "hg debugfoobar")}
76 EOF
77 EOF
77 debugpath=`pwd`/debugextension.py
78 debugpath=`pwd`/debugextension.py
78 echo '[extensions]' > $HGRCPATH
79 echo "debugextension = $debugpath" >> $HGRCPATH
79 echo "debugextension = $debugpath" >> $HGRCPATH
80 hg help debugextension
80 hg help debugextension
81 hg --debug help debugextension
81 hg --debug help debugextension
82 echo 'debugextension = !' >> $HGRCPATH
@@ -6,6 +6,9 b' import os'
6 from mercurial import ui, util
6 from mercurial import ui, util
7
7
8 hgrc = os.environ['HGRCPATH']
8 hgrc = os.environ['HGRCPATH']
9 f = open(hgrc)
10 basehgrc = f.read()
11 f.close()
9
12
10 def testui(user='foo', group='bar', tusers=(), tgroups=(),
13 def testui(user='foo', group='bar', tusers=(), tgroups=(),
11 cuser='foo', cgroup='bar', debug=False, silent=False):
14 cuser='foo', cgroup='bar', debug=False, silent=False):
@@ -16,7 +19,8 b" def testui(user='foo', group='bar', tuse"
16 # write a global hgrc with the list of trusted users/groups and
19 # write a global hgrc with the list of trusted users/groups and
17 # some setting so that we can be sure it was read
20 # some setting so that we can be sure it was read
18 f = open(hgrc, 'w')
21 f = open(hgrc, 'w')
19 f.write('[paths]\n')
22 f.write(basehgrc)
23 f.write('\n[paths]\n')
20 f.write('global = /some/path\n\n')
24 f.write('global = /some/path\n\n')
21
25
22 if tusers or tgroups:
26 if tusers or tgroups:
@@ -4,6 +4,9 b' import os'
4 from mercurial import ui
4 from mercurial import ui
5
5
6 hgrc = os.environ['HGRCPATH']
6 hgrc = os.environ['HGRCPATH']
7 f = open(hgrc)
8 basehgrc = f.read()
9 f.close()
7
10
8 print ' hgrc settings command line options final result '
11 print ' hgrc settings command line options final result '
9 print ' quiet verbo debug quiet verbo debug quiet verbo debug'
12 print ' quiet verbo debug quiet verbo debug quiet verbo debug'
@@ -17,7 +20,8 b' for i in xrange(64):'
17 cmd_debug = bool(i & 1<<5)
20 cmd_debug = bool(i & 1<<5)
18
21
19 f = open(hgrc, 'w')
22 f = open(hgrc, 'w')
20 f.write('[ui]\n')
23 f.write(basehgrc)
24 f.write('\n[ui]\n')
21 if hgrc_quiet:
25 if hgrc_quiet:
22 f.write('quiet = True\n')
26 f.write('quiet = True\n')
23 if hgrc_verbose:
27 if hgrc_verbose:
General Comments 0
You need to be logged in to leave comments. Login now