From patchwork Fri Apr 15 13:15:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3, of, 9] templater: demote "base" directory of map file to local variable From: Yuya Nishihara X-Patchwork-Id: 14642 Message-Id: <00ae86afdecc3366a3dd.1460726142@mimosa> To: mercurial-devel@mercurial-scm.org Date: Fri, 15 Apr 2016 22:15:42 +0900 # HG changeset patch # User Yuya Nishihara # Date 1459693363 -32400 # Sun Apr 03 23:22:43 2016 +0900 # Node ID 00ae86afdecc3366a3dd5a5dfcd31255c7016873 # Parent a6bfba7f79df88616e005b693157221528c41c0d templater: demote "base" directory of map file to local variable It isn't referenced from other places. diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -1003,10 +1003,6 @@ class templater(object): 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 @@ class templater(object): 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 @@ class templater(object): 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