Moved --cwd handling to a place where ui and exception handling already exists.
authorThomas Arendsen Hein <thomas@intevation.de>
Fri, 26 Aug 2005 08:47:43 +0200
changeset 1050 9c09094de48c
parent 1049 160a68cd393f
child 1051 3c918b7ad8da
Moved --cwd handling to a place where ui and exception handling already exists.
mercurial/commands.py
--- a/mercurial/commands.py	Fri Aug 26 08:42:56 2005 +0200
+++ b/mercurial/commands.py	Fri Aug 26 08:47:43 2005 +0200
@@ -1609,14 +1609,6 @@
         help_(u, 'shortlist')
         sys.exit(1)
 
-    if options['cwd']:
-        try:
-            os.chdir(options['cwd'])
-        except OSError, inst:
-            u = ui.ui()
-            u.warn('abort: %s: %s\n' % (options['cwd'], inst.strerror))
-            sys.exit(1)
-
     if options["time"]:
         def get_times():
             t = os.times()
@@ -1646,6 +1638,13 @@
                 help_(u, 'shortlist')
                 sys.exit(0)
 
+            if options['cwd']:
+                try:
+                    os.chdir(options['cwd'])
+                except OSError, inst:
+                    u.warn('abort: %s: %s\n' % (options['cwd'], inst.strerror))
+                    sys.exit(1)
+
             if cmd not in norepo.split():
                 path = options["repository"] or ""
                 repo = hg.repository(ui=u, path=path)