Mercurial > public > mercurial-scm > hg
comparison mercurial/logcmdutil.py @ 45310:f3481e4fcc3a
templater: pass opened file-like object to templatespec
I think I said earlier that I planned to create a special templatespec
variant for built-in templates. That was true (I planned that), but I
ended up (in this patch) just adding a file-like object to the
`mapfile_templatespec()` variant instead.
Differential Revision: https://phab.mercurial-scm.org/D8893
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 04 Aug 2020 13:22:00 -0700 |
parents | 65a812ed9e9f |
children | 4aa484efc926 |
comparison
equal
deleted
inserted
replaced
45309:65a812ed9e9f | 45310:f3481e4fcc3a |
---|---|
624 else: | 624 else: |
625 style = util.expandpath(ui.config(b'ui', b'style')) | 625 style = util.expandpath(ui.config(b'ui', b'style')) |
626 | 626 |
627 if not tmpl and style: | 627 if not tmpl and style: |
628 mapfile = style | 628 mapfile = style |
629 fp = None | |
629 if not os.path.split(mapfile)[0]: | 630 if not os.path.split(mapfile)[0]: |
630 (mapname, fp) = templater.open_template( | 631 (mapname, fp) = templater.open_template( |
631 b'map-cmdline.' + mapfile | 632 b'map-cmdline.' + mapfile |
632 ) or templater.open_template(mapfile) | 633 ) or templater.open_template(mapfile) |
633 if mapname: | 634 if mapname: |
634 mapfile = mapname | 635 mapfile = mapname |
635 return formatter.mapfile_templatespec(b'changeset', mapfile) | 636 return formatter.mapfile_templatespec(b'changeset', mapfile, fp) |
636 | 637 |
637 return formatter.lookuptemplate(ui, b'changeset', tmpl) | 638 return formatter.lookuptemplate(ui, b'changeset', tmpl) |
638 | 639 |
639 | 640 |
640 def maketemplater(ui, repo, tmpl, buffered=False): | 641 def maketemplater(ui, repo, tmpl, buffered=False): |