Moved --cwd handling in front of -R handling again. Shorter code for initial -R.
authorThomas Arendsen Hein <thomas@intevation.de>
Wed, 08 Mar 2006 06:13:24 +0100
changeset 1859 39c46510ed25
parent 1858 9fab6e903bae
child 1860 97f07d311a50
Moved --cwd handling in front of -R handling again. Shorter code for initial -R.
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: