Mercurial > hg-stable
diff mercurial/commands.py @ 20790:49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Some extensions set configuration settings that showed up in 'hg showconfig
--debug' with 'none' as source. That was confusing.
Instead, they will now tell which extension they come from.
This change tries to be consistent and specify a source everywhere - also where
it perhaps is less relevant.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 19 Mar 2014 02:45:14 +0100 |
parents | 43054dc84abd |
children | 8dd867bd67e1 |
line wrap: on
line diff
--- a/mercurial/commands.py Wed Mar 19 02:45:14 2014 +0100 +++ b/mercurial/commands.py Wed Mar 19 02:45:14 2014 +0100 @@ -465,7 +465,8 @@ rctx = scmutil.revsingle(repo, hex(parent)) if not opts.get('merge') and op1 != node: try: - ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) + ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), + 'backout') stats = mergemod.update(repo, parent, True, True, False, node, False) repo.setparents(op1, op2) @@ -479,7 +480,7 @@ ui.status(msg % short(node)) return stats[3] > 0 finally: - ui.setconfig('ui', 'forcemerge', '') + ui.setconfig('ui', 'forcemerge', '', '') else: hg.clean(repo, node, show_stats=False) repo.dirstate.setbranch(branch) @@ -507,10 +508,11 @@ ui.status(_('merging with changeset %s\n') % nice(repo.changelog.tip())) try: - ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) + ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), + 'backout') return hg.merge(repo, hex(repo.changelog.tip())) finally: - ui.setconfig('ui', 'forcemerge', '') + ui.setconfig('ui', 'forcemerge', '', '') finally: wlock.release() return 0 @@ -1361,7 +1363,7 @@ if opts.get('amend'): raise util.Abort(_('cannot amend with --subrepos')) # Let --subrepos on the command line override config setting. - ui.setconfig('ui', 'commitsubrepos', True) + ui.setconfig('ui', 'commitsubrepos', True, 'commit') # Save this for restoring it later oldcommitphase = ui.config('phases', 'new-commit') @@ -1436,15 +1438,17 @@ def commitfunc(ui, repo, message, match, opts): try: if opts.get('secret'): - ui.setconfig('phases', 'new-commit', 'secret') + ui.setconfig('phases', 'new-commit', 'secret', 'commit') # Propagate to subrepos - repo.baseui.setconfig('phases', 'new-commit', 'secret') + repo.baseui.setconfig('phases', 'new-commit', 'secret', + 'commit') return repo.commit(message, opts.get('user'), opts.get('date'), match, editor=e, extra=extra) finally: - ui.setconfig('phases', 'new-commit', oldcommitphase) - repo.baseui.setconfig('phases', 'new-commit', oldcommitphase) + ui.setconfig('phases', 'new-commit', oldcommitphase, 'commit') + repo.baseui.setconfig('phases', 'new-commit', oldcommitphase, + 'commit') node = cmdutil.commit(ui, repo, commitfunc, pats, opts) @@ -3196,11 +3200,12 @@ # perform the graft merge with p1(rev) as 'ancestor' try: # ui.forcemerge is an internal variable, do not document - repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) + repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), + 'graft') stats = mergemod.update(repo, ctx.node(), True, True, False, ctx.p1().node()) finally: - repo.ui.setconfig('ui', 'forcemerge', '') + repo.ui.setconfig('ui', 'forcemerge', '', 'graft') # report any conflicts if stats and stats[3] > 0: # write out state for --continue @@ -4325,10 +4330,10 @@ try: # ui.forcemerge is an internal variable, do not document - repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) + repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge') return hg.merge(repo, node, force=opts.get('force')) finally: - ui.setconfig('ui', 'forcemerge', '') + ui.setconfig('ui', 'forcemerge', '', 'merge') @command('outgoing|out', [('f', 'force', None, _('run even when the destination is unrelated')), @@ -4708,7 +4713,7 @@ """ if opts.get('bookmark'): - ui.setconfig('bookmarks', 'pushing', opts['bookmark']) + ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push') for b in opts['bookmark']: # translate -B options to -r so changesets get pushed if b in repo._bookmarks: @@ -4984,11 +4989,12 @@ try: # resolve file - ui.setconfig('ui', 'forcemerge', opts.get('tool', '')) + ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), + 'resolve') if ms.resolve(f, wctx): ret = 1 finally: - ui.setconfig('ui', 'forcemerge', '') + ui.setconfig('ui', 'forcemerge', '', 'resolve') ms.commit() # replace filemerge's .orig file with our resolve file @@ -5205,9 +5211,9 @@ val = opts.get(o, '') if val in (None, ''): # should check against default options instead continue - baseui.setconfig("web", o, val) + baseui.setconfig("web", o, val, 'serve') if repo and repo.ui != baseui: - repo.ui.setconfig("web", o, val) + repo.ui.setconfig("web", o, val, 'serve') o = opts.get('web_conf') or opts.get('webdir_conf') if not o: