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

login
register
mail settings
Submitter Sean Farley
Date Dec. 17, 2014, 12:01 a.m.
Message ID <20d4ee5a54a247e6b5f8.1418774516@laptop.local>
Download mbox | patch
Permalink /patch/7130/
State Changes Requested
Headers show

Comments

Sean Farley - Dec. 17, 2014, 12:01 a.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 20d4ee5a54a247e6b5f8190276a665b96317bd51
# Parent  47d0996687d81753386f01e26037be30992dbb59
namespaces: add method to get singular name of namespace

Patch

diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py
--- a/mercurial/namespaces.py
+++ b/mercurial/namespaces.py
@@ -83,5 +83,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 singular(self, namespace):
+        """method that returns the singular version of a namespace"""
+        return self._names[namespace]['singular']