comparison mercurial/commands.py @ 1839:876e4e6ad82b

Create local ui object per repository, so .hg/hgrc don't get mixed. This is needed for hooks, but may be important for other settings, too. Fixes issue113, also integrated push-hook-lock.sh as a test case for this.
author Thomas Arendsen Hein <thomas@intevation.de>
date Mon, 06 Mar 2006 17:47:41 +0100
parents bdfb524d728a
children d17f19d84fd3
comparison
equal deleted inserted replaced
1838:429bf036f2cb 1839:876e4e6ad82b
778 f.write("[paths]\n") 778 f.write("[paths]\n")
779 f.write("default = %s\n" % abspath) 779 f.write("default = %s\n" % abspath)
780 f.close() 780 f.close()
781 781
782 if not opts['noupdate']: 782 if not opts['noupdate']:
783 update(ui, repo) 783 update(repo.ui, repo)
784 784
785 d.close() 785 d.close()
786 786
787 def commit(ui, repo, *pats, **opts): 787 def commit(ui, repo, *pats, **opts):
788 """commit the specified files or all outstanding changes 788 """commit the specified files or all outstanding changes
1065 1065
1066 def debugconfig(ui): 1066 def debugconfig(ui):
1067 """show combined config settings from all hgrc files""" 1067 """show combined config settings from all hgrc files"""
1068 try: 1068 try:
1069 repo = hg.repository(ui) 1069 repo = hg.repository(ui)
1070 ui = repo.ui
1070 except hg.RepoError: 1071 except hg.RepoError:
1071 pass 1072 pass
1072 for section, name, value in ui.walkconfig(): 1073 for section, name, value in ui.walkconfig():
1073 ui.write('%s.%s=%s\n' % (section, name, value)) 1074 ui.write('%s.%s=%s\n' % (section, name, value))
1074 1075
1775 1776
1776 Path names are defined in the [paths] section of /etc/mercurial/hgrc 1777 Path names are defined in the [paths] section of /etc/mercurial/hgrc
1777 and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. 1778 and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too.
1778 """ 1779 """
1779 try: 1780 try:
1780 repo = hg.repository(ui=ui) 1781 repo = hg.repository(ui)
1782 ui = repo.ui
1781 except hg.RepoError: 1783 except hg.RepoError:
1782 pass 1784 pass
1783 1785
1784 if search: 1786 if search:
1785 for name, path in ui.configitems("paths"): 1787 for name, path in ui.configitems("paths"):
2850 raise util.Abort('%s: %s' % 2852 raise util.Abort('%s: %s' %
2851 (options['cwd'], inst.strerror)) 2853 (options['cwd'], inst.strerror))
2852 2854
2853 if cmd not in norepo.split(): 2855 if cmd not in norepo.split():
2854 path = options["repository"] or "" 2856 path = options["repository"] or ""
2855 repo = hg.repository(ui=u, path=path) 2857 repo = hg.repository(u, path=path)
2858 u = repo.ui
2856 for x in external: 2859 for x in external:
2857 if hasattr(x, 'reposetup'): 2860 if hasattr(x, 'reposetup'):
2858 x.reposetup(u, repo) 2861 x.reposetup(u, repo)
2859 d = lambda: func(u, repo, *args, **cmdoptions) 2862 d = lambda: func(u, repo, *args, **cmdoptions)
2860 else: 2863 else: