Show More
@@ -3037,7 +3037,22 b' def strip(ui, repo, *revs, **opts):' | |||
|
3037 | 3037 | wlock = repo.wlock() |
|
3038 | 3038 | try: |
|
3039 | 3039 | urev = repo.mq.qparents(repo, revs[0]) |
|
3040 | repo.dirstate.rebuild(urev, repo[urev].manifest()) | |
|
3040 | uctx = repo[urev] | |
|
3041 | ||
|
3042 | # only reset the dirstate for files that would actually change | |
|
3043 | # between the working context and uctx | |
|
3044 | descendantrevs = repo.revs("%s::." % uctx.rev()) | |
|
3045 | changedfiles = [] | |
|
3046 | for rev in descendantrevs: | |
|
3047 | # blindy reset the files, regardless of what actually changed | |
|
3048 | changedfiles.extend(repo[rev].files()) | |
|
3049 | ||
|
3050 | # reset files that only changed in the dirstate too | |
|
3051 | dirstate = repo.dirstate | |
|
3052 | dirchanges = [f for f in dirstate if dirstate[f] != 'n'] | |
|
3053 | changedfiles.extend(dirchanges) | |
|
3054 | ||
|
3055 | repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles) | |
|
3041 | 3056 | repo.dirstate.write() |
|
3042 | 3057 | update = False |
|
3043 | 3058 | finally: |
@@ -498,13 +498,18 b' class dirstate(object):' | |||
|
498 | 498 | self._lastnormaltime = 0 |
|
499 | 499 | self._dirty = True |
|
500 | 500 | |
|
501 | def rebuild(self, parent, files): | |
|
501 | def rebuild(self, parent, allfiles, changedfiles=None): | |
|
502 | changedfiles = changedfiles or allfiles | |
|
503 | oldmap = self._map | |
|
502 | 504 | self.clear() |
|
503 | for f in files: | |
|
504 |
if |
|
|
505 |
self._map[f] = |
|
|
505 | for f in allfiles: | |
|
506 | if f not in changedfiles: | |
|
507 | self._map[f] = oldmap[f] | |
|
506 | 508 | else: |
|
507 | self._map[f] = ('n', 0666, -1, 0) | |
|
509 | if 'x' in allfiles.flags(f): | |
|
510 | self._map[f] = ('n', 0777, -1, 0) | |
|
511 | else: | |
|
512 | self._map[f] = ('n', 0666, -1, 0) | |
|
508 | 513 | self._pl = (parent, nullid) |
|
509 | 514 | self._dirty = True |
|
510 | 515 |
@@ -420,6 +420,25 b' Verify strip protects against stripping ' | |||
|
420 | 420 | $ hg status |
|
421 | 421 | M bar |
|
422 | 422 | ? b |
|
423 | ||
|
424 | Strip adds, removes, modifies with --keep | |
|
425 | ||
|
426 | $ touch b | |
|
427 | $ hg add b | |
|
428 | $ hg commit -mb | |
|
429 | $ touch c | |
|
430 | $ hg add c | |
|
431 | $ hg rm bar | |
|
432 | $ hg commit -mc | |
|
433 | $ echo b > b | |
|
434 | $ echo d > d | |
|
435 | $ hg strip --keep tip | |
|
436 | saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob) | |
|
437 | $ hg status | |
|
438 | M b | |
|
439 | ! bar | |
|
440 | ? c | |
|
441 | ? d | |
|
423 | 442 | $ cd .. |
|
424 | 443 | |
|
425 | 444 | stripping many nodes on a complex graph (issue3299) |
General Comments 0
You need to be logged in to leave comments.
Login now