##// END OF EJS Templates
strip: use a `changing_parents` context for --keep update...
marmoute -
r51007:62158471 default
parent child Browse files
Show More
@@ -241,31 +241,32 b' def debugstrip(ui, repo, *revs, **opts):'
241 241
242 242 revs = sorted(rootnodes)
243 243 if update and opts.get(b'keep'):
244 urev = _findupdatetarget(repo, revs)
245 uctx = repo[urev]
244 with repo.dirstate.changing_parents(repo):
245 urev = _findupdatetarget(repo, revs)
246 uctx = repo[urev]
246 247
247 # only reset the dirstate for files that would actually change
248 # between the working context and uctx
249 descendantrevs = repo.revs(b"only(., %d)", uctx.rev())
250 changedfiles = []
251 for rev in descendantrevs:
252 # blindly reset the files, regardless of what actually changed
253 changedfiles.extend(repo[rev].files())
248 # only reset the dirstate for files that would actually change
249 # between the working context and uctx
250 descendantrevs = repo.revs(b"only(., %d)", uctx.rev())
251 changedfiles = []
252 for rev in descendantrevs:
253 # blindly reset the files, regardless of what actually changed
254 changedfiles.extend(repo[rev].files())
254 255
255 # reset files that only changed in the dirstate too
256 dirstate = repo.dirstate
257 dirchanges = [
258 f for f in dirstate if not dirstate.get_entry(f).maybe_clean
259 ]
260 changedfiles.extend(dirchanges)
256 # reset files that only changed in the dirstate too
257 dirstate = repo.dirstate
258 dirchanges = [
259 f for f in dirstate if not dirstate.get_entry(f).maybe_clean
260 ]
261 changedfiles.extend(dirchanges)
261 262
262 repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles)
263 repo.dirstate.write(repo.currenttransaction())
263 repo.dirstate.rebuild(urev, uctx.manifest(), changedfiles)
264 repo.dirstate.write(repo.currenttransaction())
264 265
265 # clear resolve state
266 mergestatemod.mergestate.clean(repo)
266 # clear resolve state
267 mergestatemod.mergestate.clean(repo)
267 268
268 update = False
269 update = False
269 270
270 271 strip(
271 272 ui,
General Comments 0
You need to be logged in to leave comments. Login now