##// END OF EJS Templates
commands.py: use contexts in various places (debug*state, revert)
Benoit Boissinot -
r3972:356e20d4 default
parent child Browse files
Show More
@@ -684,15 +684,12 b" def debugcomplete(ui, cmd='', **opts):"
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
@@ -703,10 +700,8 b' def debugcheckstate(ui, repo):'
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)
@@ -2127,8 +2122,9 b' def revert(ui, repo, *pats, **opts):'
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:
@@ -2218,7 +2214,7 b' def revert(ui, repo, *pats, **opts):'
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
General Comments 0
You need to be logged in to leave comments. Login now