##// END OF EJS Templates
merge with crew
Peter van Dijk -
r1931:819a2508 merge default
parent child Browse files
Show More
@@ -0,0 +1,13 b''
1 #!/bin/sh
2 hg init 1
3 echo '[ui]' >> 1/.hg/hgrc
4 echo 'timeout = 10' >> 1/.hg/hgrc
5 echo foo > 1/foo
6 hg --cwd 1 ci -A -m foo
7 hg clone 1 2
8 hg clone 2 3
9 echo '[hooks]' >> 2/.hg/hgrc
10 echo 'changegroup.push = hg push -qf ../1' >> 2/.hg/hgrc
11 echo bar >> 3/foo
12 hg --cwd 3 ci -m bar
13 hg --cwd 3 push ../2
@@ -0,0 +1,7 b''
1 adding foo
2 pushing to ../2
3 searching for changes
4 adding changesets
5 adding manifests
6 adding file changes
7 added 1 changesets with 1 changes to 1 files
@@ -852,7 +852,7 b' class queue:'
852 852
853 853 def qrepo(self, create=False):
854 854 if create or os.path.isdir(os.path.join(self.path, ".hg")):
855 return hg.repository(ui=self.ui, path=self.path, create=create)
855 return hg.repository(self.ui, path=self.path, create=create)
856 856
857 857 def restore(self, repo, rev, delete=None, qupdate=None):
858 858 c = repo.changelog.read(rev)
@@ -780,7 +780,7 b' def clone(ui, source, dest=None, **opts)'
780 780 f.close()
781 781
782 782 if not opts['noupdate']:
783 update(ui, repo)
783 update(repo.ui, repo)
784 784
785 785 d.close()
786 786
@@ -1067,6 +1067,7 b' def debugconfig(ui):'
1067 1067 """show combined config settings from all hgrc files"""
1068 1068 try:
1069 1069 repo = hg.repository(ui)
1070 ui = repo.ui
1070 1071 except hg.RepoError:
1071 1072 pass
1072 1073 for section, name, value in ui.walkconfig():
@@ -1777,7 +1778,8 b' def paths(ui, search=None):'
1777 1778 and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too.
1778 1779 """
1779 1780 try:
1780 repo = hg.repository(ui=ui)
1781 repo = hg.repository(ui)
1782 ui = repo.ui
1781 1783 except hg.RepoError:
1782 1784 pass
1783 1785
@@ -2852,7 +2854,8 b' def dispatch(args):'
2852 2854
2853 2855 if cmd not in norepo.split():
2854 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 2859 for x in external:
2857 2860 if hasattr(x, 'reposetup'):
2858 2861 x.reposetup(u, repo)
@@ -2860,27 +2863,30 b' def dispatch(args):'
2860 2863 else:
2861 2864 d = lambda: func(u, *args, **cmdoptions)
2862 2865
2863 if options['profile']:
2864 import hotshot, hotshot.stats
2865 prof = hotshot.Profile("hg.prof")
2866 try:
2866 try:
2867 if options['profile']:
2868 import hotshot, hotshot.stats
2869 prof = hotshot.Profile("hg.prof")
2867 2870 try:
2868 return prof.runcall(d)
2869 except:
2870 2871 try:
2871 u.warn(_('exception raised - generating profile '
2872 'anyway\n'))
2872 return prof.runcall(d)
2873 2873 except:
2874 pass
2875 raise
2876 finally:
2877 prof.close()
2878 stats = hotshot.stats.load("hg.prof")
2879 stats.strip_dirs()
2880 stats.sort_stats('time', 'calls')
2881 stats.print_stats(40)
2882 else:
2883 return d()
2874 try:
2875 u.warn(_('exception raised - generating '
2876 'profile anyway\n'))
2877 except:
2878 pass
2879 raise
2880 finally:
2881 prof.close()
2882 stats = hotshot.stats.load("hg.prof")
2883 stats.strip_dirs()
2884 stats.sort_stats('time', 'calls')
2885 stats.print_stats(40)
2886 else:
2887 return d()
2888 finally:
2889 u.flush()
2884 2890 except:
2885 2891 # enter the debugger when we hit an exception
2886 2892 if options['debugger']:
@@ -10,12 +10,12 b' import filelog, manifest, changelog, dir'
10 10 from node import *
11 11 from i18n import gettext as _
12 12 from demandload import *
13 demandload(globals(), "re lock transaction tempfile stat mdiff errno")
13 demandload(globals(), "re lock transaction tempfile stat mdiff errno ui")
14 14
15 15 class localrepository(object):
16 16 def __del__(self):
17 17 self.transhandle = None
18 def __init__(self, ui, path=None, create=0):
18 def __init__(self, parentui, path=None, create=0):
19 19 if not path:
20 20 p = os.getcwd()
21 21 while not os.path.isdir(os.path.join(p, ".hg")):
@@ -30,7 +30,7 b' class localrepository(object):'
30 30 raise repo.RepoError(_("repository %s not found") % path)
31 31
32 32 self.root = os.path.abspath(path)
33 self.ui = ui
33 self.ui = ui.ui(parentui=parentui)
34 34 self.opener = util.opener(self.path)
35 35 self.wopener = util.opener(self.root)
36 36 self.manifest = manifest.manifest(self.opener)
@@ -45,7 +45,7 b' class localrepository(object):'
45 45 os.mkdir(self.path)
46 46 os.mkdir(self.join("data"))
47 47
48 self.dirstate = dirstate.dirstate(self.opener, ui, self.root)
48 self.dirstate = dirstate.dirstate(self.opener, self.ui, self.root)
49 49 try:
50 50 self.ui.readconfig(self.join("hgrc"))
51 51 except IOError:
@@ -85,10 +85,11 b' class localrepository(object):'
85 85 return True
86 86
87 87 r = True
88 for hname, cmd in self.ui.configitems("hooks"):
89 s = hname.split(".")
90 if s[0] == name and cmd:
91 r = runhook(hname, cmd) and r
88 hooks = [(hname, cmd) for hname, cmd in self.ui.configitems("hooks")
89 if hname.split(".", 1)[0] == name and cmd]
90 hooks.sort()
91 for hname, cmd in hooks:
92 r = runhook(hname, cmd) and r
92 93 return r
93 94
94 95 def tags(self):
@@ -12,18 +12,23 b' demandload(globals(), "re socket sys uti'
12 12
13 13 class ui(object):
14 14 def __init__(self, verbose=False, debug=False, quiet=False,
15 interactive=True):
15 interactive=True, parentui=None):
16 16 self.overlay = {}
17 17 self.cdata = ConfigParser.SafeConfigParser()
18 self.readconfig(util.rcpath)
18 self.parentui = parentui and parentui.parentui or parentui
19 if parentui is None:
20 self.readconfig(util.rcpath)
19 21
20 self.quiet = self.configbool("ui", "quiet")
21 self.verbose = self.configbool("ui", "verbose")
22 self.debugflag = self.configbool("ui", "debug")
23 self.interactive = self.configbool("ui", "interactive", True)
22 self.quiet = self.configbool("ui", "quiet")
23 self.verbose = self.configbool("ui", "verbose")
24 self.debugflag = self.configbool("ui", "debug")
25 self.interactive = self.configbool("ui", "interactive", True)
24 26
25 self.updateopts(verbose, debug, quiet, interactive)
26 self.diffcache = None
27 self.updateopts(verbose, debug, quiet, interactive)
28 self.diffcache = None
29
30 def __getattr__(self, key):
31 return getattr(self.parentui, key)
27 32
28 33 def updateopts(self, verbose=False, debug=False, quiet=False,
29 34 interactive=True):
@@ -49,22 +54,34 b' class ui(object):'
49 54 return self.overlay[(section, name)]
50 55 if self.cdata.has_option(section, name):
51 56 return self.cdata.get(section, name)
52 return default
57 if self.parentui is None:
58 return default
59 else:
60 return self.parentui.config(section, name, default)
53 61
54 62 def configbool(self, section, name, default=False):
55 63 if self.overlay.has_key((section, name)):
56 64 return self.overlay[(section, name)]
57 65 if self.cdata.has_option(section, name):
58 66 return self.cdata.getboolean(section, name)
59 return default
67 if self.parentui is None:
68 return default
69 else:
70 return self.parentui.configbool(section, name, default)
60 71
61 72 def configitems(self, section):
73 items = {}
74 if self.parentui is not None:
75 items = dict(self.parentui.configitems(section))
62 76 if self.cdata.has_section(section):
63 return self.cdata.items(section)
64 return []
77 items.update(dict(self.cdata.items(section)))
78 x = items.items()
79 x.sort()
80 return x
65 81
66 def walkconfig(self):
67 seen = {}
82 def walkconfig(self, seen=None):
83 if seen is None:
84 seen = {}
68 85 for (section, name), value in self.overlay.iteritems():
69 86 yield section, name, value
70 87 seen[section, name] = 1
@@ -73,6 +90,9 b' class ui(object):'
73 90 if (section, name) in seen: continue
74 91 yield section, name, value.replace('\n', '\\n')
75 92 seen[section, name] = 1
93 if self.parentui is not None:
94 for parent in self.parentui.walkconfig(seen):
95 yield parent
76 96
77 97 def extensions(self):
78 98 return self.configitems("extensions")
@@ -132,6 +152,12 b' class ui(object):'
132 152 for a in args:
133 153 sys.stderr.write(str(a))
134 154
155 def flush(self):
156 try:
157 sys.stdout.flush()
158 finally:
159 sys.stderr.flush()
160
135 161 def readline(self):
136 162 return sys.stdin.readline()[:-1]
137 163 def prompt(self, msg, pat, default="y"):
@@ -171,3 +197,4 b' class ui(object):'
171 197 os.unlink(name)
172 198
173 199 return t
200
@@ -1,23 +1,23 b''
1 1 precommit hook: p1=0000000000000000000000000000000000000000 p2=
2 2 pretxncommit hook: n=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p1=0000000000000000000000000000000000000000 p2=
3 3 0:cb9a9f314b8b
4 commit hook: n=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p1=0000000000000000000000000000000000000000 p2=
4 5 commit hook b
5 commit hook: n=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p1=0000000000000000000000000000000000000000 p2=
6 6 precommit hook: p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
7 7 pretxncommit hook: n=ab228980c14deea8b9555d91c9581127383e40fd p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
8 8 1:ab228980c14d
9 commit hook: n=ab228980c14deea8b9555d91c9581127383e40fd p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
9 10 commit hook b
10 commit hook: n=ab228980c14deea8b9555d91c9581127383e40fd p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
11 11 precommit hook: p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
12 12 pretxncommit hook: n=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
13 13 2:ee9deb46ab31
14 commit hook: n=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
14 15 commit hook b
15 commit hook: n=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
16 16 precommit hook: p1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p2=ab228980c14deea8b9555d91c9581127383e40fd
17 17 pretxncommit hook: n=07f3376c1e655977439df2a814e3cc14b27abac2 p1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p2=ab228980c14deea8b9555d91c9581127383e40fd
18 18 3:07f3376c1e65
19 commit hook: n=07f3376c1e655977439df2a814e3cc14b27abac2 p1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p2=ab228980c14deea8b9555d91c9581127383e40fd
19 20 commit hook b
20 commit hook: n=07f3376c1e655977439df2a814e3cc14b27abac2 p1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p2=ab228980c14deea8b9555d91c9581127383e40fd
21 21 prechangegroup hook
22 22 changegroup hook: n=ab228980c14deea8b9555d91c9581127383e40fd
23 23 incoming hook: n=ab228980c14deea8b9555d91c9581127383e40fd
@@ -34,8 +34,8 b' pretag hook: t=a n=07f3376c1e655977439df'
34 34 precommit hook: p1=07f3376c1e655977439df2a814e3cc14b27abac2 p2=
35 35 pretxncommit hook: n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p1=07f3376c1e655977439df2a814e3cc14b27abac2 p2=
36 36 4:3cd2c6a5a36c
37 commit hook: n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p1=07f3376c1e655977439df2a814e3cc14b27abac2 p2=
37 38 commit hook b
38 commit hook: n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p1=07f3376c1e655977439df2a814e3cc14b27abac2 p2=
39 39 tag hook: t=a n=07f3376c1e655977439df2a814e3cc14b27abac2 l=0
40 40 pretag hook: t=la n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 l=1
41 41 tag hook: t=la n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 l=1
@@ -47,11 +47,14 b' pretag.forbid hook'
47 47 abort: pretag.forbid hook exited with status 1
48 48 4:3cd2c6a5a36c
49 49 precommit hook: p1=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p2=
50 pretxncommit hook: n=469a61fe67d64df9a5023e4c2b8a0b85c61e9b69 p1=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p2=
51 5:469a61fe67d6
50 52 pretxncommit.forbid hook: tip=5:469a61fe67d6
51 53 abort: pretxncommit.forbid hook exited with status 1
52 54 transaction abort!
53 55 rollback completed
54 56 4:3cd2c6a5a36c
57 precommit hook: p1=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p2=
55 58 precommit.forbid hook
56 59 abort: precommit.forbid hook exited with status 1
57 60 4:3cd2c6a5a36c
General Comments 0
You need to be logged in to leave comments. Login now