Mercurial > evolve
changeset 6699:ddebaa161306 stable
evolve: use functions from topic extension to set current topic and tns
In some cases in evolve we need to relocate commits on disk instead of purely
in-memory. Previously we were writing .hg/topic file by hand here, but it
wasn't the right thing to do, and also we could sometimes write an empty string
to the file. Let's use the functions in topic that are specifically made to
change current topic and tns.
I don't think we can simply manipulate commit extras to copy topic and
topic_namespace, because sometimes we can have unresolved merge conflicts
(since we're dealing with relocating on disk), and in this case users might
need to continue evolve later after resolving the situation, so I think we
definitely want to write current topic and tns to the files for persistence.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Thu, 22 Feb 2024 14:10:01 -0300 |
parents | 4c6d35f92469 |
children | 3635782b0290 |
files | hgext3rd/evolve/evolvecmd.py tests/test-issue-6028.t |
diffstat | 2 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py Tue Feb 06 08:59:43 2024 +0000 +++ b/hgext3rd/evolve/evolvecmd.py Thu Feb 22 14:10:01 2024 -0300 @@ -18,6 +18,7 @@ context, encoding, error, + extensions, hg, merge, mergeutil, @@ -991,13 +992,12 @@ compat._update(repo, dest, branchmerge=False, force=True) if keepbranch: compat.setbranch(repo, orig.branch()) - if util.safehasattr(repo, 'currenttopic'): - # uurrgs - # there no other topic setter yet - if not orig.topic() and repo.vfs.exists(b'topic'): - repo.vfs.unlink(b'topic') - else: - repo.vfs.write(b'topic', orig.topic()) + if util.safehasattr(repo, 'currenttns') and repo.currenttns != orig.topic_namespace(): + topic = extensions.find(b'topic') + topic._changecurrenttns(repo, orig.topic_namespace()) + if util.safehasattr(repo, 'currenttopic') and repo.currenttopic != orig.topic(): + topic = extensions.find(b'topic') + topic._changecurrenttopic(repo, orig.topic()) stats = merge.graft(repo, orig, pctx, [b'destination', b'evolving'], True)
--- a/tests/test-issue-6028.t Tue Feb 06 08:59:43 2024 +0000 +++ b/tests/test-issue-6028.t Thu Feb 22 14:10:01 2024 -0300 @@ -130,6 +130,11 @@ atop:[4] merged b working directory is now at c920dd828523 +checking that we didn't write an empty topic file when relocating the commit on disk + + $ test -f .hg/topic + [1] + casually checking issue6141: position of p2 is not changed $ hg log -r 'predecessors(.) + .'