changeset 1859:39c46510ed25

Moved --cwd handling in front of -R handling again. Shorter code for initial -R.
author Thomas Arendsen Hein <thomas@intevation.de>
date Wed, 08 Mar 2006 06:13:24 +0100
parents 9fab6e903bae
children 97f07d311a50
files mercurial/commands.py
diffstat 1 files changed, 9 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- 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: