comparison mercurial/commands.py @ 1093:1f1661c58283

commands: use revlog directly for debug commands This eliminates the import in hg.py
author mpm@selenic.com
date Sat, 27 Aug 2005 14:56:58 -0700
parents 0a02315976ff
children ee817c5e3ece
comparison
equal deleted inserted replaced
1092:0a02315976ff 1093:1f1661c58283
6 # of the GNU General Public License, incorporated herein by reference. 6 # of the GNU General Public License, incorporated herein by reference.
7 7
8 from demandload import demandload 8 from demandload import demandload
9 from node import * 9 from node import *
10 demandload(globals(), "os re sys signal shutil imp") 10 demandload(globals(), "os re sys signal shutil imp")
11 demandload(globals(), "fancyopts ui hg util lock") 11 demandload(globals(), "fancyopts ui hg util lock revlog")
12 demandload(globals(), "fnmatch hgweb mdiff random signal time traceback") 12 demandload(globals(), "fnmatch hgweb mdiff random signal time traceback")
13 demandload(globals(), "errno socket version struct atexit sets") 13 demandload(globals(), "errno socket version struct atexit sets")
14 14
15 class UnknownCommand(Exception): 15 class UnknownCommand(Exception):
16 """Exception raised if command is not in the command table.""" 16 """Exception raised if command is not in the command table."""
689 time.strftime("%x %X", 689 time.strftime("%x %X",
690 time.localtime(dc[file_][3])), file_)) 690 time.localtime(dc[file_][3])), file_))
691 691
692 def debugdata(ui, file_, rev): 692 def debugdata(ui, file_, rev):
693 """dump the contents of an data file revision""" 693 """dump the contents of an data file revision"""
694 r = hg.revlog(file, file_[:-2] + ".i", file_) 694 r = revlog.revlog(file, file_[:-2] + ".i", file_)
695 ui.write(r.revision(r.lookup(rev))) 695 ui.write(r.revision(r.lookup(rev)))
696 696
697 def debugindex(ui, file_): 697 def debugindex(ui, file_):
698 """dump the contents of an index file""" 698 """dump the contents of an index file"""
699 r = hg.revlog(file, file_, "") 699 r = revlog.revlog(file, file_, "")
700 ui.write(" rev offset length base linkrev" + 700 ui.write(" rev offset length base linkrev" +
701 " nodeid p1 p2\n") 701 " nodeid p1 p2\n")
702 for i in range(r.count()): 702 for i in range(r.count()):
703 e = r.index[i] 703 e = r.index[i]
704 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( 704 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
705 i, e[0], e[1], e[2], e[3], 705 i, e[0], e[1], e[2], e[3],
706 short(e[6]), short(e[4]), short(e[5]))) 706 short(e[6]), short(e[4]), short(e[5])))
707 707
708 def debugindexdot(ui, file_): 708 def debugindexdot(ui, file_):
709 """dump an index DAG as a .dot file""" 709 """dump an index DAG as a .dot file"""
710 r = hg.revlog(file, file_, "") 710 r = revlog.revlog(file, file_, "")
711 ui.write("digraph G {\n") 711 ui.write("digraph G {\n")
712 for i in range(r.count()): 712 for i in range(r.count()):
713 e = r.index[i] 713 e = r.index[i]
714 ui.write("\t%d -> %d\n" % (r.rev(e[4]), i)) 714 ui.write("\t%d -> %d\n" % (r.rev(e[4]), i))
715 if e[5] != nullid: 715 if e[5] != nullid: