--- a/mercurial/commands.py Mon Feb 20 11:06:41 2006 -0800
+++ b/mercurial/commands.py Mon Feb 20 11:07:09 2006 -0800
@@ -115,8 +115,8 @@
yield rev
minrev, maxrev = min(revs), max(revs)
- for file in files:
- filelog = repo.file(file)
+ for file_ in files:
+ filelog = repo.file(file_)
# A zero count may be a directory or deleted file, so
# try to find matching entries on the slow path.
if filelog.count() == 0:
@@ -127,7 +127,7 @@
if rev < minrev:
break
fncache.setdefault(rev, [])
- fncache[rev].append(file)
+ fncache[rev].append(file_)
wanted[rev] = 1
if slowpath:
# The slow path checks files modified in every changeset.
@@ -447,7 +447,6 @@
f = f.lstrip("^")
if not ui.debugflag and f.startswith("debug"):
continue
- d = ""
doc = e[0].__doc__
if not doc:
doc = _("(No help text available)")
@@ -725,8 +724,8 @@
# can end up with extra data in the cloned revlogs that's
# not pointed to by changesets, thus causing verify to
# fail
- l1 = lock.lock(os.path.join(source, ".hg", "lock"))
- except OSError:
+ l1 = other.lock()
+ except lock.LockException:
copy = False
if copy:
@@ -986,6 +985,18 @@
a = r.ancestor(r.lookup(rev1), r.lookup(rev2))
ui.write("%d:%s\n" % (r.rev(a), hex(a)))
+def debugrebuildstate(ui, repo, rev=None):
+ """rebuild the dirstate as it would look like for the given revision"""
+ if not rev:
+ rev = repo.changelog.tip()
+ else:
+ rev = repo.lookup(rev)
+ change = repo.changelog.read(rev)
+ n = change[0]
+ files = repo.manifest.readflags(n)
+ wlock = self.repo.wlock()
+ repo.dirstate.rebuild(rev, files.iteritems())
+
def debugcheckstate(ui, repo):
"""validate the correctness of the current dirstate"""
parent1, parent2 = repo.dirstate.parents()
@@ -1290,6 +1301,7 @@
s = linestate(line, lnum, cstart, cend)
m[s] = s
+ # FIXME: prev isn't used, why ?
prev = {}
ucache = {}
def display(fn, rev, states, prevstates):
@@ -2373,6 +2385,10 @@
_('forcibly copy over an existing managed file'))],
_('hg copy [OPTION]... [SOURCE]... DEST')),
"debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')),
+ "debugrebuildstate":
+ (debugrebuildstate,
+ [('r', 'rev', "", _("revision to rebuild to"))],
+ _('debugrebuildstate [-r REV] [REV]')),
"debugcheckstate": (debugcheckstate, [], _('debugcheckstate')),
"debugconfig": (debugconfig, [], _('debugconfig')),
"debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')),