diff mercurial/commands.py @ 499:81c563a254be

Add exception class for repository errors -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Add exception class for repository errors This gives friendlier errors for repo exceptions manifest hash: f3bef1ddb0c3911b9866ebdafa1fe72df48c8ecd -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCwRCfywK+sNU5EO8RAg7fAJ9PMka8pJCy7mMTqFFJ5aQFemHpxwCfezPR cZRAXmbWTTI+/WnVFDjpfM0= =8crk -----END PGP SIGNATURE-----
author mpm@selenic.com
date Tue, 28 Jun 2005 00:55:59 -0800
parents 6ce95a04999d
children ebc4714a7632
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Jun 28 00:46:16 2005 -0800
+++ b/mercurial/commands.py	Tue Jun 28 00:55:59 2005 -0800
@@ -851,13 +851,13 @@
         help(u, cmd)
         sys.exit(-1)
 
-    if cmd not in norepo.split():
-        repo = hg.repository(ui = u)
-        d = lambda: i[0](u, repo, *args, **cmdoptions)
-    else:
-        d = lambda: i[0](u, *args, **cmdoptions)
+    try:
+        if cmd not in norepo.split():
+            repo = hg.repository(ui = u)
+            d = lambda: i[0](u, repo, *args, **cmdoptions)
+        else:
+            d = lambda: i[0](u, *args, **cmdoptions)
 
-    try:
         if options['profile']:
             import hotshot, hotshot.stats
             prof = hotshot.Profile("hg.prof")
@@ -870,6 +870,8 @@
             return r
         else:
             return d()
+    except hg.RepoError, inst:
+        u.warn("abort: ", inst, "!\n")
     except SignalInterrupt:
         u.warn("killed!\n")
     except KeyboardInterrupt: