comparison hgext/uncommit.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 533820f5b997
children 7a8bfc05b691
comparison
equal deleted inserted replaced
49959:376395868b7b 49960:c166b212bdee
234 mapping[old.node()] = (newid,) 234 mapping[old.node()] = (newid,)
235 else: 235 else:
236 # Fully removed the old commit 236 # Fully removed the old commit
237 mapping[old.node()] = () 237 mapping[old.node()] = ()
238 238
239 with repo.dirstate.parentchange(): 239 with repo.dirstate.parentchange(repo):
240 scmutil.movedirstate(repo, repo[newid], match) 240 scmutil.movedirstate(repo, repo[newid], match)
241 241
242 scmutil.cleanupnodes(repo, mapping, b'uncommit', fixphase=True) 242 scmutil.cleanupnodes(repo, mapping, b'uncommit', fixphase=True)
243 243
244 244
315 ) 315 )
316 newprednode = repo.commitctx(newctx) 316 newprednode = repo.commitctx(newctx)
317 newpredctx = repo[newprednode] 317 newpredctx = repo[newprednode]
318 dirstate = repo.dirstate 318 dirstate = repo.dirstate
319 319
320 with dirstate.parentchange(): 320 with dirstate.parentchange(repo):
321 scmutil.movedirstate(repo, newpredctx) 321 scmutil.movedirstate(repo, newpredctx)
322 322
323 mapping = {curctx.node(): (newprednode,)} 323 mapping = {curctx.node(): (newprednode,)}
324 scmutil.cleanupnodes(repo, mapping, b'unamend', fixphase=True) 324 scmutil.cleanupnodes(repo, mapping, b'unamend', fixphase=True)