topic: extend topic gating to descendant stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 04 Mar 2020 17:08:05 +0100
branchstable
changeset 5150 e0c091b199bc
parent 5149 3f40b39d091e
child 5152 583dc6ef3eb2
topic: extend topic gating to descendant If a changeset with topic as descendant without topic, we need to exclude them too when using: topic.server-gate-topic-changesets.
hgext3rd/topic/server.py
tests/test-topic-server.t
--- a/hgext3rd/topic/server.py	Wed Mar 04 16:53:32 2020 +0100
+++ b/hgext3rd/topic/server.py	Wed Mar 04 17:08:05 2020 +0100
@@ -50,6 +50,7 @@
         if cl.changelogrevision(r).extra.get(constants.extrakey, b''):
             extrafiltered.add(r)
     if extrafiltered:
+        extrafiltered = set(repo.revs('%ld::%ld', extrafiltered, consider))
         filteredrevs = frozenset(filteredrevs | extrafiltered)
     return filteredrevs
 
--- a/tests/test-topic-server.t	Wed Mar 04 16:53:32 2020 +0100
+++ b/tests/test-topic-server.t	Wed Mar 04 17:08:05 2020 +0100
@@ -99,6 +99,15 @@
   $ echo c > c
   $ hg commit -Am 'adding c (no topic)'
   adding c
+  $ hg up some-work
+  switching to topic some-work
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg topic --clear
+  $ echo d > d
+  $ hg commit -Am 'adding d (no topic)'
+  adding d
+  created new head
+  (consider using topic for lightweight branches. See 'hg help topic')
   $ hg log -r 'all() - 0'
   changeset:   1:2a2e8b3520f2
   topic:       some-work
@@ -107,12 +116,18 @@
   summary:     adding b (topic)
   
   changeset:   2:b46feb4d24f9
-  tag:         tip
   parent:      0:6569b5a81c7e
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     adding c (no topic)
   
+  changeset:   3:be22ca6e89ea
+  tag:         tip
+  parent:      1:2a2e8b3520f2
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     adding d (no topic)
+  
 
 (disable the bare publishing to put a bare draft on the server)
 
@@ -120,16 +135,16 @@
   > [experimental]
   > topic.publish-bare-branch = no
   > EOF
-  $ hg push
+  $ hg push --force
   pushing to ssh://user@dummy/server
   searching for changes
   remote: adding changesets
   remote: adding manifests
   remote: adding file changes
-  remote: added 2 changesets with 2 changes to 2 files (+1 heads)
+  remote: added 3 changesets with 3 changes to 3 files (+1 heads)
   $ cd ..
   $ hg --cwd server phase -r 'tip'
-  2: draft
+  3: draft
 
 Clients with topic can exchange draft changesets both with and without a topic through the server
 
@@ -139,9 +154,9 @@
   adding changesets
   adding manifests
   adding file changes
-  added 2 changesets with 2 changes to 2 files (+1 heads)
-  new changesets 2a2e8b3520f2:b46feb4d24f9 (2 drafts)
-  (run 'hg heads' to see heads)
+  added 3 changesets with 3 changes to 3 files (+1 heads)
+  new changesets 2a2e8b3520f2:be22ca6e89ea (3 drafts)
+  (run 'hg heads' to see heads, 'hg merge' to merge)
   $ hg --cwd client-topic2 log -r 'all() - 0'
   changeset:   1:2a2e8b3520f2
   topic:       some-work
@@ -150,12 +165,18 @@
   summary:     adding b (topic)
   
   changeset:   2:b46feb4d24f9
-  tag:         tip
   parent:      0:6569b5a81c7e
   user:        test
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     adding c (no topic)
   
+  changeset:   3:be22ca6e89ea
+  tag:         tip
+  parent:      1:2a2e8b3520f2
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     adding d (no topic)
+  
 
 Client without topic only sees draft changesets if they don't have a topic