comparison mercurial/commands.py @ 2072:74d3f5336b66

Implement revlogng. revlogng results in smaller indexes, can address larger data files, and supports flags and version numbers. By default the original revlog format is used. To use the new format, use the following .hgrc field: [revlog] # format choices are 0 (classic revlog format) and 1 revlogng format=1
author mason@suse.com
date Tue, 04 Apr 2006 16:38:43 -0400
parents a514c7509fa9
children 345107e167a0
comparison
equal deleted inserted replaced
2042:a514c7509fa9 2072:74d3f5336b66
1266 errs, copied = docopy(ui, repo, pats, opts, wlock) 1266 errs, copied = docopy(ui, repo, pats, opts, wlock)
1267 return errs 1267 return errs
1268 1268
1269 def debugancestor(ui, index, rev1, rev2): 1269 def debugancestor(ui, index, rev1, rev2):
1270 """find the ancestor revision of two revisions in a given index""" 1270 """find the ancestor revision of two revisions in a given index"""
1271 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, "") 1271 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, "", 0)
1272 a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) 1272 a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
1273 ui.write("%d:%s\n" % (r.rev(a), hex(a))) 1273 ui.write("%d:%s\n" % (r.rev(a), hex(a)))
1274 1274
1275 def debugcomplete(ui, cmd='', **opts): 1275 def debugcomplete(ui, cmd='', **opts):
1276 """returns the completion list associated with the given command""" 1276 """returns the completion list associated with the given command"""
1370 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copies[f], f)) 1370 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copies[f], f))
1371 1371
1372 def debugdata(ui, file_, rev): 1372 def debugdata(ui, file_, rev):
1373 """dump the contents of an data file revision""" 1373 """dump the contents of an data file revision"""
1374 r = revlog.revlog(util.opener(os.getcwd(), audit=False), 1374 r = revlog.revlog(util.opener(os.getcwd(), audit=False),
1375 file_[:-2] + ".i", file_) 1375 file_[:-2] + ".i", file_, 0)
1376 try: 1376 try:
1377 ui.write(r.revision(r.lookup(rev))) 1377 ui.write(r.revision(r.lookup(rev)))
1378 except KeyError: 1378 except KeyError:
1379 raise util.Abort(_('invalid revision identifier %s'), rev) 1379 raise util.Abort(_('invalid revision identifier %s'), rev)
1380 1380
1381 def debugindex(ui, file_): 1381 def debugindex(ui, file_):
1382 """dump the contents of an index file""" 1382 """dump the contents of an index file"""
1383 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "") 1383 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0)
1384 ui.write(" rev offset length base linkrev" + 1384 ui.write(" rev offset length base linkrev" +
1385 " nodeid p1 p2\n") 1385 " nodeid p1 p2\n")
1386 for i in range(r.count()): 1386 for i in range(r.count()):
1387 e = r.index[i] 1387 node = r.node(i)
1388 pp = r.parents(node)
1388 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( 1389 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % (
1389 i, e[0], e[1], e[2], e[3], 1390 i, r.start(i), r.length(i), r.base(i), r.linkrev(node),
1390 short(e[6]), short(e[4]), short(e[5]))) 1391 short(node), short(pp[0]), short(pp[1])))
1391 1392
1392 def debugindexdot(ui, file_): 1393 def debugindexdot(ui, file_):
1393 """dump an index DAG as a .dot file""" 1394 """dump an index DAG as a .dot file"""
1394 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "") 1395 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0)
1395 ui.write("digraph G {\n") 1396 ui.write("digraph G {\n")
1396 for i in range(r.count()): 1397 for i in range(r.count()):
1397 e = r.index[i] 1398 e = r.index[i]
1398 ui.write("\t%d -> %d\n" % (r.rev(e[4]), i)) 1399 ui.write("\t%d -> %d\n" % (r.rev(e[4]), i))
1399 if e[5] != nullid: 1400 if e[5] != nullid: