##// END OF EJS Templates
config: set a 'source' in most cases where config don't come from file but code...
Mads Kiilerich -
r20790:49f2d564 default
parent child Browse files
Show More
@@ -151,7 +151,7 b' class eolfile(object):'
151 151 self.cfg = config.config()
152 152 # Our files should not be touched. The pattern must be
153 153 # inserted first override a '** = native' pattern.
154 self.cfg.set('patterns', '.hg*', 'BIN')
154 self.cfg.set('patterns', '.hg*', 'BIN', 'eol')
155 155 # We can then parse the user's patterns.
156 156 self.cfg.parse('.hgeol', data)
157 157
@@ -176,14 +176,14 b' class eolfile(object):'
176 176 for pattern, style in self.cfg.items('patterns'):
177 177 key = style.upper()
178 178 try:
179 ui.setconfig('decode', pattern, self._decode[key])
180 ui.setconfig('encode', pattern, self._encode[key])
179 ui.setconfig('decode', pattern, self._decode[key], 'eol')
180 ui.setconfig('encode', pattern, self._encode[key], 'eol')
181 181 except KeyError:
182 182 ui.warn(_("ignoring unknown EOL style '%s' from %s\n")
183 183 % (style, self.cfg.source('patterns', pattern)))
184 184 # eol.only-consistent can be specified in ~/.hgrc or .hgeol
185 185 for k, v in self.cfg.items('eol'):
186 ui.setconfig('eol', k, v)
186 ui.setconfig('eol', k, v, 'eol')
187 187
188 188 def checkrev(self, repo, ctx, files):
189 189 failed = []
@@ -261,7 +261,7 b' def preupdate(ui, repo, hooktype, parent'
261 261 return False
262 262
263 263 def uisetup(ui):
264 ui.setconfig('hooks', 'preupdate.eol', preupdate)
264 ui.setconfig('hooks', 'preupdate.eol', preupdate, 'eol')
265 265
266 266 def extsetup(ui):
267 267 try:
@@ -280,7 +280,7 b' def reposetup(ui, repo):'
280 280 for name, fn in filters.iteritems():
281 281 repo.adddatafilter(name, fn)
282 282
283 ui.setconfig('patch', 'eol', 'auto')
283 ui.setconfig('patch', 'eol', 'auto', 'eol')
284 284
285 285 class eolrepo(repo.__class__):
286 286
@@ -198,7 +198,8 b' def commitfuncfor(repo, src):'
198 198 def commitfunc(**kwargs):
199 199 phasebackup = repo.ui.backupconfig('phases', 'new-commit')
200 200 try:
201 repo.ui.setconfig('phases', 'new-commit', phasemin)
201 repo.ui.setconfig('phases', 'new-commit', phasemin,
202 'histedit')
202 203 extra = kwargs.get('extra', {}).copy()
203 204 extra['histedit_source'] = src.hex()
204 205 kwargs['extra'] = extra
@@ -220,11 +221,12 b' def applychanges(ui, repo, ctx, opts):'
220 221 else:
221 222 try:
222 223 # ui.forcemerge is an internal variable, do not document
223 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
224 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
225 'histedit')
224 226 stats = mergemod.update(repo, ctx.node(), True, True, False,
225 227 ctx.p1().node())
226 228 finally:
227 repo.ui.setconfig('ui', 'forcemerge', '')
229 repo.ui.setconfig('ui', 'forcemerge', '', 'histedit')
228 230 repo.setparents(wcpar, node.nullid)
229 231 repo.dirstate.write()
230 232 # fix up dirstate for copies and renames
@@ -375,7 +377,7 b' def finishfold(ui, repo, ctx, oldctx, ne'
375 377 phasebackup = repo.ui.backupconfig('phases', 'new-commit')
376 378 try:
377 379 phasemin = max(ctx.phase(), oldctx.phase())
378 repo.ui.setconfig('phases', 'new-commit', phasemin)
380 repo.ui.setconfig('phases', 'new-commit', phasemin, 'histedit')
379 381 n = collapse(repo, ctx, repo[newnode], commitopts)
380 382 finally:
381 383 repo.ui.restoreconfig(phasebackup)
@@ -385,10 +385,10 b' def demo(ui, repo, *args, **opts):'
385 385 tmpdir = tempfile.mkdtemp('', 'kwdemo.')
386 386 ui.note(_('creating temporary repository at %s\n') % tmpdir)
387 387 repo = localrepo.localrepository(repo.baseui, tmpdir, True)
388 ui.setconfig('keyword', fn, '')
388 ui.setconfig('keyword', fn, '', 'keyword')
389 389 svn = ui.configbool('keywordset', 'svn')
390 390 # explicitly set keywordset for demo output
391 ui.setconfig('keywordset', 'svn', svn)
391 ui.setconfig('keywordset', 'svn', svn, 'keyword')
392 392
393 393 uikwmaps = ui.configitems('keywordmaps')
394 394 if args or opts.get('rcfile'):
@@ -419,7 +419,7 b' def demo(ui, repo, *args, **opts):'
419 419 if uikwmaps:
420 420 ui.status(_('\tdisabling current template maps\n'))
421 421 for k, v in kwmaps.iteritems():
422 ui.setconfig('keywordmaps', k, v)
422 ui.setconfig('keywordmaps', k, v, 'keyword')
423 423 else:
424 424 ui.status(_('\n\tconfiguration using current keyword template maps\n'))
425 425 if uikwmaps:
@@ -445,7 +445,7 b' def demo(ui, repo, *args, **opts):'
445 445 wlock.release()
446 446 for name, cmd in ui.configitems('hooks'):
447 447 if name.split('.', 1)[0].find('commit') > -1:
448 repo.ui.setconfig('hooks', name, '')
448 repo.ui.setconfig('hooks', name, '', 'keyword')
449 449 msg = _('hg keyword configuration and expansion example')
450 450 ui.note(("hg ci -m '%s'\n" % msg))
451 451 repo.commit(text=msg)
@@ -510,5 +510,6 b' def reposetup(ui, repo):'
510 510 repo.requirements.add('largefiles')
511 511 repo._writerequirements()
512 512
513 ui.setconfig('hooks', 'changegroup.lfiles', checkrequireslfiles)
514 ui.setconfig('hooks', 'commit.lfiles', checkrequireslfiles)
513 ui.setconfig('hooks', 'changegroup.lfiles', checkrequireslfiles,
514 'largefiles')
515 ui.setconfig('hooks', 'commit.lfiles', checkrequireslfiles, 'largefiles')
@@ -304,7 +304,7 b' def newcommit(repo, phase, *args, **kwar'
304 304 backup = repo.ui.backupconfig('phases', 'new-commit')
305 305 try:
306 306 if phase is not None:
307 repo.ui.setconfig('phases', 'new-commit', phase)
307 repo.ui.setconfig('phases', 'new-commit', phase, 'mq')
308 308 return repo.commit(*args, **kwargs)
309 309 finally:
310 310 if phase is not None:
@@ -129,8 +129,8 b' def uisetup(ui):'
129 129 if (always or auto and
130 130 (cmd in attend or
131 131 (cmd not in ignore and not attend))):
132 ui.setconfig('ui', 'formatted', ui.formatted())
133 ui.setconfig('ui', 'interactive', False)
132 ui.setconfig('ui', 'formatted', ui.formatted(), 'pager')
133 ui.setconfig('ui', 'interactive', False, 'pager')
134 134 if util.safehasattr(signal, "SIGPIPE"):
135 135 signal.signal(signal.SIGPIPE, signal.SIG_DFL)
136 136 _runpager(ui, p)
@@ -546,11 +546,11 b' def patchbomb(ui, repo, *revs, **opts):'
546 546 if not sendmail:
547 547 verifycert = ui.config('smtp', 'verifycert')
548 548 if opts.get('insecure'):
549 ui.setconfig('smtp', 'verifycert', 'loose')
549 ui.setconfig('smtp', 'verifycert', 'loose', 'patchbomb')
550 550 try:
551 551 sendmail = mail.connect(ui, mbox=mbox)
552 552 finally:
553 ui.setconfig('smtp', 'verifycert', verifycert)
553 ui.setconfig('smtp', 'verifycert', verifycert, 'patchbomb')
554 554 ui.status(_('sending '), subj, ' ...\n')
555 555 ui.progress(_('sending'), i, item=subj, total=len(msgs))
556 556 if not mbox:
@@ -330,14 +330,15 b' def rebase(ui, repo, **opts):'
330 330 repo.ui.debug('resuming interrupted rebase\n')
331 331 else:
332 332 try:
333 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
333 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
334 'rebase')
334 335 stats = rebasenode(repo, rev, p1, state, collapsef)
335 336 if stats and stats[3] > 0:
336 337 raise error.InterventionRequired(
337 338 _('unresolved conflicts (see hg '
338 339 'resolve, then hg rebase --continue)'))
339 340 finally:
340 ui.setconfig('ui', 'forcemerge', '')
341 ui.setconfig('ui', 'forcemerge', '', 'rebase')
341 342 cmdutil.duplicatecopies(repo, rev, target)
342 343 if not collapsef:
343 344 newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn,
@@ -193,7 +193,7 b' class bundlerepository(localrepo.localre'
193 193 self._tempparent = tempfile.mkdtemp()
194 194 localrepo.instance(ui, self._tempparent, 1)
195 195 localrepo.localrepository.__init__(self, ui, self._tempparent)
196 self.ui.setconfig('phases', 'publish', False)
196 self.ui.setconfig('phases', 'publish', False, 'bundlerepo')
197 197
198 198 if path:
199 199 self._url = 'bundle:' + util.expandpath(path) + '+' + bundlename
@@ -1982,10 +1982,10 b' def amend(ui, repo, commitfunc, old, ext'
1982 1982 commitphase = 'secret'
1983 1983 else:
1984 1984 commitphase = old.phase()
1985 repo.ui.setconfig('phases', 'new-commit', commitphase)
1985 repo.ui.setconfig('phases', 'new-commit', commitphase, 'amend')
1986 1986 newid = repo.commitctx(new)
1987 1987 finally:
1988 repo.ui.setconfig('phases', 'new-commit', ph)
1988 repo.ui.setconfig('phases', 'new-commit', ph, 'amend')
1989 1989 if newid != old.node():
1990 1990 # Reroute the working copy parent to the new changeset
1991 1991 repo.setparents(newid, nullid)
@@ -465,7 +465,8 b' def backout(ui, repo, node=None, rev=Non'
465 465 rctx = scmutil.revsingle(repo, hex(parent))
466 466 if not opts.get('merge') and op1 != node:
467 467 try:
468 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
468 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
469 'backout')
469 470 stats = mergemod.update(repo, parent, True, True, False,
470 471 node, False)
471 472 repo.setparents(op1, op2)
@@ -479,7 +480,7 b' def backout(ui, repo, node=None, rev=Non'
479 480 ui.status(msg % short(node))
480 481 return stats[3] > 0
481 482 finally:
482 ui.setconfig('ui', 'forcemerge', '')
483 ui.setconfig('ui', 'forcemerge', '', '')
483 484 else:
484 485 hg.clean(repo, node, show_stats=False)
485 486 repo.dirstate.setbranch(branch)
@@ -507,10 +508,11 b' def backout(ui, repo, node=None, rev=Non'
507 508 ui.status(_('merging with changeset %s\n')
508 509 % nice(repo.changelog.tip()))
509 510 try:
510 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
511 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
512 'backout')
511 513 return hg.merge(repo, hex(repo.changelog.tip()))
512 514 finally:
513 ui.setconfig('ui', 'forcemerge', '')
515 ui.setconfig('ui', 'forcemerge', '', '')
514 516 finally:
515 517 wlock.release()
516 518 return 0
@@ -1361,7 +1363,7 b' def commit(ui, repo, *pats, **opts):'
1361 1363 if opts.get('amend'):
1362 1364 raise util.Abort(_('cannot amend with --subrepos'))
1363 1365 # Let --subrepos on the command line override config setting.
1364 ui.setconfig('ui', 'commitsubrepos', True)
1366 ui.setconfig('ui', 'commitsubrepos', True, 'commit')
1365 1367
1366 1368 # Save this for restoring it later
1367 1369 oldcommitphase = ui.config('phases', 'new-commit')
@@ -1436,15 +1438,17 b' def commit(ui, repo, *pats, **opts):'
1436 1438 def commitfunc(ui, repo, message, match, opts):
1437 1439 try:
1438 1440 if opts.get('secret'):
1439 ui.setconfig('phases', 'new-commit', 'secret')
1441 ui.setconfig('phases', 'new-commit', 'secret', 'commit')
1440 1442 # Propagate to subrepos
1441 repo.baseui.setconfig('phases', 'new-commit', 'secret')
1443 repo.baseui.setconfig('phases', 'new-commit', 'secret',
1444 'commit')
1442 1445
1443 1446 return repo.commit(message, opts.get('user'), opts.get('date'),
1444 1447 match, editor=e, extra=extra)
1445 1448 finally:
1446 ui.setconfig('phases', 'new-commit', oldcommitphase)
1447 repo.baseui.setconfig('phases', 'new-commit', oldcommitphase)
1449 ui.setconfig('phases', 'new-commit', oldcommitphase, 'commit')
1450 repo.baseui.setconfig('phases', 'new-commit', oldcommitphase,
1451 'commit')
1448 1452
1449 1453
1450 1454 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
@@ -3196,11 +3200,12 b' def graft(ui, repo, *revs, **opts):'
3196 3200 # perform the graft merge with p1(rev) as 'ancestor'
3197 3201 try:
3198 3202 # ui.forcemerge is an internal variable, do not document
3199 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
3203 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
3204 'graft')
3200 3205 stats = mergemod.update(repo, ctx.node(), True, True, False,
3201 3206 ctx.p1().node())
3202 3207 finally:
3203 repo.ui.setconfig('ui', 'forcemerge', '')
3208 repo.ui.setconfig('ui', 'forcemerge', '', 'graft')
3204 3209 # report any conflicts
3205 3210 if stats and stats[3] > 0:
3206 3211 # write out state for --continue
@@ -4325,10 +4330,10 b' def merge(ui, repo, node=None, **opts):'
4325 4330
4326 4331 try:
4327 4332 # ui.forcemerge is an internal variable, do not document
4328 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
4333 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge')
4329 4334 return hg.merge(repo, node, force=opts.get('force'))
4330 4335 finally:
4331 ui.setconfig('ui', 'forcemerge', '')
4336 ui.setconfig('ui', 'forcemerge', '', 'merge')
4332 4337
4333 4338 @command('outgoing|out',
4334 4339 [('f', 'force', None, _('run even when the destination is unrelated')),
@@ -4708,7 +4713,7 b' def push(ui, repo, dest=None, **opts):'
4708 4713 """
4709 4714
4710 4715 if opts.get('bookmark'):
4711 ui.setconfig('bookmarks', 'pushing', opts['bookmark'])
4716 ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push')
4712 4717 for b in opts['bookmark']:
4713 4718 # translate -B options to -r so changesets get pushed
4714 4719 if b in repo._bookmarks:
@@ -4984,11 +4989,12 b' def resolve(ui, repo, *pats, **opts):'
4984 4989
4985 4990 try:
4986 4991 # resolve file
4987 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''))
4992 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
4993 'resolve')
4988 4994 if ms.resolve(f, wctx):
4989 4995 ret = 1
4990 4996 finally:
4991 ui.setconfig('ui', 'forcemerge', '')
4997 ui.setconfig('ui', 'forcemerge', '', 'resolve')
4992 4998 ms.commit()
4993 4999
4994 5000 # replace filemerge's .orig file with our resolve file
@@ -5205,9 +5211,9 b' def serve(ui, repo, **opts):'
5205 5211 val = opts.get(o, '')
5206 5212 if val in (None, ''): # should check against default options instead
5207 5213 continue
5208 baseui.setconfig("web", o, val)
5214 baseui.setconfig("web", o, val, 'serve')
5209 5215 if repo and repo.ui != baseui:
5210 repo.ui.setconfig("web", o, val)
5216 repo.ui.setconfig("web", o, val, 'serve')
5211 5217
5212 5218 o = opts.get('web_conf') or opts.get('webdir_conf')
5213 5219 if not o:
@@ -405,7 +405,7 b' def clone(ui, peeropts, source, dest=Non'
405 405 fp.write("default = %s\n" % defaulturl)
406 406 fp.close()
407 407
408 destrepo.ui.setconfig('paths', 'default', defaulturl)
408 destrepo.ui.setconfig('paths', 'default', defaulturl, 'clone')
409 409
410 410 if update:
411 411 if update is not True:
@@ -613,19 +613,19 b' def remoteui(src, opts):'
613 613 for o in 'ssh', 'remotecmd':
614 614 v = opts.get(o) or src.config('ui', o)
615 615 if v:
616 dst.setconfig("ui", o, v)
616 dst.setconfig("ui", o, v, 'copied')
617 617
618 618 # copy bundle-specific options
619 619 r = src.config('bundle', 'mainreporoot')
620 620 if r:
621 dst.setconfig('bundle', 'mainreporoot', r)
621 dst.setconfig('bundle', 'mainreporoot', r, 'copied')
622 622
623 623 # copy selected local settings to the remote ui
624 624 for sect in ('auth', 'hostfingerprints', 'http_proxy'):
625 625 for key, val in src.configitems(sect):
626 dst.setconfig(sect, key, val)
626 dst.setconfig(sect, key, val, 'copied')
627 627 v = src.config('web', 'cacerts')
628 628 if v:
629 dst.setconfig('web', 'cacerts', util.expandpath(v))
629 dst.setconfig('web', 'cacerts', util.expandpath(v), 'copied')
630 630
631 631 return dst
@@ -64,10 +64,10 b' class hgweb(object):'
64 64 r = repo
65 65
66 66 r = self._getview(r)
67 r.ui.setconfig('ui', 'report_untrusted', 'off')
68 r.baseui.setconfig('ui', 'report_untrusted', 'off')
69 r.ui.setconfig('ui', 'nontty', 'true')
70 r.baseui.setconfig('ui', 'nontty', 'true')
67 r.ui.setconfig('ui', 'report_untrusted', 'off', 'hgweb')
68 r.baseui.setconfig('ui', 'report_untrusted', 'off', 'hgweb')
69 r.ui.setconfig('ui', 'nontty', 'true', 'hgweb')
70 r.baseui.setconfig('ui', 'nontty', 'true', 'hgweb')
71 71 self.repo = r
72 72 hook.redirect(True)
73 73 self.mtime = -1
@@ -96,8 +96,8 b' class hgwebdir(object):'
96 96 u = self.baseui.copy()
97 97 else:
98 98 u = ui.ui()
99 u.setconfig('ui', 'report_untrusted', 'off')
100 u.setconfig('ui', 'nontty', 'true')
99 u.setconfig('ui', 'report_untrusted', 'off', 'hgwebdir')
100 u.setconfig('ui', 'nontty', 'true', 'hgwebdir')
101 101
102 102 if not isinstance(self.conf, (dict, list, tuple)):
103 103 map = {'paths': 'hgweb-paths'}
@@ -512,8 +512,8 b' class hgsubrepo(abstractsubrepo):'
512 512 for s, k in [('ui', 'commitsubrepos')]:
513 513 v = r.ui.config(s, k)
514 514 if v:
515 self._repo.ui.setconfig(s, k, v)
516 self._repo.ui.setconfig('ui', '_usedassubrepo', 'True')
515 self._repo.ui.setconfig(s, k, v, 'subrepo')
516 self._repo.ui.setconfig('ui', '_usedassubrepo', 'True', 'subrepo')
517 517 self._initrepo(r, state[0], create)
518 518
519 519 def storeclean(self, path):
@@ -594,7 +594,7 b' class hgsubrepo(abstractsubrepo):'
594 594 def addpathconfig(key, value):
595 595 if value:
596 596 fp.write('%s = %s\n' % (key, value))
597 self._repo.ui.setconfig('paths', key, value)
597 self._repo.ui.setconfig('paths', key, value, 'subrepo')
598 598
599 599 defpath = _abssource(self._repo, abort=False)
600 600 defpushpath = _abssource(self._repo, True, abort=False)
@@ -170,7 +170,7 b' class unionpeer(localrepo.localpeer):'
170 170 class unionrepository(localrepo.localrepository):
171 171 def __init__(self, ui, path, path2):
172 172 localrepo.localrepository.__init__(self, ui, path)
173 self.ui.setconfig('phases', 'publish', False)
173 self.ui.setconfig('phases', 'publish', False, 'unionrepo')
174 174
175 175 self._url = 'union:%s+%s' % (util.expandpath(path),
176 176 util.expandpath(path2))
General Comments 0
You need to be logged in to leave comments. Login now