Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/cmdutil.py @ 37597:d110167610db
formatter: carry opts to file-based formatters by basefm
This makes it slightly easier to port "hg export" to formatter.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Thu, 12 Apr 2018 23:25:58 +0900 |
parents | d658cbef8041 |
children | 42a91897f090 |
comparison
equal
deleted
inserted
replaced
37596:8c121a9837ca | 37597:d110167610db |
---|---|
2229 # attempt to create the directory if it does not already exist | 2229 # attempt to create the directory if it does not already exist |
2230 try: | 2230 try: |
2231 os.makedirs(os.path.dirname(filename)) | 2231 os.makedirs(os.path.dirname(filename)) |
2232 except OSError: | 2232 except OSError: |
2233 pass | 2233 pass |
2234 with formatter.maybereopen(basefm, filename, opts) as fm: | 2234 with formatter.maybereopen(basefm, filename) as fm: |
2235 _updatecatformatter(fm, ctx, matcher, path, opts.get('decode')) | 2235 _updatecatformatter(fm, ctx, matcher, path, opts.get('decode')) |
2236 | 2236 |
2237 # Automation often uses hg cat on single files, so special case it | 2237 # Automation often uses hg cat on single files, so special case it |
2238 # for performance to avoid the cost of parsing the manifest. | 2238 # for performance to avoid the cost of parsing the manifest. |
2239 if len(matcher.files()) == 1 and not matcher.anypats(): | 2239 if len(matcher.files()) == 1 and not matcher.anypats(): |