changeset 1274:d21b7259724a

layouts: add cached infix property to standard
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 24 Mar 2014 11:20:51 -0500
parents a1ca3d6be68c
children ca771cbf69c6
files hgsubversion/layouts/standard.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/layouts/standard.py
+++ b/hgsubversion/layouts/standard.py
@@ -16,6 +16,15 @@ class StandardLayout(base.BaseLayout):
                                pre=lambda x: '/'.join(p for p in x.split('/')
                                                       if p) + '/')
 
+        # infix is expected to be stripped of trailing slashes but retain
+        # its first slash
+        def _infix_transform(x):
+            x = '/'.join(p for p in x.split('/') if p)
+            if x:
+                x = '/' + x
+            return x
+        meta._gen_cachedconfig('infix', '', pre=_infix_transform)
+
         self._infix = self.meta.ui.config('hgsubversion', 'infix', '').strip('/')
         if self._infix:
             self._infix = '/' + self._infix