Patchwork [2,of,7,V2] namespaces: add method to get template name of namespace

login
register
mail settings
Submitter Sean Farley
Date Dec. 18, 2014, 9:10 p.m.
Message ID <873ba6dc401458b59c14.1418937046@laptop.local>
Download mbox | patch
Permalink /patch/7174/
State Accepted
Headers show

Comments

Sean Farley - Dec. 18, 2014, 9:10 p.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1418613147 28800
#      Sun Dec 14 19:12:27 2014 -0800
# Node ID 873ba6dc401458b59c14cec91b9729d36064b8e3
# Parent  5b61f147d886111e0e783b01342e864af67e2af7
namespaces: add method to get template name of namespace

This patch adds the public api for getting the template name of a namespace so
that the next patch can use it to generate a template keyword automatically.

Patch

diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py
--- a/mercurial/namespaces.py
+++ b/mercurial/namespaces.py
@@ -82,5 +82,9 @@  class namespaces(object):
                     cl = repo.changelog
                     maxrev = max(cl.rev(node) for node in n)
                     return cl.node(maxrev)
                 return n[0]
         raise KeyError(_('no such name: %s') % name)
+
+    def templatename(self, namespace):
+        """method that returns the template name of a namespace"""
+        return self._names[namespace]['templatename']