Show More
@@ -985,6 +985,18 b' def debugancestor(ui, index, rev1, rev2)' | |||||
985 | a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) |
|
985 | a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) | |
986 | ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
|
986 | ui.write("%d:%s\n" % (r.rev(a), hex(a))) | |
987 |
|
987 | |||
|
988 | def debugrebuildstate(ui, repo, rev=None): | |||
|
989 | """rebuild the dirstate as it would look like for the given revision""" | |||
|
990 | if not rev: | |||
|
991 | rev = repo.changelog.tip() | |||
|
992 | else: | |||
|
993 | rev = repo.lookup(rev) | |||
|
994 | change = repo.changelog.read(rev) | |||
|
995 | n = change[0] | |||
|
996 | files = repo.manifest.readflags(n) | |||
|
997 | wlock = self.repo.wlock() | |||
|
998 | repo.dirstate.rebuild(rev, files.iteritems()) | |||
|
999 | ||||
988 | def debugcheckstate(ui, repo): |
|
1000 | def debugcheckstate(ui, repo): | |
989 | """validate the correctness of the current dirstate""" |
|
1001 | """validate the correctness of the current dirstate""" | |
990 | parent1, parent2 = repo.dirstate.parents() |
|
1002 | parent1, parent2 = repo.dirstate.parents() | |
@@ -2359,6 +2371,10 b' table = {' | |||||
2359 | _('forcibly copy over an existing managed file'))], |
|
2371 | _('forcibly copy over an existing managed file'))], | |
2360 | _('hg copy [OPTION]... [SOURCE]... DEST')), |
|
2372 | _('hg copy [OPTION]... [SOURCE]... DEST')), | |
2361 | "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), |
|
2373 | "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), | |
|
2374 | "debugrebuildstate": | |||
|
2375 | (debugrebuildstate, | |||
|
2376 | [('r', 'rev', "", _("revision to rebuild to"))], | |||
|
2377 | _('debugrebuildstate [-r REV] [REV]')), | |||
2362 | "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), |
|
2378 | "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), | |
2363 | "debugconfig": (debugconfig, [], _('debugconfig')), |
|
2379 | "debugconfig": (debugconfig, [], _('debugconfig')), | |
2364 | "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')), |
|
2380 | "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')), |
@@ -197,6 +197,19 b' class dirstate(object):' | |||||
197 |
|
197 | |||
198 | def clear(self): |
|
198 | def clear(self): | |
199 | self.map = {} |
|
199 | self.map = {} | |
|
200 | self.copies = {} | |||
|
201 | self.markdirty() | |||
|
202 | ||||
|
203 | def rebuild(self, parent, files): | |||
|
204 | self.clear() | |||
|
205 | umask = os.umask(0) | |||
|
206 | os.umask(umask) | |||
|
207 | for f, mode in files: | |||
|
208 | if mode: | |||
|
209 | self.map[f] = ('n', ~umask, -1, 0) | |||
|
210 | else: | |||
|
211 | self.map[f] = ('n', ~umask & 0666, -1, 0) | |||
|
212 | self.pl = (parent, nullid) | |||
200 | self.markdirty() |
|
213 | self.markdirty() | |
201 |
|
214 | |||
202 | def write(self): |
|
215 | def write(self): | |
@@ -406,7 +419,8 b' class dirstate(object):' | |||||
406 | if type_ == 'n': |
|
419 | if type_ == 'n': | |
407 | if not st: |
|
420 | if not st: | |
408 | st = os.stat(fn) |
|
421 | st = os.stat(fn) | |
409 |
if size != st.st_size |
|
422 | if size >= 0 and (size != st.st_size | |
|
423 | or (mode ^ st.st_mode) & 0100): | |||
410 | modified.append(fn) |
|
424 | modified.append(fn) | |
411 | elif time != st.st_mtime: |
|
425 | elif time != st.st_mtime: | |
412 | lookup.append(fn) |
|
426 | lookup.append(fn) |
General Comments 0
You need to be logged in to leave comments.
Login now