changeset 4:5401fa8a11d4 draft tip

feat: add /stack command
author Zeger Van de Vannet <zeger@vandevan.net>
date Sun, 01 Jun 2025 22:23:41 +0200
parents 00f99f702ad9
children
files hgext3rd/topic_web.py templates/paper-extended/map templates/paper-extended/stack.tmpl
diffstat 3 files changed, 75 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic_web.py	Fri May 30 18:01:26 2025 +0200
+++ b/hgext3rd/topic_web.py	Sun Jun 01 22:23:41 2025 +0200
@@ -4,6 +4,9 @@
 from mercurial.hgweb import webcommands, webutil
 from mercurial import templateutil, extensions
 from mercurial.node import hex
+from mercurial.extensions import find
+
+topic = find(b'topic')
 
 @webcommands.webcommand(b"topics")
 def topics(web):
@@ -39,6 +42,23 @@
 
     return templateutil.mappinggenerator(entries)
 
[email protected](b"stack")
+def stack(web):
+    topic_name = web.req.qsparams[b'node']
+    stack = topic.stack.stack(web.repo, topic=topic_name)
+
+    return web.sendtemplate(b"stack", entries=stackentries(web, web.stripecount, stack))
+
+webcommands.stack = stack
+
+def stackentries(web, stripecount, stack):
+    def entries(context):
+        for rev in stack:
+            yield webutil.changelistentry(web, web.repo[rev])
+
+    return templateutil.mappinggenerator(entries)
+
+
 def commonentry(orig, repo, ctx):
     data = orig(repo, ctx)
     data[b'topic'] = ctx.topic()
--- a/templates/paper-extended/map	Fri May 30 18:01:26 2025 +0200
+++ b/templates/paper-extended/map	Sun Jun 01 22:23:41 2025 +0200
@@ -207,6 +207,7 @@
       </a>
     </td>
   </tr>'
+stack = stack.tmpl
 branches = branches.tmpl
 branchentry = '
   <tr class="tagEntry">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/paper-extended/stack.tmpl	Sun Jun 01 22:23:41 2025 +0200
@@ -0,0 +1,54 @@
+{header}
+<title>{repo|escape}: branches</title>
+<link rel="alternate" type="application/atom+xml"
+   href="{url|urlescape}atom-branches" title="Atom feed for {repo|escape}: branches" />
+<link rel="alternate" type="application/rss+xml"
+   href="{url|urlescape}rss-branches" title="RSS feed for {repo|escape}: branches" />
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="{logourl}">
+<img src="{staticurl|urlescape}{logoimg}" alt="mercurial" /></a>
+</div>
+<ul>
+<li><a href="{url|urlescape}shortlog{sessionvars%urlparameter}">log</a></li>
+<li><a href="{url|urlescape}graph{sessionvars%urlparameter}">graph</a></li>
+<li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li>
+<li class="active">branches</li>
+<li><a href="{url|urlescape}topics{sessionvars%urlparameter}">topics</a></li>
+</ul>
+<ul>
+ <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
+</ul>
+<div class="atom-logo">
+<a href="{url|urlescape}atom-branches" title="subscribe to atom feed">
+<img class="atom-logo" src="{staticurl|urlescape}feed-icon-14x14.png" alt="atom feed" />
+</a>
+</div>
+</div>
+
+<div class="main">
+<h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
+<h3>branches</h3>
+
+{searchform}
+
+<table class="bigtable">
+<thead>
+<tr>
+ <th>branch</th>
+ <th>node</th>
+</tr>
+</thead>
+<tbody class="stripes2">
+{entries % shortlogentry}
+</tbody>
+</table>
+</div>
+</div>
+
+{footer}
+