changeset 5685:7ee15bf011d6

topic: wrap branch call during summary Right now, this introduce a bug… however this will prevent the next changesets to break the computation for "how many other changeset on that branch". That last remaining bug (introduced in this series) seems a lesser evil.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 23 Dec 2020 13:50:23 +0100
parents 4de216446c53
children ff84b99569b0
files hgext3rd/topic/__init__.py tests/test-split.t tests/test-topic-fold.t tests/test-topic-stack-data.t tests/test-topic-stack.t tests/test-topic-tutorial.t
diffstat 6 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Wed Dec 23 13:49:45 2020 +0100
+++ b/hgext3rd/topic/__init__.py	Wed Dec 23 13:50:23 2020 +0100
@@ -367,6 +367,10 @@
         return [t]
     return []
 
+def wrap_summary(orig, ui, repo, *args, **kwargs):
+    with discovery.override_context_branch(repo) as repo:
+        return orig(ui, repo, *args, **kwargs)
+
 def uisetup(ui):
     destination.modsetup(ui)
     discovery.modsetup(ui)
@@ -402,6 +406,8 @@
     # plug into logic for this into mergemod.update().
     extensions.wrapcommand(commands.table, b'update', checkt0)
 
+    extensions.wrapcommand(commands.table, b'summary', wrap_summary)
+
     try:
         evolve = extensions.find(b'evolve')
         extensions.wrapfunction(evolve.rewriteutil, "presplitupdate",
--- a/tests/test-split.t	Wed Dec 23 13:49:45 2020 +0100
+++ b/tests/test-split.t	Wed Dec 23 13:50:23 2020 +0100
@@ -442,7 +442,7 @@
   $ hg summary
   parent: 18:26f72cfaf036 tip
    Works on mytopic
-  branch: new-branch
+  branch: new-branch:mytopic
   commit: 2 unknown (clean)
   update: (current)
   phases: 9 draft
--- a/tests/test-topic-fold.t	Wed Dec 23 13:49:45 2020 +0100
+++ b/tests/test-topic-fold.t	Wed Dec 23 13:50:23 2020 +0100
@@ -65,7 +65,7 @@
   $ hg summary
   parent: 3:4fd43e5bdc44 tip
    folded
-  branch: default
+  branch: default:myfeature
   commit: (clean)
   update: (current)
   phases: 2 draft
--- a/tests/test-topic-stack-data.t	Wed Dec 23 13:49:45 2020 +0100
+++ b/tests/test-topic-stack-data.t	Wed Dec 23 13:50:23 2020 +0100
@@ -114,7 +114,7 @@
   $ hg summary
   parent: 21:3e54b49a3113 tip
    add foo_b
-  branch: lake
+  branch: lake:foo
   commit: (clean)
   update: (current)
   phases: 22 draft
--- a/tests/test-topic-stack.t	Wed Dec 23 13:49:45 2020 +0100
+++ b/tests/test-topic-stack.t	Wed Dec 23 13:50:23 2020 +0100
@@ -313,7 +313,7 @@
   $ hg summary
   parent: 3:e629654d7050 
    c_d
-  branch: default
+  branch: default:foo
   commit: (clean)
   update: 2 new changesets (update)
   phases: 4 draft
--- a/tests/test-topic-tutorial.t	Wed Dec 23 13:49:45 2020 +0100
+++ b/tests/test-topic-tutorial.t	Wed Dec 23 13:50:23 2020 +0100
@@ -108,8 +108,8 @@
   $ hg summary
   parent: 0:38da43f0a2ea tip
    Shopping list
-  branch: default
-  commit: (clean)
+  branch: default:food
+  commit: (new branch)
   update: (current)
   topic:  food