diff hgext3rd/topic/__init__.py @ 6498:7ecb0f9cc7f3

topic: report namespace changes in more cases of phase movements
author Anton Shestakov <av6@dwimlabs.net>
date Fri, 09 Jun 2023 11:02:13 -0300
parents 4e0f760d332e
children afc41038dd3d
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Mon Jun 05 21:57:37 2023 -0300
+++ b/hgext3rd/topic/__init__.py	Fri Jun 09 11:02:13 2023 -0300
@@ -452,12 +452,15 @@
         tns = ctx.topic_namespace()
         affected.add(tns)
 
-    # Phase movements, we only care about changesets that move from or to
-    # public phase
+    # Phase movements, we only care about:
+    # - publishing changesets (since they lose topic namespace)
+    # - forcefully making changesets draft again
+    # - turning secret changesets draft and making them visible to peers
+    tnsphases = (phases.secret, phases.draft)
     for revs, (old, new) in tr.changes[b'phases']:
-        if old != phases.public and new != phases.public:
-            # new phase is public: publishing changesets
-            # old phase is public: e.g. hg phase --draft --force
+        if old not in tnsphases and new not in tnsphases:
+            # Skip phase movement if there is no phase (old or new) that has
+            # visible topic namespace (i.e. draft and secret)
             continue
         revs = [rev for rev in revs if rev < origrepolen]
         for rev in revs: