mercurial/commands.py
branchstable
changeset 12893 15ca4bfecfe3
parent 12863 60d9692921ea
child 12913 0e0a52bd58f9
child 12965 0d4fb319974b
equal deleted inserted replaced
12892:919c440868d9 12893:15ca4bfecfe3
  1258     ui.write("standard: %s\n" % util.datestr(d))
  1258     ui.write("standard: %s\n" % util.datestr(d))
  1259     if range:
  1259     if range:
  1260         m = util.matchdate(range)
  1260         m = util.matchdate(range)
  1261         ui.write("match: %s\n" % m(d[0]))
  1261         ui.write("match: %s\n" % m(d[0]))
  1262 
  1262 
  1263 def debugindex(ui, repo, file_):
  1263 def debugindex(ui, repo, file_, **opts):
  1264     """dump the contents of an index file"""
  1264     """dump the contents of an index file"""
  1265     r = None
  1265     r = None
  1266     if repo:
  1266     if repo:
  1267         filelog = repo.file(file_)
  1267         filelog = repo.file(file_)
  1268         if len(filelog):
  1268         if len(filelog):
  1269             r = filelog
  1269             r = filelog
       
  1270 
       
  1271     format = opts.get('format', 0)
       
  1272     if format not in (0, 1):
       
  1273         raise util.abort("unknown format %d" % format)
       
  1274 
  1270     if not r:
  1275     if not r:
  1271         r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
  1276         r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
  1272     ui.write("   rev    offset  length   base linkrev"
  1277 
  1273              " nodeid       p1           p2\n")
  1278     if format == 0:
       
  1279         ui.write("   rev    offset  length   base linkrev"
       
  1280                  " nodeid       p1           p2\n")
       
  1281     elif format == 1:
       
  1282         ui.write("   rev flag   offset   length"
       
  1283                  "     size   base   link     p1     p2       nodeid\n")
       
  1284 
  1274     for i in r:
  1285     for i in r:
  1275         node = r.node(i)
  1286         node = r.node(i)
  1276         try:
  1287         if format == 0:
  1277             pp = r.parents(node)
  1288             try:
  1278         except:
  1289                 pp = r.parents(node)
  1279             pp = [nullid, nullid]
  1290             except:
  1280         ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
  1291                 pp = [nullid, nullid]
  1281                 i, r.start(i), r.length(i), r.base(i), r.linkrev(i),
  1292             ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
  1282             short(node), short(pp[0]), short(pp[1])))
  1293                     i, r.start(i), r.length(i), r.base(i), r.linkrev(i),
       
  1294                     short(node), short(pp[0]), short(pp[1])))
       
  1295         elif format == 1:
       
  1296             pr = r.parentrevs(i)
       
  1297             ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
       
  1298                     i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
       
  1299                     r.base(i), r.linkrev(i), pr[0], pr[1], short(node)))
  1283 
  1300 
  1284 def debugindexdot(ui, repo, file_):
  1301 def debugindexdot(ui, repo, file_):
  1285     """dump an index DAG as a graphviz dot file"""
  1302     """dump an index DAG as a graphviz dot file"""
  1286     r = None
  1303     r = None
  1287     if repo:
  1304     if repo:
  4137         (debugdate,
  4154         (debugdate,
  4138          [('e', 'extended', None, _('try extended date formats'))],
  4155          [('e', 'extended', None, _('try extended date formats'))],
  4139          _('[-e] DATE [RANGE]')),
  4156          _('[-e] DATE [RANGE]')),
  4140     "debugdata": (debugdata, [], _('FILE REV')),
  4157     "debugdata": (debugdata, [], _('FILE REV')),
  4141     "debugfsinfo": (debugfsinfo, [], _('[PATH]')),
  4158     "debugfsinfo": (debugfsinfo, [], _('[PATH]')),
  4142     "debugindex": (debugindex, [], _('FILE')),
  4159     "debugindex": (debugindex,
       
  4160                    [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
       
  4161                    _('FILE')),
  4143     "debugindexdot": (debugindexdot, [], _('FILE')),
  4162     "debugindexdot": (debugindexdot, [], _('FILE')),
  4144     "debuginstall": (debuginstall, [], ''),
  4163     "debuginstall": (debuginstall, [], ''),
  4145     "debugpushkey": (debugpushkey, [], _('REPO NAMESPACE [KEY OLD NEW]')),
  4164     "debugpushkey": (debugpushkey, [], _('REPO NAMESPACE [KEY OLD NEW]')),
  4146     "debugrebuildstate":
  4165     "debugrebuildstate":
  4147         (debugrebuildstate,
  4166         (debugrebuildstate,