mercurial/commands.py
changeset 6750 fb42030d79d6
parent 6749 51b0e799352f
child 6760 4faaa0535ea7
equal deleted inserted replaced
6749:51b0e799352f 6750:fb42030d79d6
   771 def debugindex(ui, file_):
   771 def debugindex(ui, file_):
   772     """dump the contents of an index file"""
   772     """dump the contents of an index file"""
   773     r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
   773     r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
   774     ui.write("   rev    offset  length   base linkrev" +
   774     ui.write("   rev    offset  length   base linkrev" +
   775              " nodeid       p1           p2\n")
   775              " nodeid       p1           p2\n")
   776     for i in xrange(r.count()):
   776     for i in r:
   777         node = r.node(i)
   777         node = r.node(i)
   778         try:
   778         try:
   779             pp = r.parents(node)
   779             pp = r.parents(node)
   780         except:
   780         except:
   781             pp = [nullid, nullid]
   781             pp = [nullid, nullid]
   785 
   785 
   786 def debugindexdot(ui, file_):
   786 def debugindexdot(ui, file_):
   787     """dump an index DAG as a .dot file"""
   787     """dump an index DAG as a .dot file"""
   788     r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
   788     r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_)
   789     ui.write("digraph G {\n")
   789     ui.write("digraph G {\n")
   790     for i in xrange(r.count()):
   790     for i in r:
   791         node = r.node(i)
   791         node = r.node(i)
   792         pp = r.parents(node)
   792         pp = r.parents(node)
   793         ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
   793         ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i))
   794         if pp[1] != nullid:
   794         if pp[1] != nullid:
   795             ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
   795             ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
  1760     count = 0
  1760     count = 0
  1761 
  1761 
  1762     if opts['copies'] and opts['rev']:
  1762     if opts['copies'] and opts['rev']:
  1763         endrev = max(cmdutil.revrange(repo, opts['rev'])) + 1
  1763         endrev = max(cmdutil.revrange(repo, opts['rev'])) + 1
  1764     else:
  1764     else:
  1765         endrev = repo.changelog.count()
  1765         endrev = len(repo)
  1766     rcache = {}
  1766     rcache = {}
  1767     ncache = {}
  1767     ncache = {}
  1768     def getrenamed(fn, rev):
  1768     def getrenamed(fn, rev):
  1769         '''looks up all renames for a file (up to endrev) the first
  1769         '''looks up all renames for a file (up to endrev) the first
  1770         time the file is given. It indexes on the changerev and only
  1770         time the file is given. It indexes on the changerev and only
  1772         Returns rename info for fn at changerev rev.'''
  1772         Returns rename info for fn at changerev rev.'''
  1773         if fn not in rcache:
  1773         if fn not in rcache:
  1774             rcache[fn] = {}
  1774             rcache[fn] = {}
  1775             ncache[fn] = {}
  1775             ncache[fn] = {}
  1776             fl = repo.file(fn)
  1776             fl = repo.file(fn)
  1777             for i in xrange(fl.count()):
  1777             for i in fl:
  1778                 node = fl.node(i)
  1778                 node = fl.node(i)
  1779                 lr = fl.linkrev(node)
  1779                 lr = fl.linkrev(node)
  1780                 renamed = fl.renamed(node)
  1780                 renamed = fl.renamed(node)
  1781                 rcache[fn][lr] = renamed
  1781                 rcache[fn][lr] = renamed
  1782                 if renamed:
  1782                 if renamed:
  2792     If you have just made a commit, that commit will be the tip. If
  2792     If you have just made a commit, that commit will be the tip. If
  2793     you have just pulled changes from another repository, the tip of
  2793     you have just pulled changes from another repository, the tip of
  2794     that repository becomes the current tip. The "tip" tag is special
  2794     that repository becomes the current tip. The "tip" tag is special
  2795     and cannot be renamed or assigned to a different changeset.
  2795     and cannot be renamed or assigned to a different changeset.
  2796     """
  2796     """
  2797     cmdutil.show_changeset(ui, repo, opts).show(nullrev+repo.changelog.count())
  2797     cmdutil.show_changeset(ui, repo, opts).show(len(repo) - 1)
  2798 
  2798 
  2799 def unbundle(ui, repo, fname1, *fnames, **opts):
  2799 def unbundle(ui, repo, fname1, *fnames, **opts):
  2800     """apply one or more changegroup files
  2800     """apply one or more changegroup files
  2801 
  2801 
  2802     Apply one or more compressed changegroup files generated by the
  2802     Apply one or more compressed changegroup files generated by the