# HG changeset patch # User Thomas Arendsen Hein # Date 1141794804 -3600 # Node ID 39c46510ed255dd031ec13826c9f66b0591a66f3 # Parent 9fab6e903bae12c8fd2e1eccf9d471c1b5fa60c7 Moved --cwd handling in front of -R handling again. Shorter code for initial -R. 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: