comparison hgext/narrow/narrowcommands.py @ 49960:c166b212bdee

dirstate: pass the repo to the `changeparent` method If we want the context to be responsible for writing (and we want it), we need to have access to a localrepository object. So we now requires a localrepository object as an argument to this context manager.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 25 Jan 2023 18:46:20 +0100
parents 4188e75af983
children 7a8bfc05b691
comparison
equal deleted inserted replaced
49959:376395868b7b 49960:c166b212bdee
318 ui.status(_(b'deleting %s\n') % f) 318 ui.status(_(b'deleting %s\n') % f)
319 util.unlinkpath(repo.svfs.join(f)) 319 util.unlinkpath(repo.svfs.join(f))
320 repo.store.markremoved(f) 320 repo.store.markremoved(f)
321 321
322 ui.status(_(b'deleting unwanted files from working copy\n')) 322 ui.status(_(b'deleting unwanted files from working copy\n'))
323 with repo.dirstate.parentchange(): 323 with repo.dirstate.parentchange(repo):
324 narrowspec.updateworkingcopy(repo, assumeclean=True) 324 narrowspec.updateworkingcopy(repo, assumeclean=True)
325 narrowspec.copytoworkingcopy(repo) 325 narrowspec.copytoworkingcopy(repo)
326 326
327 repo.destroyed() 327 repo.destroyed()
328 328
378 common = commoninc[0] 378 common = commoninc[0]
379 with ui.uninterruptible(): 379 with ui.uninterruptible():
380 if ellipsesremote: 380 if ellipsesremote:
381 ds = repo.dirstate 381 ds = repo.dirstate
382 p1, p2 = ds.p1(), ds.p2() 382 p1, p2 = ds.p1(), ds.p2()
383 with ds.parentchange(): 383 with ds.parentchange(repo):
384 ds.setparents(repo.nullid, repo.nullid) 384 ds.setparents(repo.nullid, repo.nullid)
385 if isoldellipses: 385 if isoldellipses:
386 with wrappedextraprepare: 386 with wrappedextraprepare:
387 exchange.pull(repo, remote, heads=common) 387 exchange.pull(repo, remote, heads=common)
388 else: 388 else:
417 ) 417 )
418 # TODO: we should catch error.Abort here 418 # TODO: we should catch error.Abort here
419 bundle2.processbundle(repo, bundle, op=op, remote=remote) 419 bundle2.processbundle(repo, bundle, op=op, remote=remote)
420 420
421 if ellipsesremote: 421 if ellipsesremote:
422 with ds.parentchange(): 422 with ds.parentchange(repo):
423 ds.setparents(p1, p2) 423 ds.setparents(p1, p2)
424 424
425 with repo.transaction(b'widening'), repo.dirstate.parentchange(): 425 with repo.transaction(b'widening'), repo.dirstate.parentchange(repo):
426 repo.setnewnarrowpats() 426 repo.setnewnarrowpats()
427 narrowspec.updateworkingcopy(repo) 427 narrowspec.updateworkingcopy(repo)
428 narrowspec.copytoworkingcopy(repo) 428 narrowspec.copytoworkingcopy(repo)
429 429
430 430
589 return 0 589 return 0
590 590
591 if update_working_copy: 591 if update_working_copy:
592 with repo.wlock(), repo.lock(), repo.transaction( 592 with repo.wlock(), repo.lock(), repo.transaction(
593 b'narrow-wc' 593 b'narrow-wc'
594 ), repo.dirstate.parentchange(): 594 ), repo.dirstate.parentchange(repo):
595 narrowspec.updateworkingcopy(repo) 595 narrowspec.updateworkingcopy(repo)
596 narrowspec.copytoworkingcopy(repo) 596 narrowspec.copytoworkingcopy(repo)
597 return 0 597 return 0
598 598
599 if not (widening or narrowing or autoremoveincludes): 599 if not (widening or narrowing or autoremoveincludes):