diff hgext3rd/topic/__init__.py @ 5935:aff365171309

branching: merge with stable
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 25 May 2021 18:46:09 +0200
parents 16f3fb304285 8d36bfe9968a
children daca8f4f7014
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Wed Mar 03 12:40:59 2021 +0530
+++ b/hgext3rd/topic/__init__.py	Tue May 25 18:46:09 2021 +0200
@@ -589,7 +589,9 @@
 
             topicmodeserver = self.ui.config(b'experimental',
                                              b'topic-mode.server', b'ignore')
-            ispush = (desc.startswith(b'push') or desc.startswith(b'serve'))
+            publishbare = self.ui.configbool(b'experimental',
+                                             b'topic.publish-bare-branch')
+            ispush = desc.startswith((b'push', b'serve'))
             if (topicmodeserver != b'ignore' and ispush):
                 if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66)
                     origvalidator = tr.validator
@@ -615,10 +617,7 @@
                 else:
                     tr.addvalidator(b'000-reject-untopiced', _validate)
 
-            elif (self.ui.configbool(b'experimental', b'topic.publish-bare-branch')
-                    and (desc.startswith(b'push')
-                         or desc.startswith(b'serve'))
-                    ):
+            elif publishbare and ispush:
                 origclose = tr.close
                 trref = weakref.ref(tr)
 
@@ -1060,6 +1059,14 @@
     for r in revs:
         c = repo[r]
 
+        if len(c.parents()) > 1:
+            # ctx.files() isn't reliable for merges, so fall back to the
+            # slower repo.status() method
+            st = c.p1().status(c)
+            files = set(st.modified) | set(st.added) | set(st.removed)
+        else:
+            files = set(c.files())
+
         def filectxfn(repo, ctx, path):
             try:
                 return c[path]
@@ -1098,7 +1105,7 @@
         mc = context.memctx(repo,
                             (p1, p2),
                             c.description(),
-                            c.files(),
+                            files,
                             filectxfn,
                             user=c.user(),
                             date=c.date(),