Mercurial > hg-stable
comparison hgext/uncommit.py @ 50023:7a8bfc05b691
dirstate: rename parentchange to changing_parents
Since the new argument breaks the API anyway, we can rename it to a better name.
The previous name `parentchange` might be seen as something active, a function
that would directly change the parents, however this is just a context manager
to frame the operation that will change the parents and adjust the
dirstate content accordingly.
In addition, the future sister method that will be about changes to tracking and
files would have a hard time fitting in the same naming scheme in a clear way.
The new naming uses a clear prefix will make it more distinct from other
dirstate methods and easier to extend with other similar contexts.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 25 Jan 2023 19:12:31 +0100 |
parents | c166b212bdee |
children | 2eca8b5c8cbd |
comparison
equal
deleted
inserted
replaced
50022:c166b212bdee | 50023:7a8bfc05b691 |
---|---|
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(repo): | 239 with repo.dirstate.changing_parents(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(repo): | 320 with dirstate.changing_parents(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) |