Show More
@@ -851,13 +851,13 b' def dispatch(args):' | |||||
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(): |
|
854 | try: | |
855 | repo = hg.repository(ui = u) |
|
855 | if cmd not in norepo.split(): | |
856 | d = lambda: i[0](u, repo, *args, **cmdoptions) |
|
856 | repo = hg.repository(ui = u) | |
857 | else: |
|
857 | d = lambda: i[0](u, repo, *args, **cmdoptions) | |
858 | d = lambda: i[0](u, *args, **cmdoptions) |
|
858 | else: | |
|
859 | d = lambda: i[0](u, *args, **cmdoptions) | |||
859 |
|
860 | |||
860 | try: |
|
|||
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") | |
@@ -870,6 +870,8 b' def dispatch(args):' | |||||
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: |
@@ -318,6 +318,8 b' def opener(base):' | |||||
318 |
|
318 | |||
319 | return o |
|
319 | return o | |
320 |
|
320 | |||
|
321 | class RepoError(Exception): pass | |||
|
322 | ||||
321 | class localrepository: |
|
323 | class localrepository: | |
322 | def __init__(self, ui, path=None, create=0): |
|
324 | def __init__(self, ui, path=None, create=0): | |
323 | self.remote = 0 |
|
325 | self.remote = 0 | |
@@ -330,12 +332,12 b' class localrepository:' | |||||
330 | while not os.path.isdir(os.path.join(p, ".hg")): |
|
332 | while not os.path.isdir(os.path.join(p, ".hg")): | |
331 | oldp = p |
|
333 | oldp = p | |
332 | p = os.path.dirname(p) |
|
334 | p = os.path.dirname(p) | |
333 |
if p == oldp: raise " |
|
335 | if p == oldp: raise RepoError("no repo found") | |
334 | path = p |
|
336 | path = p | |
335 | self.path = os.path.join(path, ".hg") |
|
337 | self.path = os.path.join(path, ".hg") | |
336 |
|
338 | |||
337 | if not create and not os.path.isdir(self.path): |
|
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 | self.root = path |
|
342 | self.root = path | |
341 | self.ui = ui |
|
343 | self.ui = ui | |
@@ -911,7 +913,7 b' class localrepository:' | |||||
911 |
|
913 | |||
912 | for f in fetch: |
|
914 | for f in fetch: | |
913 | if f in m: |
|
915 | if f in m: | |
914 |
raise "already have" |
|
916 | raise RepoError("already have changeset " + short(f[:4])) | |
915 |
|
917 | |||
916 | self.ui.note("adding new changesets starting at " + |
|
918 | self.ui.note("adding new changesets starting at " + | |
917 | " ".join([short(f) for f in fetch]) + "\n") |
|
919 | " ".join([short(f) for f in fetch]) + "\n") |
General Comments 0
You need to be logged in to leave comments.
Login now