changeset 5523:5db730475d6d

tests/*: avoid losing the original settings from $HGRCPATH
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Fri, 09 Nov 2007 20:21:35 -0200
parents f5345a2d2391
children 453acf64f71f
files tests/test-alias tests/test-dispatch tests/test-extension tests/test-trusted.py tests/test-ui-verbosity
diffstat 5 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-alias	Fri Nov 09 20:21:35 2007 -0200
+++ b/tests/test-alias	Fri Nov 09 20:21:35 2007 -0200
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-cat > $HGRCPATH <<EOF
+cat >> $HGRCPATH <<EOF
 [extensions]
 alias=
 
--- a/tests/test-dispatch	Fri Nov 09 20:21:35 2007 -0200
+++ b/tests/test-dispatch	Fri Nov 09 20:21:35 2007 -0200
@@ -11,7 +11,7 @@
 
 echo '% [defaults]'
 hg cat a
-cat > $HGRCPATH <<EOF
+cat >> $HGRCPATH <<EOF
 [defaults]
 cat = -v
 EOF
--- a/tests/test-extension	Fri Nov 09 20:21:35 2007 -0200
+++ b/tests/test-extension	Fri Nov 09 20:21:35 2007 -0200
@@ -47,12 +47,13 @@
 hg clone a b
 
 hg bar
+echo 'foobar = !' >> $HGRCPATH
 
 echo '% module/__init__.py-style'
-echo '[extensions]' > $HGRCPATH
 echo "barfoo = $barfoopath" >> $HGRCPATH
 cd a
 hg foo
+echo 'barfoo = !' >> $HGRCPATH
 
 cd ..
 cat > empty.py <<EOF
@@ -61,9 +62,9 @@
 cmdtable = {}
 EOF
 emptypath=`pwd`/empty.py
-echo '[extensions]' > $HGRCPATH
 echo "empty = $emptypath" >> $HGRCPATH
 hg help empty
+echo 'empty = !' >> $HGRCPATH
 
 cat > debugextension.py <<EOF
 '''only debugcommands
@@ -75,7 +76,7 @@
 cmdtable = {"debugfoobar": (debugfoobar, (), "hg debugfoobar")}
 EOF
 debugpath=`pwd`/debugextension.py
-echo '[extensions]' > $HGRCPATH
 echo "debugextension = $debugpath" >> $HGRCPATH
 hg help debugextension
 hg --debug help debugextension
+echo 'debugextension = !' >> $HGRCPATH
--- a/tests/test-trusted.py	Fri Nov 09 20:21:35 2007 -0200
+++ b/tests/test-trusted.py	Fri Nov 09 20:21:35 2007 -0200
@@ -6,6 +6,9 @@
 from mercurial import ui, util
 
 hgrc = os.environ['HGRCPATH']
+f = open(hgrc)
+basehgrc = f.read()
+f.close()
 
 def testui(user='foo', group='bar', tusers=(), tgroups=(),
            cuser='foo', cgroup='bar', debug=False, silent=False):
@@ -16,7 +19,8 @@
     # write a global hgrc with the list of trusted users/groups and
     # some setting so that we can be sure it was read
     f = open(hgrc, 'w')
-    f.write('[paths]\n')
+    f.write(basehgrc)
+    f.write('\n[paths]\n')
     f.write('global = /some/path\n\n')
 
     if tusers or tgroups:
--- a/tests/test-ui-verbosity	Fri Nov 09 20:21:35 2007 -0200
+++ b/tests/test-ui-verbosity	Fri Nov 09 20:21:35 2007 -0200
@@ -4,6 +4,9 @@
 from mercurial import ui
 
 hgrc = os.environ['HGRCPATH']
+f = open(hgrc)
+basehgrc = f.read()
+f.close()
 
 print '      hgrc settings    command line options      final result   '
 print '    quiet verbo debug   quiet verbo debug      quiet verbo debug'
@@ -17,7 +20,8 @@
     cmd_debug    = bool(i & 1<<5)
 
     f = open(hgrc, 'w')
-    f.write('[ui]\n')
+    f.write(basehgrc)
+    f.write('\n[ui]\n')
     if hgrc_quiet:
         f.write('quiet = True\n')
     if hgrc_verbose: