Mercurial > hg
changeset 1586:5c5aaaa9ab6f
Merge with upstream.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Thu, 15 Dec 2005 15:39:20 +0100 |
parents | d7c4b9bfcc94 (diff) db10b7114de0 (current diff) |
children | 851bc33ff545 |
files | mercurial/commands.py mercurial/localrepo.py |
diffstat | 6 files changed, 78 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/hgrc.5.txt Wed Dec 14 22:19:03 2005 -0600 +++ b/doc/hgrc.5.txt Thu Dec 15 15:39:20 2005 +0100 @@ -15,26 +15,38 @@ FILES ----- -Mercurial reads configuration data from up to three files, if they -exist. The names of these files depend on the system on which -Mercurial is installed. +Mercurial reads configuration data from several files, if they exist. +The names of these files depend on the system on which Mercurial is +installed. +(Unix) <install-root>/etc/mercurial/hgrc.d/*.rc:: +(Unix) <install-root>/etc/mercurial/hgrc:: + Per-installation configuration files, searched for in the + directory where Mercurial is installed. For example, if installed + in /shared/tools, Mercurial will look in + /shared/tools/etc/mercurial/hgrc. Options in these files apply to + all Mercurial commands executed by any user in any directory. + +(Unix) /etc/mercurial/hgrc.d/*.rc:: (Unix) /etc/mercurial/hgrc:: (Windows) C:\Mercurial\Mercurial.ini:: - Options in this global configuration file apply to all Mercurial - commands executed by any user in any directory. + Per-system configuration files, for the system on which Mercurial + is running. Options in these files apply to all Mercurial + commands executed by any user in any directory. Options in these + files override per-installation options. (Unix) $HOME/.hgrc:: (Windows) C:\Documents and Settings\USERNAME\Mercurial.ini - Per-user configuration options that apply to all Mercurial commands, - no matter from which directory they are run. Values in this file - override global settings. + Per-user configuration file, for the user running Mercurial. + Options in this file apply to all Mercurial commands executed by + any user in any directory. Options in this file override + per-installation and per-system options. (Unix, Windows) <repo>/.hg/hgrc:: Per-repository configuration options that only apply in a particular repository. This file is not version-controlled, and - will not get transferred during a "clone" operation. Values in - this file override global and per-user settings. + will not get transferred during a "clone" operation. Options in + this file override options in all other configuration files. SYNTAX ------
--- a/mercurial/commands.py Wed Dec 14 22:19:03 2005 -0600 +++ b/mercurial/commands.py Thu Dec 15 15:39:20 2005 +0100 @@ -42,16 +42,16 @@ return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'), opts.get('exclude'), head) + (cwd,) -def makewalk(repo, pats, opts, head=''): +def makewalk(repo, pats, opts, node=None, head=''): files, matchfn, anypats, cwd = matchpats(repo, pats, opts, head) exact = dict(zip(files, files)) def walk(): - for src, fn in repo.walk(files=files, match=matchfn): + for src, fn in repo.walk(node=node, files=files, match=matchfn): yield src, fn, util.pathto(cwd, fn), fn in exact return files, matchfn, walk() -def walk(repo, pats, opts, head=''): - files, matchfn, results = makewalk(repo, pats, opts, head) +def walk(repo, pats, opts, node=None, head=''): + files, matchfn, results = makewalk(repo, pats, opts, node, head) for r in results: yield r @@ -635,20 +635,14 @@ mf = {} rev = opts['rev'] if rev: - change = repo.changelog.read(repo.lookup(rev)) - mf = repo.manifest.read(change[0]) - for src, abs, rel, exact in walk(repo, (file1,) + pats, opts): + node = repo.lookup(rev) + else: + node = repo.changelog.tip() + change = repo.changelog.read(node) + mf = repo.manifest.read(change[0]) + for src, abs, rel, exact in walk(repo, (file1,) + pats, opts, node): r = repo.file(abs) - if rev: - try: - n = mf[abs] - except (hg.RepoError, KeyError): - try: - n = r.lookup(rev) - except KeyError, inst: - raise util.Abort(_('cannot find file %s in rev %s'), rel, rev) - else: - n = r.tip() + n = mf[abs] fp = make_file(repo, r, opts['output'], node=n, pathname=abs) fp.write(r.read(n))
--- a/mercurial/localrepo.py Wed Dec 14 22:19:03 2005 -0600 +++ b/mercurial/localrepo.py Thu Dec 15 15:39:20 2005 +0100 @@ -462,8 +462,14 @@ def walk(self, node=None, files=[], match=util.always): if node: + fdict = dict.fromkeys(files) for fn in self.manifest.read(self.changelog.read(node)[0]): - if match(fn): yield 'm', fn + fdict.pop(fn, None) + if match(fn): + yield 'm', fn + for fn in fdict: + self.ui.warn(_('%s: No such file in rev %s\n') % ( + util.pathto(self.getcwd(), fn), short(node))) else: for src, fn in self.dirstate.walk(files, match): yield src, fn
--- a/mercurial/util.py Wed Dec 14 22:19:03 2005 -0600 +++ b/mercurial/util.py Thu Dec 15 15:39:20 2005 +0100 @@ -13,7 +13,7 @@ import os, errno from i18n import gettext as _ from demandload import * -demandload(globals(), "re cStringIO shutil popen2 tempfile threading time") +demandload(globals(), "re cStringIO shutil popen2 sys tempfile threading time") def pipefilter(s, cmd): '''filter string S through command CMD, returning its output''' @@ -510,12 +510,18 @@ else: nulldev = '/dev/null' - hgrcd = '/etc/mercurial/hgrc.d' - hgrcs = [] - if os.path.isdir(hgrcd): - hgrcs = [f for f in os.listdir(hgrcd) if f.endswith(".rc")] - rcpath = map(os.path.normpath, hgrcs + - ['/etc/mercurial/hgrc', os.path.expanduser('~/.hgrc')]) + def rcfiles(path): + rcs = [os.path.join(path, 'hgrc')] + rcdir = os.path.join(path, 'hgrc.d') + try: + rcs.extend([os.path.join(rcdir, f) for f in os.listdir(rcdir) + if f.endswith(".rc")]) + except OSError, inst: pass + return rcs + rcpath = rcfiles(os.path.dirname(sys.argv[0]) + '/../etc/mercurial') + rcpath.extend(rcfiles('/etc/mercurial')) + rcpath.append(os.path.expanduser('~/.hgrc')) + rcpath = [os.path.normpath(f) for f in rcpath] def parse_patch_output(output_line): """parses the output produced by patch and returns the file name"""
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-cat Thu Dec 15 15:39:20 2005 +0100 @@ -0,0 +1,18 @@ +#!/bin/sh +# +mkdir t +cd t +hg init +echo 0 > a +echo 0 > b +hg ci -A -m m -d "0 0" +hg rm a +hg cat a +sleep 1 # make sure mtime is changed +echo 1 > b +hg ci -m m -d "0 0" +echo 2 > b +hg cat -r 0 a +hg cat -r 0 b +hg cat -r 1 a +hg cat -r 1 b