##// END OF EJS Templates
Add exception class for repository errors...
mpm@selenic.com -
r499:81c563a2 default
parent child Browse files
Show More
@@ -851,13 +851,13 b' def dispatch(args):'
851 851 help(u, cmd)
852 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)
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)
859 860
860 try:
861 861 if options['profile']:
862 862 import hotshot, hotshot.stats
863 863 prof = hotshot.Profile("hg.prof")
@@ -870,6 +870,8 b' def dispatch(args):'
870 870 return r
871 871 else:
872 872 return d()
873 except hg.RepoError, inst:
874 u.warn("abort: ", inst, "!\n")
873 875 except SignalInterrupt:
874 876 u.warn("killed!\n")
875 877 except KeyboardInterrupt:
@@ -318,6 +318,8 b' def opener(base):'
318 318
319 319 return o
320 320
321 class RepoError(Exception): pass
322
321 323 class localrepository:
322 324 def __init__(self, ui, path=None, create=0):
323 325 self.remote = 0
@@ -330,12 +332,12 b' class localrepository:'
330 332 while not os.path.isdir(os.path.join(p, ".hg")):
331 333 oldp = p
332 334 p = os.path.dirname(p)
333 if p == oldp: raise "No repo found"
335 if p == oldp: raise RepoError("no repo found")
334 336 path = p
335 337 self.path = os.path.join(path, ".hg")
336 338
337 339 if not create and not os.path.isdir(self.path):
338 raise "repository %s not found" % self.path
340 raise RepoError("repository %s not found" % self.path)
339 341
340 342 self.root = path
341 343 self.ui = ui
@@ -911,7 +913,7 b' class localrepository:'
911 913
912 914 for f in fetch:
913 915 if f in m:
914 raise "already have", short(f[:4])
916 raise RepoError("already have changeset " + short(f[:4]))
915 917
916 918 self.ui.note("adding new changesets starting at " +
917 919 " ".join([short(f) for f in fetch]) + "\n")
General Comments 0
You need to be logged in to leave comments. Login now