equal
deleted
inserted
replaced
272 raise ValueError |
272 raise ValueError |
273 except ValueError: |
273 except ValueError: |
274 try: |
274 try: |
275 num = repo.changelog.rev(repo.lookup(val)) |
275 num = repo.changelog.rev(repo.lookup(val)) |
276 except KeyError: |
276 except KeyError: |
277 raise util.Abort(_('invalid revision identifier %s'), val) |
277 raise util.Abort(_('invalid revision identifier %s') % val) |
278 return num |
278 return num |
279 |
279 |
280 def revpair(ui, repo, revs): |
280 def revpair(ui, repo, revs): |
281 '''return pair of nodes, given list of revisions. second item can |
281 '''return pair of nodes, given list of revisions. second item can |
282 be None, meaning use working dir.''' |
282 be None, meaning use working dir.''' |
339 fh = None |
339 fh = None |
340 cleanup = None |
340 cleanup = None |
341 try: |
341 try: |
342 if filename: |
342 if filename: |
343 if os.path.exists(filename): |
343 if os.path.exists(filename): |
344 raise util.Abort(_("file '%s' already exists"), filename) |
344 raise util.Abort(_("file '%s' already exists") % filename) |
345 fh = open(filename, "wb") |
345 fh = open(filename, "wb") |
346 else: |
346 else: |
347 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") |
347 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") |
348 fh = os.fdopen(fd, "wb") |
348 fh = os.fdopen(fd, "wb") |
349 cleanup = filename |
349 cleanup = filename |
1267 r = revlog.revlog(util.opener(os.getcwd(), audit=False), |
1267 r = revlog.revlog(util.opener(os.getcwd(), audit=False), |
1268 file_[:-2] + ".i", file_, 0) |
1268 file_[:-2] + ".i", file_, 0) |
1269 try: |
1269 try: |
1270 ui.write(r.revision(r.lookup(rev))) |
1270 ui.write(r.revision(r.lookup(rev))) |
1271 except KeyError: |
1271 except KeyError: |
1272 raise util.Abort(_('invalid revision identifier %s'), rev) |
1272 raise util.Abort(_('invalid revision identifier %s') % rev) |
1273 |
1273 |
1274 def debugindex(ui, file_): |
1274 def debugindex(ui, file_): |
1275 """dump the contents of an index file""" |
1275 """dump the contents of an index file""" |
1276 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0) |
1276 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0) |
1277 ui.write(" rev offset length base linkrev" + |
1277 ui.write(" rev offset length base linkrev" + |
2482 os._exit(0) |
2482 os._exit(0) |
2483 |
2483 |
2484 try: |
2484 try: |
2485 httpd = hgweb.server.create_server(ui, repo) |
2485 httpd = hgweb.server.create_server(ui, repo) |
2486 except socket.error, inst: |
2486 except socket.error, inst: |
2487 raise util.Abort(_('cannot start server: ') + inst.args[1]) |
2487 raise util.Abort(_('cannot start server: %s') % inst.args[1]) |
2488 |
2488 |
2489 if ui.verbose: |
2489 if ui.verbose: |
2490 addr, port = httpd.socket.getsockname() |
2490 addr, port = httpd.socket.getsockname() |
2491 if addr == '0.0.0.0': |
2491 if addr == '0.0.0.0': |
2492 addr = socket.gethostname() |
2492 addr = socket.gethostname() |
2732 if len(found) == 1: |
2732 if len(found) == 1: |
2733 node = found[0] |
2733 node = found[0] |
2734 repo.ui.warn(_("Using head %s for branch %s\n") |
2734 repo.ui.warn(_("Using head %s for branch %s\n") |
2735 % (short(node), branch)) |
2735 % (short(node), branch)) |
2736 else: |
2736 else: |
2737 raise util.Abort(_("branch %s not found\n") % (branch)) |
2737 raise util.Abort(_("branch %s not found") % branch) |
2738 else: |
2738 else: |
2739 node = node and repo.lookup(node) or repo.changelog.tip() |
2739 node = node and repo.lookup(node) or repo.changelog.tip() |
2740 return node |
2740 return node |
2741 |
2741 |
2742 def verify(ui, repo): |
2742 def verify(ui, repo): |
3447 u.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) |
3447 u.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) |
3448 except lock.LockUnavailable, inst: |
3448 except lock.LockUnavailable, inst: |
3449 u.warn(_("abort: could not lock %s: %s\n") % |
3449 u.warn(_("abort: could not lock %s: %s\n") % |
3450 (inst.desc or inst.filename, inst.strerror)) |
3450 (inst.desc or inst.filename, inst.strerror)) |
3451 except revlog.RevlogError, inst: |
3451 except revlog.RevlogError, inst: |
3452 u.warn(_("abort: "), inst, "!\n") |
3452 u.warn(_("abort: %s!\n") % inst) |
3453 except util.SignalInterrupt: |
3453 except util.SignalInterrupt: |
3454 u.warn(_("killed!\n")) |
3454 u.warn(_("killed!\n")) |
3455 except KeyboardInterrupt: |
3455 except KeyboardInterrupt: |
3456 try: |
3456 try: |
3457 u.warn(_("interrupted!\n")) |
3457 u.warn(_("interrupted!\n")) |
3480 if hasattr(inst, "filename"): |
3480 if hasattr(inst, "filename"): |
3481 u.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) |
3481 u.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) |
3482 else: |
3482 else: |
3483 u.warn(_("abort: %s\n") % inst.strerror) |
3483 u.warn(_("abort: %s\n") % inst.strerror) |
3484 except util.Abort, inst: |
3484 except util.Abort, inst: |
3485 u.warn(_('abort: '), inst.args[0] % inst.args[1:], '\n') |
3485 u.warn(_("abort: %s\n") % inst) |
3486 except TypeError, inst: |
3486 except TypeError, inst: |
3487 # was this an argument error? |
3487 # was this an argument error? |
3488 tb = traceback.extract_tb(sys.exc_info()[2]) |
3488 tb = traceback.extract_tb(sys.exc_info()[2]) |
3489 if len(tb) > 2: # no |
3489 if len(tb) > 2: # no |
3490 raise |
3490 raise |