# HG changeset patch # User Thomas Arendsen Hein # Date 1141795232 -3600 # Node ID 97f07d311a50ee823f29b0f1881c03a1a0457790 # Parent 39c46510ed255dd031ec13826c9f66b0591a66f3# Parent b8bd84ad9b67a36cd0cce242528ed974bb1746f6 Merged tah and crew diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1058,13 +1058,8 @@ def debugcheckstate(ui, repo): error = _(".hg/dirstate inconsistent with current parent's manifest") raise util.Abort(error) -def debugconfig(ui): +def debugconfig(ui, repo): """show combined config settings from all hgrc files""" - try: - repo = hg.repository(ui) - ui = repo.ui - except hg.RepoError: - pass for section, name, value in ui.walkconfig(): ui.write('%s.%s=%s\n' % (section, name, value)) @@ -1763,7 +1758,7 @@ def parents(ui, repo, rev=None, branches if n != nullid: show_changeset(ui, repo, changenode=n, brinfo=br) -def paths(ui, search=None): +def paths(ui, repo, search=None): """show definition of symbolic path names Show definition of symbolic path name NAME. If no name is given, show @@ -1772,12 +1767,6 @@ def paths(ui, search=None): Path names are defined in the [paths] section of /etc/mercurial/hgrc and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. """ - try: - repo = hg.repository(ui) - ui = repo.ui - except hg.RepoError: - pass - if search: for name, path in ui.configitems("paths"): if name == search: @@ -2668,8 +2657,9 @@ globalopts = [ ('h', 'help', None, _('display help and exit')), ] -norepo = ("clone init version help debugancestor debugconfig debugdata" - " debugindex debugindexdot paths") +norepo = ("clone init version help debugancestor debugdata" + " debugindex debugindexdot") +optionalrepo = ("paths debugconfig") def find(cmd): """Return (aliases, command table entry) for command string.""" @@ -2844,6 +2834,16 @@ def dispatch(args): try: try: + if options['cwd']: + try: + os.chdir(options['cwd']) + except OSError, inst: + raise util.Abort('%s: %s' % + (options['cwd'], inst.strerror)) + + path = options["repository"] or "" + repo = path and hg.repository(u, path=path) or None + if options['help']: help_(u, cmd, options['version']) sys.exit(0) @@ -2854,20 +2854,17 @@ def dispatch(args): help_(u, 'shortlist') sys.exit(0) - if options['cwd']: + if cmd not in norepo.split(): try: - os.chdir(options['cwd']) - except OSError, inst: - raise util.Abort('%s: %s' % - (options['cwd'], inst.strerror)) - - if cmd not in norepo.split(): - path = options["repository"] or "" - repo = hg.repository(u, path=path) - u = repo.ui - for x in external: - if hasattr(x, 'reposetup'): - x.reposetup(u, repo) + if not repo: + repo = hg.repository(u, path=path) + u = repo.ui + for x in external: + if hasattr(x, 'reposetup'): + x.reposetup(u, repo) + except hg.RepoError: + if cmd not in optionalrepo.split(): + raise d = lambda: func(u, repo, *args, **cmdoptions) else: d = lambda: func(u, *args, **cmdoptions)