templater: demote "base" directory of map file to local variable
authorYuya Nishihara <yuya@tcha.org>
Sun, 03 Apr 2016 23:22:43 +0900
changeset 28952 f59e24002678
parent 28951 1bba1b43525a
child 28953 7f6b8ec691e3
templater: demote "base" directory of map file to local variable It isn't referenced from other places.
mercurial/templater.py
--- a/mercurial/templater.py	Mon Apr 04 22:50:50 2016 +0900
+++ b/mercurial/templater.py	Sun Apr 03 23:22:43 2016 +0900
@@ -1003,10 +1003,6 @@
             cache = {}
         self.cache = cache.copy()
         self.map = {}
-        if mapfile:
-            self.base = os.path.dirname(mapfile)
-        else:
-            self.base = ''
         self.filters = templatefilters.filters.copy()
         self.filters.update(filters)
         self.defaults = defaults
@@ -1019,6 +1015,7 @@
             raise error.Abort(_("style '%s' not found") % mapfile,
                              hint=_("available styles: %s") % stylelist())
 
+        base = os.path.dirname(mapfile)
         conf = config.config(includepaths=templatepaths())
         conf.read(mapfile)
 
@@ -1034,7 +1031,7 @@
                 val = 'default', val
                 if ':' in val[1]:
                     val = val[1].split(':', 1)
-                self.map[key] = val[0], os.path.join(self.base, val[1])
+                self.map[key] = val[0], os.path.join(base, val[1])
 
     def __contains__(self, key):
         return key in self.cache or key in self.map