Show More
@@ -985,6 +985,18 b' def debugancestor(ui, index, rev1, rev2)' | |||
|
985 | 985 | a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) |
|
986 | 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 | 1000 | def debugcheckstate(ui, repo): |
|
989 | 1001 | """validate the correctness of the current dirstate""" |
|
990 | 1002 | parent1, parent2 = repo.dirstate.parents() |
@@ -2359,6 +2371,10 b' table = {' | |||
|
2359 | 2371 | _('forcibly copy over an existing managed file'))], |
|
2360 | 2372 | _('hg copy [OPTION]... [SOURCE]... DEST')), |
|
2361 | 2373 | "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), |
|
2374 | "debugrebuildstate": | |
|
2375 | (debugrebuildstate, | |
|
2376 | [('r', 'rev', "", _("revision to rebuild to"))], | |
|
2377 | _('debugrebuildstate [-r REV] [REV]')), | |
|
2362 | 2378 | "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), |
|
2363 | 2379 | "debugconfig": (debugconfig, [], _('debugconfig')), |
|
2364 | 2380 | "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')), |
@@ -197,6 +197,19 b' class dirstate(object):' | |||
|
197 | 197 | |
|
198 | 198 | def clear(self): |
|
199 | 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 | 213 | self.markdirty() |
|
201 | 214 | |
|
202 | 215 | def write(self): |
@@ -406,7 +419,8 b' class dirstate(object):' | |||
|
406 | 419 | if type_ == 'n': |
|
407 | 420 | if not st: |
|
408 | 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 | 424 | modified.append(fn) |
|
411 | 425 | elif time != st.st_mtime: |
|
412 | 426 | lookup.append(fn) |
General Comments 0
You need to be logged in to leave comments.
Login now