Mercurial > hg
changeset 5528:6ffca2bf23da
merge with crew-stable
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 09 Nov 2007 21:24:25 -0200 |
parents | b11c855cde96 (current diff) 0b3f910dfd17 (diff) |
children | 5499dbb445de |
files | hgext/convert/__init__.py hgext/convert/cvs.py hgext/convert/darcs.py hgext/convert/git.py hgext/convert/subversion.py |
diffstat | 29 files changed, 192 insertions(+), 83 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/convert/__init__.py Wed Nov 07 21:13:56 2007 -0600 +++ b/hgext/convert/__init__.py Fri Nov 09 21:24:25 2007 -0200 @@ -33,12 +33,16 @@ ] def convertsource(ui, path, type, rev): + exceptions = [] for name, source in source_converters: try: if not type or name == type: return source(ui, path, rev) except NoRepo, inst: - ui.note(_("convert: %s\n") % inst) + exceptions.append(inst) + if not ui.quiet: + for inst in exceptions: + ui.write(_("%s\n") % inst) raise util.Abort('%s: unknown repository type' % path) def convertsink(ui, path, type):
--- a/hgext/convert/cvs.py Wed Nov 07 21:13:56 2007 -0600 +++ b/hgext/convert/cvs.py Fri Nov 09 21:24:25 2007 -0200 @@ -11,7 +11,7 @@ cvs = os.path.join(path, "CVS") if not os.path.exists(cvs): - raise NoRepo("couldn't open CVS repo %s" % path) + raise NoRepo("%s does not look like a CVS checkout" % path) for tool in ('cvsps', 'cvs'): checktool(tool)
--- a/hgext/convert/darcs.py Wed Nov 07 21:13:56 2007 -0600 +++ b/hgext/convert/darcs.py Fri Nov 09 21:24:25 2007 -0200 @@ -22,14 +22,19 @@ converter_source.__init__(self, ui, path, rev=rev) commandline.__init__(self, ui, 'darcs') - if not os.path.exists(os.path.join(path, '_darcs', 'inventory')): - raise NoRepo("couldn't open darcs repo %s" % path) + # check for _darcs, ElementTree, _darcs/inventory so that we can + # easily skip test-convert-darcs if ElementTree is not around + if not os.path.exists(os.path.join(path, '_darcs')): + raise NoRepo("%s does not look like a darcs repo" % path) checktool('darcs') if ElementTree is None: raise util.Abort(_("Python ElementTree module is not available")) + if not os.path.exists(os.path.join(path, '_darcs', 'inventory')): + raise NoRepo("%s does not look like a darcs repo" % path) + self.path = os.path.realpath(path) self.lastrev = None
--- a/hgext/convert/git.py Wed Nov 07 21:13:56 2007 -0600 +++ b/hgext/convert/git.py Fri Nov 09 21:24:25 2007 -0200 @@ -30,7 +30,7 @@ if os.path.isdir(path + "/.git"): path += "/.git" if not os.path.exists(path + "/objects"): - raise NoRepo("couldn't open GIT repo %s" % path) + raise NoRepo("%s does not look like a Git repo" % path) checktool('git-rev-parse', 'git')
--- a/hgext/convert/hg.py Wed Nov 07 21:13:56 2007 -0600 +++ b/hgext/convert/hg.py Fri Nov 09 21:24:25 2007 -0200 @@ -187,10 +187,11 @@ self.repo = hg.repository(self.ui, path) # try to provoke an exception if this isn't really a hg # repo, but some other bogus compatible-looking url - self.repo.heads() + if not self.repo.local(): + raise hg.RepoError() except hg.RepoError: ui.print_exc() - raise NoRepo("could not open hg repo %s as source" % path) + raise NoRepo("%s is not a local Mercurial repo" % path) self.lastrev = None self.lastctx = None self._changescache = None
--- a/hgext/convert/subversion.py Wed Nov 07 21:13:56 2007 -0600 +++ b/hgext/convert/subversion.py Fri Nov 09 21:24:25 2007 -0200 @@ -107,7 +107,7 @@ try: SubversionException except NameError: - raise NoRepo('subversion python bindings could not be loaded') + raise NoRepo('Subversion python bindings could not be loaded') self.encoding = locale.getpreferredencoding() self.lastrevs = {} @@ -136,7 +136,7 @@ self.uuid = svn.ra.get_uuid(self.ra).decode(self.encoding) except SubversionException, e: ui.print_exc() - raise NoRepo("couldn't open SVN repo %s" % self.url) + raise NoRepo("%s does not look like a Subversion repo" % self.url) if rev: try:
--- a/hgext/mq.py Wed Nov 07 21:13:56 2007 -0600 +++ b/hgext/mq.py Fri Nov 09 21:24:25 2007 -0200 @@ -456,6 +456,7 @@ raise finally: del tr, lock, wlock + self.removeundo(repo) def _apply(self, repo, series, list=False, update_status=True, strict=False, patchdir=None, merge=None, all_files={}): @@ -527,7 +528,6 @@ self.ui.warn("fuzz found when applying patch, stopping\n") err = 1 break - self.removeundo(repo) return (err, n) def delete(self, repo, patches, opts): @@ -654,6 +654,9 @@ self.removeundo(repo) repair.strip(self.ui, repo, rev, backup) + # strip may have unbundled a set of backed up revisions after + # the actual strip + self.removeundo(repo) finally: del lock, wlock
--- a/hgext/purge.py Wed Nov 07 21:13:56 2007 -0600 +++ b/hgext/purge.py Fri Nov 09 21:24:25 2007 -0200 @@ -49,6 +49,9 @@ else: ui.write('%s%s' % (name, eol)) + if not force: + _check_fs(ui, repo) + directories = [] files = [] missing = [] @@ -63,8 +66,6 @@ elif src == 'f' and f not in repo.dirstate: files.append(f) - _check_missing(ui, repo, missing, force) - directories.sort() for f in files: @@ -77,7 +78,7 @@ ui.note(_('Removing directory %s\n') % f) remove(os.rmdir, f) -def _check_missing(ui, repo, missing, force=False): +def _check_fs(ui, repo): """Abort if there is the chance of having problems with name-mangling fs In a name mangling filesystem (e.g. a case insensitive one) @@ -85,34 +86,18 @@ stored in the dirstate. This already confuses the status and add commands, but with purge this may cause data loss. - To prevent this, _check_missing will abort if there are missing - files. The force option will let the user skip the check if he - knows it is safe. - - Even with the force option this function will check if any of the - missing files is still available in the working dir: if so there - may be some problem with the underlying filesystem, so it - aborts unconditionally.""" - - found = [f for f in missing if util.lexists(repo.wjoin(f))] + To prevent this, this function will abort if there are uncommitted + changes. + """ - if found: - if not ui.quiet: - ui.warn(_("The following tracked files weren't listed by the " - "filesystem, but could still be found:\n")) - for f in found: - ui.warn("%s\n" % f) - if util.checkfolding(repo.path): - ui.warn(_("This is probably due to a case-insensitive " - "filesystem\n")) - raise util.Abort(_("purging on name mangling filesystems is not " - "yet fully supported")) - - if missing and not force: - raise util.Abort(_("there are missing files in the working dir and " - "purge still has problems with them due to name " - "mangling filesystems. " - "Use --force if you know what you are doing")) + # We can't use (files, match) to do a partial walk here - we wouldn't + # notice a modified README file if the user ran "hg purge readme" + modified, added, removed, deleted = repo.status()[:4] + if modified or added or removed or deleted: + if not util.checkfolding(repo.path) and not ui.quiet: + ui.warn(_("Purging on name mangling filesystems is not " + "fully supported.\n")) + raise util.Abort(_("outstanding uncommitted changes")) def purge(ui, repo, *dirs, **opts): @@ -158,7 +143,7 @@ (purge, [('a', 'abort-on-err', None, _('abort if an error occurs')), ('', 'all', None, _('purge ignored files too')), - ('f', 'force', None, _('purge even when missing files are detected')), + ('f', 'force', None, _('purge even when there are uncommitted changes')), ('p', 'print', None, _('print the file names instead of deleting them')), ('0', 'print0', None, _('end filenames with NUL, for use with xargs' ' (implies -p)')),
--- a/mercurial/commands.py Wed Nov 07 21:13:56 2007 -0600 +++ b/mercurial/commands.py Fri Nov 09 21:24:25 2007 -0200 @@ -1652,7 +1652,7 @@ cmdutil.setremoteconfig(ui, opts) other = hg.repository(ui, source) - ui.status(_('comparing with %s\n') % source) + ui.status(_('comparing with %s\n') % util.hidepassword(source)) if revs: revs = [other.lookup(rev) for rev in revs] incoming = repo.findincoming(other, heads=revs, force=opts["force"]) @@ -1962,7 +1962,7 @@ revs = [repo.lookup(rev) for rev in revs] other = hg.repository(ui, dest) - ui.status(_('comparing with %s\n') % dest) + ui.status(_('comparing with %s\n') % util.hidepassword(dest)) o = repo.findoutgoing(other, force=opts['force']) if not o: ui.status(_("no changes found\n")) @@ -2095,7 +2095,7 @@ cmdutil.setremoteconfig(ui, opts) other = hg.repository(ui, source) - ui.status(_('pulling from %s\n') % (source)) + ui.status(_('pulling from %s\n') % util.hidepassword(source)) if revs: try: revs = [other.lookup(rev) for rev in revs] @@ -2142,7 +2142,7 @@ cmdutil.setremoteconfig(ui, opts) other = hg.repository(ui, dest) - ui.status('pushing to %s\n' % (dest)) + ui.status('pushing to %s\n' % util.hidepassword(dest)) if revs: revs = [repo.lookup(rev) for rev in revs] r = repo.push(other, opts['force'], revs=revs)
--- a/mercurial/dirstate.py Wed Nov 07 21:13:56 2007 -0600 +++ b/mercurial/dirstate.py Fri Nov 09 21:24:25 2007 -0200 @@ -185,16 +185,15 @@ dirs[base] += 1 def _decpath(self, path): - if "_dirs" in self.__dict__: - c = path.rfind('/') - if c >= 0: - base = path[:c] - dirs = self._dirs - if dirs[base] == 1: - del dirs[base] - self._decpath(base) - else: - dirs[base] -= 1 + c = path.rfind('/') + if c >= 0: + base = path[:c] + dirs = self._dirs + if dirs[base] == 1: + del dirs[base] + self._decpath(base) + else: + dirs[base] -= 1 def _incpathcheck(self, f): if '\r' in f or '\n' in f: @@ -211,20 +210,29 @@ (d, f)) self._incpath(f) - def _changepath(self, f, newstate): + def _changepath(self, f, newstate, relaxed=False): # handle upcoming path changes oldstate = self[f] if oldstate not in "?r" and newstate in "?r": - self._decpath(f) + if "_dirs" in self.__dict__: + self._decpath(f) return if oldstate in "?r" and newstate not in "?r": + if relaxed and oldstate == '?': + # XXX + # in relaxed mode we assume the caller knows + # what it is doing, workaround for updating + # dir-to-file revisions + if "_dirs" in self.__dict__: + self._incpath(f) + return self._incpathcheck(f) return def normal(self, f): 'mark a file normal and clean' self._dirty = True - self._changepath(f, 'n') + self._changepath(f, 'n', True) s = os.lstat(self._join(f)) self._map[f] = ('n', s.st_mode, s.st_size, s.st_mtime, 0) if self._copymap.has_key(f): @@ -233,7 +241,7 @@ def normallookup(self, f): 'mark a file normal, but possibly dirty' self._dirty = True - self._changepath(f, 'n') + self._changepath(f, 'n', True) self._map[f] = ('n', 0, -1, -1, 0) if f in self._copymap: del self._copymap[f] @@ -241,7 +249,7 @@ def normaldirty(self, f): 'mark a file normal, but dirty' self._dirty = True - self._changepath(f, 'n') + self._changepath(f, 'n', True) self._map[f] = ('n', 0, -2, -1, 0) if f in self._copymap: del self._copymap[f] @@ -266,7 +274,7 @@ 'mark a file merged' self._dirty = True s = os.lstat(self._join(f)) - self._changepath(f, 'm') + self._changepath(f, 'm', True) self._map[f] = ('m', s.st_mode, s.st_size, s.st_mtime, 0) if f in self._copymap: del self._copymap[f]
--- a/mercurial/httprepo.py Wed Nov 07 21:13:56 2007 -0600 +++ b/mercurial/httprepo.py Fri Nov 09 21:24:25 2007 -0200 @@ -256,7 +256,11 @@ if user: ui.debug(_('http auth: user %s, password %s\n') % (user, passwd and '*' * len(passwd) or 'not set')) - passmgr.add_password(None, host, user, passwd or '') + netloc = host + if port: + netloc += ':' + port + # Python < 2.4.3 uses only the netloc to search for a password + passmgr.add_password(None, (self._url, netloc), user, passwd or '') handlers.extend((urllib2.HTTPBasicAuthHandler(passmgr), httpdigestauthhandler(passmgr)))
--- a/mercurial/util.py Wed Nov 07 21:13:56 2007 -0600 +++ b/mercurial/util.py Fri Nov 09 21:24:25 2007 -0200 @@ -15,6 +15,7 @@ from i18n import _ import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile, strutil import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil +import re, urlparse try: set = set @@ -1698,3 +1699,33 @@ def uirepr(s): # Avoid double backslash in Windows path repr() return repr(s).replace('\\\\', '\\') + +def hidepassword(url): + '''replaces the password in the url string by three asterisks (***) + + >>> hidepassword('http://www.example.com/some/path#fragment') + 'http://www.example.com/some/path#fragment' + >>> hidepassword('http://me@www.example.com/some/path#fragment') + 'http://me@www.example.com/some/path#fragment' + >>> hidepassword('http://me:simplepw@www.example.com/path#frag') + 'http://me:***@www.example.com/path#frag' + >>> hidepassword('http://me:complex:pw@www.example.com/path#frag') + 'http://me:***@www.example.com/path#frag' + >>> hidepassword('/path/to/repo') + '/path/to/repo' + >>> hidepassword('relative/path/to/repo') + 'relative/path/to/repo' + >>> hidepassword('c:\\\\path\\\\to\\\\repo') + 'c:\\\\path\\\\to\\\\repo' + >>> hidepassword('c:/path/to/repo') + 'c:/path/to/repo' + >>> hidepassword('bundle://path/to/bundle') + 'bundle://path/to/bundle' + ''' + url_parts = list(urlparse.urlparse(url)) + host_with_pw_pattern = re.compile('^([^:]*):([^@]*)@(.*)$') + if host_with_pw_pattern.match(url_parts[1]): + url_parts[1] = re.sub(host_with_pw_pattern, r'\1:***@\3', + url_parts[1]) + return urlparse.urlunparse(url_parts) +
--- a/tests/run-tests.py Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/run-tests.py Fri Nov 09 21:24:25 2007 -0200 @@ -266,8 +266,6 @@ def skip(msg): if not verbose: skips.append((test, msg)) - sys.stdout.write('s') - sys.stdout.flush() else: print "\nSkipping %s: %s" % (test, msg) return None @@ -278,6 +276,11 @@ hgrc = file(HGRCPATH, 'w+') hgrc.write('[ui]\n') hgrc.write('slash = True\n') + hgrc.write('[defaults]\n') + hgrc.write('backout = -d "0 0"\n') + hgrc.write('commit = -d "0 0"\n') + hgrc.write('debugrawcommit = -d "0 0"\n') + hgrc.write('tag = -d "0 0"\n') hgrc.close() err = os.path.join(TESTDIR, test+".err") @@ -352,7 +355,7 @@ ret = diffret if not verbose: - sys.stdout.write('.') + sys.stdout.write(skipped and 's' or '.') sys.stdout.flush() if ret != 0 and not skipped:
--- a/tests/test-alias Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-alias Fri Nov 09 21:24:25 2007 -0200 @@ -1,6 +1,6 @@ #!/bin/sh -cat > $HGRCPATH <<EOF +cat >> $HGRCPATH <<EOF [extensions] alias=
--- a/tests/test-archive-symlinks Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-archive-symlinks Fri Nov 09 21:24:25 2007 -0200 @@ -15,7 +15,8 @@ hg init repo cd repo ln -s nothing dangling -hg ci -qAm 'add symlink' +# avoid tar warnings about old timestamp +hg ci -d '2000-01-01 00:00:00 +0000' -qAm 'add symlink' hg archive -t files ../archive hg archive -t tar -p tar ../archive.tar
--- a/tests/test-convert-darcs Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-convert-darcs Fri Nov 09 21:24:25 2007 -0200 @@ -9,6 +9,14 @@ DARCS_EMAIL='test@example.org'; export DARCS_EMAIL HOME=do_not_use_HOME_darcs; export HOME +# skip if we can't import elementtree +mkdir dummy +mkdir dummy/_darcs +if hg convert dummy 2>&1 | grep ElementTree > /dev/null; then + echo 'hghave: missing feature: elementtree module' + exit 80 +fi + echo % initialize darcs repo mkdir darcs-repo cd darcs-repo
--- a/tests/test-dispatch Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-dispatch Fri Nov 09 21:24:25 2007 -0200 @@ -11,7 +11,7 @@ echo '% [defaults]' hg cat a -cat > $HGRCPATH <<EOF +cat >> $HGRCPATH <<EOF [defaults] cat = -v EOF
--- a/tests/test-doctest.py Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-doctest.py Fri Nov 09 21:24:25 2007 -0200 @@ -7,3 +7,6 @@ import mercurial.httprepo doctest.testmod(mercurial.httprepo) + +import mercurial.util +doctest.testmod(mercurial.util)
--- a/tests/test-extension Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-extension Fri Nov 09 21:24:25 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-issue660 Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-issue660 Fri Nov 09 21:24:25 2007 -0200 @@ -80,10 +80,15 @@ echo % should succeed - shadow removed hg add d +hg ci -md -#echo % update should work -# -#hg up -r 0 -#hg up -r 1 +echo % update should work at least with clean workdir + +rm -r a b d +hg up -r 0 +hg st --all +rm -r a b +hg up -r 1 +hg st --all exit 0
--- a/tests/test-issue660.out Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-issue660.out Fri Nov 09 21:24:25 2007 -0200 @@ -40,3 +40,10 @@ abort: directory 'd' already in dirstate % removing shadow % should succeed - shadow removed +% update should work at least with clean workdir +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +C a +C b/b +2 files updated, 0 files merged, 0 files removed, 0 files unresolved +C a/a +C b
--- a/tests/test-mq Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-mq Fri Nov 09 21:24:25 2007 -0200 @@ -1,5 +1,12 @@ #!/bin/sh +checkundo() +{ + if [ -f .hg/store/undo ]; then + echo ".hg/store/undo still exists after $1" + fi +} + echo "[extensions]" >> $HGRCPATH echo "mq=" >> $HGRCPATH @@ -57,6 +64,7 @@ hg init e cd e hg qnew A +checkundo qnew echo foo > foo hg add foo hg qrefresh @@ -100,14 +108,17 @@ hg diff --nodates -q # restore things hg qrefresh +checkundo qrefresh echo % qpop hg qpop +checkundo qpop echo % qpush hg qpush +checkundo qpush cd .. @@ -394,6 +405,7 @@ hg ci -m merge -d '0 0' hg log hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/' +checkundo strip hg log cd ..
--- a/tests/test-mq-merge Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-mq-merge Fri Nov 09 21:24:25 2007 -0200 @@ -7,6 +7,13 @@ sed -e 's:\\:/:g' -e 's:[^ ]*/t/::g' } +checkundo() +{ + if [ -f .hg/store/undo ]; then + echo ".hg/store/undo still exists after $1" + fi +} + echo "[extensions]" >> $HGRCPATH echo "hgext.mq=" >> $HGRCPATH @@ -25,6 +32,7 @@ # Save the patch queue so we can merge it later hg qsave -c -e 2>&1 | rewrite_path +checkundo qsave # Update b and commit in an "update" changeset hg up -C init @@ -36,6 +44,7 @@ # The system cannot find the file specified => a hg manifest hg qpush -a -m 2>&1 | rewrite_path +checkundo 'qpush -m' hg manifest # ensure status is correct after merge
--- a/tests/test-permissions Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-permissions Fri Nov 09 21:24:25 2007 -0200 @@ -13,5 +13,6 @@ chmod -w .hg/store/data/a.i echo barber > a hg commit -m "2" -d "1000000 0" 2>/dev/null || echo commit failed -chmod -w ../t +chmod -w . hg diff --nodates +chmod +w .
--- a/tests/test-purge Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-purge Fri Nov 09 21:24:25 2007 -0200 @@ -101,6 +101,13 @@ hg revert --all --quiet ls +echo '% tracked file in ignored directory (issue621)' +echo directory >> .hgignore +hg ci -m 'ignore directory' +touch untracked_file +hg purge -p +hg purge -v + echo % skip excluded files touch excluded_file hg purge -p -X excluded_file
--- a/tests/test-purge.out Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-purge.out Fri Nov 09 21:24:25 2007 -0200 @@ -59,6 +59,9 @@ Removing file untracked_file directory r1 +% tracked file in ignored directory (issue621) +untracked_file +Removing file untracked_file % skip excluded files directory excluded_file
--- a/tests/test-tags Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-tags Fri Nov 09 21:24:25 2007 -0200 @@ -116,13 +116,13 @@ cd t4 echo foo > foo hg add -hg ci -m 'add foo' -d '0 0' # rev 0 -hg tag -d '0 0' bar # rev 1 bar -> 0 -hg tag -d '0 0' -f bar # rev 2 bar -> 1 +hg ci -m 'add foo' # rev 0 +hg tag bar # rev 1 bar -> 0 +hg tag -f bar # rev 2 bar -> 1 hg up -qC 0 -hg tag -d '0 0' -fr 2 bar # rev 3 bar -> 2 +hg tag -fr 2 bar # rev 3 bar -> 2 hg tags hg up -qC 0 -hg tag -d '0 0' -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2 +hg tag -m 'retag rev 0' -fr 0 bar # rev 4 bar -> 0, but bar stays at 2 echo % bar should still point to rev 2 hg tags
--- a/tests/test-trusted.py Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-trusted.py Fri Nov 09 21:24:25 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 Wed Nov 07 21:13:56 2007 -0600 +++ b/tests/test-ui-verbosity Fri Nov 09 21:24:25 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: