[Updated] D9250: rebase: use hard-coded template for one-line commit description

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Oct 29 01:50:19 UTC 2020


Closed by commit rHGb4c193509cd0: rebase: use hard-coded template for one-line commit description (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D9250?vs=23308&id=23323

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D9250/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D9250

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -34,6 +34,7 @@
     dirstateguard,
     error,
     extensions,
+    formatter,
     merge as mergemod,
     mergestate as mergestatemod,
     mergeutil,
@@ -51,6 +52,7 @@
     scmutil,
     smartset,
     state as statemod,
+    templatekw,
     util,
 )
 
@@ -146,20 +148,12 @@
 
 def _ctxdesc(ctx):
     """short description for a context"""
-    desc = b'%d:%s "%s"' % (
-        ctx.rev(),
-        ctx,
-        ctx.description().split(b'\n', 1)[0],
+    labels_spec = b'join(filter(namespaces % "{ifeq(namespace, "branches", "", join(names, " "))}"), " ")'
+    spec = b'{rev}:{node|short} "{desc|firstline}"{if(%s, " ({%s})")}' % (
+        labels_spec,
+        labels_spec,
     )
-    repo = ctx.repo()
-    names = []
-    for nsname, ns in pycompat.iteritems(repo.names):
-        if nsname == b'branches':
-            continue
-        names.extend(ns.names(repo, ctx.node()))
-    if names:
-        desc += b' (%s)' % b' '.join(names)
-    return desc
+    return cmdutil.rendertemplate(ctx, spec)
 
 
 class rebaseruntime(object):



To: martinvonz, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201029/0dc4e170/attachment-0002.html>


More information about the Mercurial-patches mailing list