180 del q.applied[start:end] |
180 del q.applied[start:end] |
181 q.savedirty() |
181 q.savedirty() |
182 |
182 |
183 revs = sorted(rootnodes) |
183 revs = sorted(rootnodes) |
184 if update and opts.get('keep'): |
184 if update and opts.get('keep'): |
185 wlock = repo.wlock() |
185 urev, p2 = repo.changelog.parents(revs[0]) |
186 try: |
186 if (util.safehasattr(repo, 'mq') and p2 != nullid |
187 urev, p2 = repo.changelog.parents(revs[0]) |
187 and p2 in [x.node for x in repo.mq.applied]): |
188 if (util.safehasattr(repo, 'mq') and p2 != nullid |
188 urev = p2 |
189 and p2 in [x.node for x in repo.mq.applied]): |
189 uctx = repo[urev] |
190 urev = p2 |
190 |
191 uctx = repo[urev] |
191 # only reset the dirstate for files that would actually change |
192 |
192 # between the working context and uctx |
193 # only reset the dirstate for files that would actually change |
193 descendantrevs = repo.revs("%s::." % uctx.rev()) |
194 # between the working context and uctx |
194 changedfiles = [] |
195 descendantrevs = repo.revs("%s::." % uctx.rev()) |
195 for rev in descendantrevs: |
196 changedfiles = [] |
196 # blindly reset the files, regardless of what actually changed |
197 for rev in descendantrevs: |
197 changedfiles.extend(repo[rev].files()) |
198 # blindly reset the files, regardless of what actually |
198 |
199 # changed |
199 # reset files that only changed in the dirstate too |
200 changedfiles.extend(repo[rev].files()) |
200 dirstate = repo.dirstate |
201 |
201 dirchanges = [f for f in dirstate if dirstate[f] != 'n'] |
202 # reset files that only changed in the dirstate too |
202 changedfiles.extend(dirchanges) |
203 dirstate = repo.dirstate |
203 |
204 dirchanges = [f for f in dirstate if dirstate[f] != 'n'] |
204 repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles) |
205 changedfiles.extend(dirchanges) |
205 repo.dirstate.write() |
206 |
206 update = False |
207 repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles) |
|
208 repo.dirstate.write() |
|
209 update = False |
|
210 finally: |
|
211 wlock.release() |
|
212 |
207 |
213 if opts.get('bookmark'): |
208 if opts.get('bookmark'): |
214 if mark == repo._bookmarkcurrent: |
209 if mark == repo._bookmarkcurrent: |
215 bookmarks.unsetcurrent(repo) |
210 bookmarks.unsetcurrent(repo) |
216 del marks[mark] |
211 del marks[mark] |