Patchwork [5,of,8] namespaces: add a convenience property for the weakref _repo

login
register
mail settings
Submitter Sean Farley
Date Dec. 15, 2014, 12:37 a.m.
Message ID <6571c7c1c58e8f2eaac9.1418603873@laptop.local>
Download mbox | patch
Permalink /patch/7098/
State Accepted
Headers show

Comments

Sean Farley - Dec. 15, 2014, 12:37 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley@gmail.com>
# Date 1418602944 28800
#      Sun Dec 14 16:22:24 2014 -0800
# Node ID 6571c7c1c58e8f2eaac936b32d2195863c7b6ab9
# Parent  4d7a45c8487a63ac54971c4dbeddf2dac922a91f
namespaces: add a convenience property for the weakref _repo

Patch

diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py
--- a/mercurial/namespaces.py
+++ b/mercurial/namespaces.py
@@ -44,10 +44,14 @@  class namespaces(object):
 
     def __init__(self, repo):
         self._names = util.sortdict()
         self._repo = weakref.ref(repo)
 
+    @property
+    def repo(self):
+        return self._repo()
+
     def addnamespace(self, namespace, singular, names, namemap, nodemap,
                      order=None):
         """
         register a namespace