mercurial/commands.py
changeset 3972 356e20d46b34
parent 3951 cb66641cdee3
child 3990 96e21337dc03
equal deleted inserted replaced
3971:68a0fa81ad28 3972:356e20d46b34
   682 
   682 
   683     clist = findpossible(ui, cmd).keys()
   683     clist = findpossible(ui, cmd).keys()
   684     clist.sort()
   684     clist.sort()
   685     ui.write("%s\n" % "\n".join(clist))
   685     ui.write("%s\n" % "\n".join(clist))
   686 
   686 
   687 def debugrebuildstate(ui, repo, rev=None):
   687 def debugrebuildstate(ui, repo, rev=""):
   688     """rebuild the dirstate as it would look like for the given revision"""
   688     """rebuild the dirstate as it would look like for the given revision"""
   689     if not rev:
   689     if rev == "":
   690         rev = repo.changelog.tip()
   690         rev = repo.changelog.tip()
   691     else:
   691     ctx = repo.changectx(rev)
   692         rev = repo.lookup(rev)
   692     files = ctx.manifest()
   693     change = repo.changelog.read(rev)
       
   694     n = change[0]
       
   695     files = repo.manifest.read(n)
       
   696     wlock = repo.wlock()
   693     wlock = repo.wlock()
   697     repo.dirstate.rebuild(rev, files)
   694     repo.dirstate.rebuild(rev, files)
   698 
   695 
   699 def debugcheckstate(ui, repo):
   696 def debugcheckstate(ui, repo):
   700     """validate the correctness of the current dirstate"""
   697     """validate the correctness of the current dirstate"""
   701     parent1, parent2 = repo.dirstate.parents()
   698     parent1, parent2 = repo.dirstate.parents()
   702     repo.dirstate.read()
   699     repo.dirstate.read()
   703     dc = repo.dirstate.map
   700     dc = repo.dirstate.map
   704     keys = dc.keys()
   701     keys = dc.keys()
   705     keys.sort()
   702     keys.sort()
   706     m1n = repo.changelog.read(parent1)[0]
   703     m1 = repo.changectx(parent1).manifest()
   707     m2n = repo.changelog.read(parent2)[0]
   704     m2 = repo.changectx(parent2).manifest()
   708     m1 = repo.manifest.read(m1n)
       
   709     m2 = repo.manifest.read(m2n)
       
   710     errors = 0
   705     errors = 0
   711     for f in dc:
   706     for f in dc:
   712         state = repo.dirstate.state(f)
   707         state = repo.dirstate.state(f)
   713         if state in "nr" and f not in m1:
   708         if state in "nr" and f not in m1:
   714             ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
   709             ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
  2125 
  2120 
  2126     parent, p2 = repo.dirstate.parents()
  2121     parent, p2 = repo.dirstate.parents()
  2127     if not opts['rev'] and p2 != nullid:
  2122     if not opts['rev'] and p2 != nullid:
  2128         raise util.Abort(_('uncommitted merge - please provide a '
  2123         raise util.Abort(_('uncommitted merge - please provide a '
  2129                            'specific revision'))
  2124                            'specific revision'))
  2130     node = repo.changectx(opts['rev']).node()
  2125     ctx = repo.changectx(opts['rev'])
  2131     mf = repo.manifest.read(repo.changelog.read(node)[0])
  2126     node = ctx.node()
       
  2127     mf = ctx.manifest()
  2132     if node == parent:
  2128     if node == parent:
  2133         pmf = mf
  2129         pmf = mf
  2134     else:
  2130     else:
  2135         pmf = None
  2131         pmf = None
  2136 
  2132 
  2216                 if exact: ui.warn(_('no changes needed to %s\n') % rel)
  2212                 if exact: ui.warn(_('no changes needed to %s\n') % rel)
  2217                 continue
  2213                 continue
  2218             if pmf is None:
  2214             if pmf is None:
  2219                 # only need parent manifest in this unlikely case,
  2215                 # only need parent manifest in this unlikely case,
  2220                 # so do not read by default
  2216                 # so do not read by default
  2221                 pmf = repo.manifest.read(repo.changelog.read(parent)[0])
  2217                 pmf = repo.changectx(parent).manifest()
  2222             if abs in pmf:
  2218             if abs in pmf:
  2223                 if mfentry:
  2219                 if mfentry:
  2224                     # if version of file is same in parent and target
  2220                     # if version of file is same in parent and target
  2225                     # manifests, do nothing
  2221                     # manifests, do nothing
  2226                     if pmf[abs] != mfentry:
  2222                     if pmf[abs] != mfentry: