changeset 6705:920f767589df

branching: merge with stable
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 25 Feb 2024 15:55:13 -0300
parents cc49139f580f (current diff) 3635782b0290 (diff)
children 50c0f1e2dfb6
files hgext3rd/evolve/evolvecmd.py hgext3rd/topic/topicmap.py
diffstat 3 files changed, 19 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py	Thu Jan 11 13:21:08 2024 -0300
+++ b/hgext3rd/evolve/evolvecmd.py	Sun Feb 25 15:55:13 2024 -0300
@@ -18,6 +18,7 @@
     context,
     encoding,
     error,
+    extensions,
     hg,
     merge,
     mergeutil,
@@ -984,13 +985,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/hgext3rd/topic/topicmap.py	Thu Jan 11 13:21:08 2024 -0300
+++ b/hgext3rd/topic/topicmap.py	Sun Feb 25 15:55:13 2024 -0300
@@ -69,16 +69,16 @@
 
 def _phaseshash(repo, maxrev):
     """uniq ID for a phase matching a set of rev"""
-    revs = set()
     cl = repo.changelog
     fr = cl.filteredrevs
-    getrev = compat.getgetrev(cl)
-    for n in compat.nonpublicphaseroots(repo):
-        r = getrev(n)
-        if r not in fr and r < maxrev:
-            revs.add(r)
+    nppr = compat.nonpublicphaseroots(repo)
+    # starting with hg 6.7rc0 phase roots are already revs instead of nodes
+    # hg <= 6.6 (68289ed170c7)
+    if not util.safehasattr(repo._phasecache, '_phaseroots'):
+        getrev = compat.getgetrev(cl)
+        nppr = set(getrev(n) for n in nppr)
+    revs = sorted(set(r for r in nppr if r not in fr and r < maxrev))
     key = nullid
-    revs = sorted(revs)
     if revs:
         s = hashlib.sha1()
         for rev in revs:
--- a/tests/test-issue-6028.t	Thu Jan 11 13:21:08 2024 -0300
+++ b/tests/test-issue-6028.t	Sun Feb 25 15:55:13 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(.) + .'