Mercurial > public > mercurial-scm > hg-stable
comparison 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 |
comparison
equal
deleted
inserted
replaced
498:8cf3999b3d03 | 499:81c563a254be |
---|---|
849 except fancyopts.getopt.GetoptError, inst: | 849 except fancyopts.getopt.GetoptError, inst: |
850 u.warn("hg %s: %s\n" % (cmd, inst)) | 850 u.warn("hg %s: %s\n" % (cmd, inst)) |
851 help(u, cmd) | 851 help(u, cmd) |
852 sys.exit(-1) | 852 sys.exit(-1) |
853 | 853 |
854 if cmd not in norepo.split(): | |
855 repo = hg.repository(ui = u) | |
856 d = lambda: i[0](u, repo, *args, **cmdoptions) | |
857 else: | |
858 d = lambda: i[0](u, *args, **cmdoptions) | |
859 | |
860 try: | 854 try: |
855 if cmd not in norepo.split(): | |
856 repo = hg.repository(ui = u) | |
857 d = lambda: i[0](u, repo, *args, **cmdoptions) | |
858 else: | |
859 d = lambda: i[0](u, *args, **cmdoptions) | |
860 | |
861 if options['profile']: | 861 if options['profile']: |
862 import hotshot, hotshot.stats | 862 import hotshot, hotshot.stats |
863 prof = hotshot.Profile("hg.prof") | 863 prof = hotshot.Profile("hg.prof") |
864 r = prof.runcall(d) | 864 r = prof.runcall(d) |
865 prof.close() | 865 prof.close() |
868 stats.sort_stats('time', 'calls') | 868 stats.sort_stats('time', 'calls') |
869 stats.print_stats(40) | 869 stats.print_stats(40) |
870 return r | 870 return r |
871 else: | 871 else: |
872 return d() | 872 return d() |
873 except hg.RepoError, inst: | |
874 u.warn("abort: ", inst, "!\n") | |
873 except SignalInterrupt: | 875 except SignalInterrupt: |
874 u.warn("killed!\n") | 876 u.warn("killed!\n") |
875 except KeyboardInterrupt: | 877 except KeyboardInterrupt: |
876 u.warn("interrupted!\n") | 878 u.warn("interrupted!\n") |
877 except IOError, inst: | 879 except IOError, inst: |