Mercurial > hg-stable
changeset 27740:da5634e1b8a3
merge: factor out code to get checkunknown config
We're going to reuse this code shortly.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 12 Jan 2016 18:12:35 -0800 |
parents | d6d3cf5fda6f |
children | 3951f132958f |
files | mercurial/merge.py |
diffstat | 1 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/merge.py Tue Jan 05 17:37:59 2016 -0800 +++ b/mercurial/merge.py Tue Jan 12 18:12:35 2016 -0800 @@ -557,6 +557,16 @@ Meant for use by custom merge drivers.""" self._results[f] = 0, 'g' +def _getcheckunknownconfig(repo, section, name): + config = repo.ui.config(section, name, default='abort') + valid = ['abort', 'ignore', 'warn'] + if config not in valid: + validstr = ', '.join(["'" + v + "'" for v in valid]) + raise error.ConfigError(_("%s.%s not valid " + "('%s' is none of %s)") + % (section, name, config, validstr)) + return config + def _checkunknownfile(repo, wctx, mctx, f, f2=None): if f2 is None: f2 = f @@ -573,14 +583,7 @@ """ conflicts = set() if not force: - config = repo.ui.config('merge', 'checkunknown', default='abort') - valid = ['abort', 'ignore', 'warn'] - if config not in valid: - validstr = ', '.join(["'" + v + "'" for v in valid]) - raise error.ConfigError(_("merge.checkunknown not valid " - "('%s' is none of %s)") - % (config, validstr)) - + config = _getcheckunknownconfig(repo, 'merge', 'checkunknown') for f, (m, args, msg) in actions.iteritems(): if m in ('c', 'dc'): if _checkunknownfile(repo, wctx, mctx, f):