##// 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 def qrepo(self, create=False):
853 def qrepo(self, create=False):
854 if create or os.path.isdir(os.path.join(self.path, ".hg")):
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 def restore(self, repo, rev, delete=None, qupdate=None):
857 def restore(self, repo, rev, delete=None, qupdate=None):
858 c = repo.changelog.read(rev)
858 c = repo.changelog.read(rev)
@@ -780,7 +780,7 b' def clone(ui, source, dest=None, **opts)'
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
@@ -1067,6 +1067,7 b' 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():
@@ -1777,7 +1778,8 b' def paths(ui, search=None):'
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
@@ -2852,7 +2854,8 b' def dispatch(args):'
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)
@@ -2860,27 +2863,30 b' def dispatch(args):'
2860 else:
2863 else:
2861 d = lambda: func(u, *args, **cmdoptions)
2864 d = lambda: func(u, *args, **cmdoptions)
2862
2865
2863 if options['profile']:
2866 try:
2864 import hotshot, hotshot.stats
2867 if options['profile']:
2865 prof = hotshot.Profile("hg.prof")
2868 import hotshot, hotshot.stats
2866 try:
2869 prof = hotshot.Profile("hg.prof")
2867 try:
2870 try:
2868 return prof.runcall(d)
2869 except:
2870 try:
2871 try:
2871 u.warn(_('exception raised - generating profile '
2872 return prof.runcall(d)
2872 'anyway\n'))
2873 except:
2873 except:
2874 pass
2874 try:
2875 raise
2875 u.warn(_('exception raised - generating '
2876 finally:
2876 'profile anyway\n'))
2877 prof.close()
2877 except:
2878 stats = hotshot.stats.load("hg.prof")
2878 pass
2879 stats.strip_dirs()
2879 raise
2880 stats.sort_stats('time', 'calls')
2880 finally:
2881 stats.print_stats(40)
2881 prof.close()
2882 else:
2882 stats = hotshot.stats.load("hg.prof")
2883 return d()
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 except:
2890 except:
2885 # enter the debugger when we hit an exception
2891 # enter the debugger when we hit an exception
2886 if options['debugger']:
2892 if options['debugger']:
@@ -10,12 +10,12 b' import filelog, manifest, changelog, dir'
10 from node import *
10 from node import *
11 from i18n import gettext as _
11 from i18n import gettext as _
12 from demandload import *
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 class localrepository(object):
15 class localrepository(object):
16 def __del__(self):
16 def __del__(self):
17 self.transhandle = None
17 self.transhandle = None
18 def __init__(self, ui, path=None, create=0):
18 def __init__(self, parentui, path=None, create=0):
19 if not path:
19 if not path:
20 p = os.getcwd()
20 p = os.getcwd()
21 while not os.path.isdir(os.path.join(p, ".hg")):
21 while not os.path.isdir(os.path.join(p, ".hg")):
@@ -30,7 +30,7 b' class localrepository(object):'
30 raise repo.RepoError(_("repository %s not found") % path)
30 raise repo.RepoError(_("repository %s not found") % path)
31
31
32 self.root = os.path.abspath(path)
32 self.root = os.path.abspath(path)
33 self.ui = ui
33 self.ui = ui.ui(parentui=parentui)
34 self.opener = util.opener(self.path)
34 self.opener = util.opener(self.path)
35 self.wopener = util.opener(self.root)
35 self.wopener = util.opener(self.root)
36 self.manifest = manifest.manifest(self.opener)
36 self.manifest = manifest.manifest(self.opener)
@@ -45,7 +45,7 b' class localrepository(object):'
45 os.mkdir(self.path)
45 os.mkdir(self.path)
46 os.mkdir(self.join("data"))
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 try:
49 try:
50 self.ui.readconfig(self.join("hgrc"))
50 self.ui.readconfig(self.join("hgrc"))
51 except IOError:
51 except IOError:
@@ -85,10 +85,11 b' class localrepository(object):'
85 return True
85 return True
86
86
87 r = True
87 r = True
88 for hname, cmd in self.ui.configitems("hooks"):
88 hooks = [(hname, cmd) for hname, cmd in self.ui.configitems("hooks")
89 s = hname.split(".")
89 if hname.split(".", 1)[0] == name and cmd]
90 if s[0] == name and cmd:
90 hooks.sort()
91 r = runhook(hname, cmd) and r
91 for hname, cmd in hooks:
92 r = runhook(hname, cmd) and r
92 return r
93 return r
93
94
94 def tags(self):
95 def tags(self):
@@ -12,18 +12,23 b' demandload(globals(), "re socket sys uti'
12
12
13 class ui(object):
13 class ui(object):
14 def __init__(self, verbose=False, debug=False, quiet=False,
14 def __init__(self, verbose=False, debug=False, quiet=False,
15 interactive=True):
15 interactive=True, parentui=None):
16 self.overlay = {}
16 self.overlay = {}
17 self.cdata = ConfigParser.SafeConfigParser()
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")
22 self.quiet = self.configbool("ui", "quiet")
21 self.verbose = self.configbool("ui", "verbose")
23 self.verbose = self.configbool("ui", "verbose")
22 self.debugflag = self.configbool("ui", "debug")
24 self.debugflag = self.configbool("ui", "debug")
23 self.interactive = self.configbool("ui", "interactive", True)
25 self.interactive = self.configbool("ui", "interactive", True)
24
26
25 self.updateopts(verbose, debug, quiet, interactive)
27 self.updateopts(verbose, debug, quiet, interactive)
26 self.diffcache = None
28 self.diffcache = None
29
30 def __getattr__(self, key):
31 return getattr(self.parentui, key)
27
32
28 def updateopts(self, verbose=False, debug=False, quiet=False,
33 def updateopts(self, verbose=False, debug=False, quiet=False,
29 interactive=True):
34 interactive=True):
@@ -49,22 +54,34 b' class ui(object):'
49 return self.overlay[(section, name)]
54 return self.overlay[(section, name)]
50 if self.cdata.has_option(section, name):
55 if self.cdata.has_option(section, name):
51 return self.cdata.get(section, name)
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 def configbool(self, section, name, default=False):
62 def configbool(self, section, name, default=False):
55 if self.overlay.has_key((section, name)):
63 if self.overlay.has_key((section, name)):
56 return self.overlay[(section, name)]
64 return self.overlay[(section, name)]
57 if self.cdata.has_option(section, name):
65 if self.cdata.has_option(section, name):
58 return self.cdata.getboolean(section, name)
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 def configitems(self, section):
72 def configitems(self, section):
73 items = {}
74 if self.parentui is not None:
75 items = dict(self.parentui.configitems(section))
62 if self.cdata.has_section(section):
76 if self.cdata.has_section(section):
63 return self.cdata.items(section)
77 items.update(dict(self.cdata.items(section)))
64 return []
78 x = items.items()
79 x.sort()
80 return x
65
81
66 def walkconfig(self):
82 def walkconfig(self, seen=None):
67 seen = {}
83 if seen is None:
84 seen = {}
68 for (section, name), value in self.overlay.iteritems():
85 for (section, name), value in self.overlay.iteritems():
69 yield section, name, value
86 yield section, name, value
70 seen[section, name] = 1
87 seen[section, name] = 1
@@ -73,6 +90,9 b' class ui(object):'
73 if (section, name) in seen: continue
90 if (section, name) in seen: continue
74 yield section, name, value.replace('\n', '\\n')
91 yield section, name, value.replace('\n', '\\n')
75 seen[section, name] = 1
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 def extensions(self):
97 def extensions(self):
78 return self.configitems("extensions")
98 return self.configitems("extensions")
@@ -132,6 +152,12 b' class ui(object):'
132 for a in args:
152 for a in args:
133 sys.stderr.write(str(a))
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 def readline(self):
161 def readline(self):
136 return sys.stdin.readline()[:-1]
162 return sys.stdin.readline()[:-1]
137 def prompt(self, msg, pat, default="y"):
163 def prompt(self, msg, pat, default="y"):
@@ -171,3 +197,4 b' class ui(object):'
171 os.unlink(name)
197 os.unlink(name)
172
198
173 return t
199 return t
200
@@ -1,23 +1,23 b''
1 precommit hook: p1=0000000000000000000000000000000000000000 p2=
1 precommit hook: p1=0000000000000000000000000000000000000000 p2=
2 pretxncommit hook: n=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p1=0000000000000000000000000000000000000000 p2=
2 pretxncommit hook: n=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p1=0000000000000000000000000000000000000000 p2=
3 0:cb9a9f314b8b
3 0:cb9a9f314b8b
4 commit hook: n=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p1=0000000000000000000000000000000000000000 p2=
4 commit hook b
5 commit hook b
5 commit hook: n=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p1=0000000000000000000000000000000000000000 p2=
6 precommit hook: p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
6 precommit hook: p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
7 pretxncommit hook: n=ab228980c14deea8b9555d91c9581127383e40fd p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
7 pretxncommit hook: n=ab228980c14deea8b9555d91c9581127383e40fd p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
8 1:ab228980c14d
8 1:ab228980c14d
9 commit hook: n=ab228980c14deea8b9555d91c9581127383e40fd p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
9 commit hook b
10 commit hook b
10 commit hook: n=ab228980c14deea8b9555d91c9581127383e40fd p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
11 precommit hook: p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
11 precommit hook: p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
12 pretxncommit hook: n=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
12 pretxncommit hook: n=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
13 2:ee9deb46ab31
13 2:ee9deb46ab31
14 commit hook: n=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
14 commit hook b
15 commit hook b
15 commit hook: n=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b p2=
16 precommit hook: p1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p2=ab228980c14deea8b9555d91c9581127383e40fd
16 precommit hook: p1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p2=ab228980c14deea8b9555d91c9581127383e40fd
17 pretxncommit hook: n=07f3376c1e655977439df2a814e3cc14b27abac2 p1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p2=ab228980c14deea8b9555d91c9581127383e40fd
17 pretxncommit hook: n=07f3376c1e655977439df2a814e3cc14b27abac2 p1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p2=ab228980c14deea8b9555d91c9581127383e40fd
18 3:07f3376c1e65
18 3:07f3376c1e65
19 commit hook: n=07f3376c1e655977439df2a814e3cc14b27abac2 p1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p2=ab228980c14deea8b9555d91c9581127383e40fd
19 commit hook b
20 commit hook b
20 commit hook: n=07f3376c1e655977439df2a814e3cc14b27abac2 p1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 p2=ab228980c14deea8b9555d91c9581127383e40fd
21 prechangegroup hook
21 prechangegroup hook
22 changegroup hook: n=ab228980c14deea8b9555d91c9581127383e40fd
22 changegroup hook: n=ab228980c14deea8b9555d91c9581127383e40fd
23 incoming hook: n=ab228980c14deea8b9555d91c9581127383e40fd
23 incoming hook: n=ab228980c14deea8b9555d91c9581127383e40fd
@@ -34,8 +34,8 b' pretag hook: t=a n=07f3376c1e655977439df'
34 precommit hook: p1=07f3376c1e655977439df2a814e3cc14b27abac2 p2=
34 precommit hook: p1=07f3376c1e655977439df2a814e3cc14b27abac2 p2=
35 pretxncommit hook: n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p1=07f3376c1e655977439df2a814e3cc14b27abac2 p2=
35 pretxncommit hook: n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p1=07f3376c1e655977439df2a814e3cc14b27abac2 p2=
36 4:3cd2c6a5a36c
36 4:3cd2c6a5a36c
37 commit hook: n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p1=07f3376c1e655977439df2a814e3cc14b27abac2 p2=
37 commit hook b
38 commit hook b
38 commit hook: n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p1=07f3376c1e655977439df2a814e3cc14b27abac2 p2=
39 tag hook: t=a n=07f3376c1e655977439df2a814e3cc14b27abac2 l=0
39 tag hook: t=a n=07f3376c1e655977439df2a814e3cc14b27abac2 l=0
40 pretag hook: t=la n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 l=1
40 pretag hook: t=la n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 l=1
41 tag hook: t=la n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 l=1
41 tag hook: t=la n=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 l=1
@@ -47,11 +47,14 b' pretag.forbid hook'
47 abort: pretag.forbid hook exited with status 1
47 abort: pretag.forbid hook exited with status 1
48 4:3cd2c6a5a36c
48 4:3cd2c6a5a36c
49 precommit hook: p1=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p2=
49 precommit hook: p1=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p2=
50 pretxncommit hook: n=469a61fe67d64df9a5023e4c2b8a0b85c61e9b69 p1=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p2=
51 5:469a61fe67d6
50 pretxncommit.forbid hook: tip=5:469a61fe67d6
52 pretxncommit.forbid hook: tip=5:469a61fe67d6
51 abort: pretxncommit.forbid hook exited with status 1
53 abort: pretxncommit.forbid hook exited with status 1
52 transaction abort!
54 transaction abort!
53 rollback completed
55 rollback completed
54 4:3cd2c6a5a36c
56 4:3cd2c6a5a36c
57 precommit hook: p1=3cd2c6a5a36c5908aad3bc0d717c29873a05dfc2 p2=
55 precommit.forbid hook
58 precommit.forbid hook
56 abort: precommit.forbid hook exited with status 1
59 abort: precommit.forbid hook exited with status 1
57 4:3cd2c6a5a36c
60 4:3cd2c6a5a36c
General Comments 0
You need to be logged in to leave comments. Login now