diff -r 9fab6e903bae -r 39c46510ed25 mercurial/commands.py --- a/mercurial/commands.py Wed Mar 08 01:30:43 2006 +0100 +++ b/mercurial/commands.py Wed Mar 08 06:13:24 2006 +0100 @@ -2834,12 +2834,15 @@ try: try: - path = options["repository"] - if path: - repo = hg.repository(u, path=path) - else: - repo = None - path = "" + 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']) @@ -2851,13 +2854,6 @@ help_(u, 'shortlist') sys.exit(0) - if options['cwd']: - try: - os.chdir(options['cwd']) - except OSError, inst: - raise util.Abort('%s: %s' % - (options['cwd'], inst.strerror)) - if cmd not in norepo.split(): try: if not repo: