mercurial/commands.py
changeset 14254 d6a762d93b77
parent 14252 19067884c5f5
child 14259 df9ccd39828c
equal deleted inserted replaced
14253:c28d5200374c 14254:d6a762d93b77
  1547         raise util.Abort(_("unknown format %d") % format)
  1547         raise util.Abort(_("unknown format %d") % format)
  1548 
  1548 
  1549     if not r:
  1549     if not r:
  1550         r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_)
  1550         r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_)
  1551 
  1551 
       
  1552     generaldelta = r.version & revlog.REVLOGGENERALDELTA
       
  1553     if generaldelta:
       
  1554         basehdr = ' delta'
       
  1555     else:
       
  1556         basehdr = '  base'
       
  1557 
  1552     if format == 0:
  1558     if format == 0:
  1553         ui.write("   rev    offset  length   base linkrev"
  1559         ui.write("   rev    offset  length " + basehdr + " linkrev"
  1554                  " nodeid       p1           p2\n")
  1560                  " nodeid       p1           p2\n")
  1555     elif format == 1:
  1561     elif format == 1:
  1556         ui.write("   rev flag   offset   length"
  1562         ui.write("   rev flag   offset   length"
  1557                  "     size   base   link     p1     p2       nodeid\n")
  1563                  "     size " + basehdr + "   link     p1     p2       nodeid\n")
  1558 
  1564 
  1559     for i in r:
  1565     for i in r:
  1560         node = r.node(i)
  1566         node = r.node(i)
       
  1567         if generaldelta:
       
  1568             base = r.deltaparent(i)
       
  1569         else:
       
  1570             base = r.chainbase(i)
  1561         if format == 0:
  1571         if format == 0:
  1562             try:
  1572             try:
  1563                 pp = r.parents(node)
  1573                 pp = r.parents(node)
  1564             except:
  1574             except:
  1565                 pp = [nullid, nullid]
  1575                 pp = [nullid, nullid]
  1566             ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
  1576             ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
  1567                     i, r.start(i), r.length(i), r.chainbase(i), r.linkrev(i),
  1577                     i, r.start(i), r.length(i), base, r.linkrev(i),
  1568                     short(node), short(pp[0]), short(pp[1])))
  1578                     short(node), short(pp[0]), short(pp[1])))
  1569         elif format == 1:
  1579         elif format == 1:
  1570             pr = r.parentrevs(i)
  1580             pr = r.parentrevs(i)
  1571             ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
  1581             ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % (
  1572                     i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
  1582                     i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
  1573                     r.chainbase(i), r.linkrev(i), pr[0], pr[1], short(node)))
  1583                     base, r.linkrev(i), pr[0], pr[1], short(node)))
  1574 
  1584 
  1575 def debugindexdot(ui, repo, file_):
  1585 def debugindexdot(ui, repo, file_):
  1576     """dump an index DAG as a graphviz dot file"""
  1586     """dump an index DAG as a graphviz dot file"""
  1577     r = None
  1587     r = None
  1578     if repo:
  1588     if repo: