Patchwork [3,of,3] namespaces: add branches

login
register
mail settings
Submitter Ryan McElroy
Date Dec. 15, 2014, 3:35 a.m.
Message ID <39cead85fd58ae669359.1418614533@devbig105.prn2.facebook.com>
Download mbox | patch
Permalink /patch/7113/
State Accepted
Headers show

Comments

Ryan McElroy - Dec. 15, 2014, 3:35 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1413584832 25200
#      Fri Oct 17 15:27:12 2014 -0700
# Node ID 39cead85fd58ae6693592074656b284ed736d9bc
# Parent  8b7c99b4d8ef8cd40712ad4c154111a51871e1b4
namespaces: add branches

Note that the exception-catching from the previous branchtip check is moved up
to catch exceptions from the try block surrounding the namespace lookup.
Pierre-Yves David - Dec. 15, 2014, 3:46 a.m.
On 12/14/2014 07:35 PM, Ryan McElroy wrote:
> # HG changeset patch
> # User Sean Farley <sean.michael.farley@gmail.com>
> # Date 1413584832 25200
> #      Fri Oct 17 15:27:12 2014 -0700
> # Node ID 39cead85fd58ae6693592074656b284ed736d9bc
> # Parent  8b7c99b4d8ef8cd40712ad4c154111a51871e1b4
> namespaces: add branches

Pushed to the clowncopter, thanks.

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -414,11 +414,6 @@  class changectx(basectx):
                 return
             except KeyError:
                 pass
-
-            try:
-                self._node = repo.branchtip(changeid)
-                self._rev = repo.changelog.rev(self._node)
-                return
             except error.FilteredRepoLookupError:
                 raise
             except error.RepoLookupError:
diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py
--- a/mercurial/namespaces.py
+++ b/mercurial/namespaces.py
@@ -44,6 +44,9 @@  class namespaces(object):
         addns("tags",
               lambda repo, name: tolist(repo._tagscache.tags.get(name)))
 
+        addns("branches",
+              lambda repo, name: tolist(repo.branchtip(name)))
+
     def addnamespace(self, namespace, namemap, order=None):
         """
         register a namespace