changeset 6369:3271ec128328

branching: merge with stable
author Anton Shestakov <av6@dwimlabs.net>
date Tue, 17 Jan 2023 17:54:24 +0400
parents 7434edba87a0 (current diff) e8d85d51c7b2 (diff)
children 21f0813fa2f4
files hgext3rd/topic/discovery.py hgext3rd/topic/topicmap.py
diffstat 2 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/discovery.py	Tue Jan 03 16:23:58 2023 +0400
+++ b/hgext3rd/topic/discovery.py	Tue Jan 17 17:54:24 2023 +0400
@@ -30,6 +30,14 @@
 def override_context_branch(repo, publishedset=()):
     unfi = repo.unfiltered()
 
+    def overridebranch(p, origbranch):
+        def branch():
+            branch = origbranch()
+            if p.rev() in publishedset:
+                return common.formatfqbn(branch=branch)
+            return p.fqbn()
+        return branch
+
     class repocls(unfi.__class__):
         # awful hack to see branch as "branch//namespace/topic"
         def __getitem__(self, key):
@@ -49,14 +57,8 @@
                 for p in parents:
                     if getattr(p, '_topic_ext_branch_hack', False):
                         continue
-                    pbranch = p.branch
 
-                    def branch():
-                        branch = pbranch()
-                        if p.rev() in publishedset:
-                            return common.formatfqbn(branch=branch)
-                        return p.fqbn()
-                    p.branch = branch
+                    p.branch = overridebranch(p, p.branch)
                     p._topic_ext_branch_hack = True
                 return parents
 
--- a/hgext3rd/topic/topicmap.py	Tue Jan 03 16:23:58 2023 +0400
+++ b/hgext3rd/topic/topicmap.py	Tue Jan 17 17:54:24 2023 +0400
@@ -110,8 +110,9 @@
         return ret
     parents = ctx.parents()
 
-    if (not opts.get(b'amend') and bheads and node not in bheads and not
-        [x for x in parents if x.node() in bheads and x.branch() == branch]):
+    if (not opts.get(b'amend') and bheads and node not in bheads and not any(
+        p.node() in bheads and p.branch() == branch for p in parents
+    )):
         repo.ui.status(_(b"(consider using topic for lightweight branches."
                          b" See 'hg help topic')\n"))