Show More
@@ -1,590 +1,590 b'' | |||||
1 | #require killdaemons |
|
1 | #require killdaemons | |
2 |
|
2 | |||
3 | Create an extension to test bundle2 remote-changegroup parts |
|
3 | Create an extension to test bundle2 remote-changegroup parts | |
4 |
|
4 | |||
5 | $ cat > bundle2.py << EOF |
|
5 | $ cat > bundle2.py << EOF | |
6 | > """A small extension to test bundle2 remote-changegroup parts. |
|
6 | > """A small extension to test bundle2 remote-changegroup parts. | |
7 | > |
|
7 | > | |
8 | > Current bundle2 implementation doesn't provide a way to generate those |
|
8 | > Current bundle2 implementation doesn't provide a way to generate those | |
9 | > parts, so they must be created by extensions. |
|
9 | > parts, so they must be created by extensions. | |
10 | > """ |
|
10 | > """ | |
11 | > from mercurial import bundle2, changegroup, discovery, exchange, util |
|
11 | > from mercurial import bundle2, changegroup, discovery, exchange, util | |
12 | > |
|
12 | > | |
13 | > def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None, |
|
13 | > def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None, | |
14 | > b2caps=None, heads=None, common=None, |
|
14 | > b2caps=None, heads=None, common=None, | |
15 | > **kwargs): |
|
15 | > **kwargs): | |
16 | > """this function replaces the changegroup part handler for getbundle. |
|
16 | > """this function replaces the changegroup part handler for getbundle. | |
17 | > It allows to create a set of arbitrary parts containing changegroups |
|
17 | > It allows to create a set of arbitrary parts containing changegroups | |
18 | > and remote-changegroups, as described in a bundle2maker file in the |
|
18 | > and remote-changegroups, as described in a bundle2maker file in the | |
19 | > repository .hg/ directory. |
|
19 | > repository .hg/ directory. | |
20 | > |
|
20 | > | |
21 | > Each line of that bundle2maker file contain a description of the |
|
21 | > Each line of that bundle2maker file contain a description of the | |
22 | > part to add: |
|
22 | > part to add: | |
23 | > - changegroup common_revset heads_revset |
|
23 | > - changegroup common_revset heads_revset | |
24 | > Creates a changegroup part based, using common_revset and |
|
24 | > Creates a changegroup part based, using common_revset and | |
25 | > heads_revset for outgoing |
|
25 | > heads_revset for outgoing | |
26 | > - remote-changegroup url file |
|
26 | > - remote-changegroup url file | |
27 | > Creates a remote-changegroup part for a bundle at the given |
|
27 | > Creates a remote-changegroup part for a bundle at the given | |
28 | > url. Size and digest, as required by the client, are computed |
|
28 | > url. Size and digest, as required by the client, are computed | |
29 | > from the given file. |
|
29 | > from the given file. | |
30 | > - raw-remote-changegroup <python expression> |
|
30 | > - raw-remote-changegroup <python expression> | |
31 | > Creates a remote-changegroup part with the data given in the |
|
31 | > Creates a remote-changegroup part with the data given in the | |
32 |
> |
|
32 | > Python expression as parameters. The Python expression is | |
33 | > evaluated with eval, and is expected to be a dict. |
|
33 | > evaluated with eval, and is expected to be a dict. | |
34 | > """ |
|
34 | > """ | |
35 | > def newpart(name, data=''): |
|
35 | > def newpart(name, data=''): | |
36 | > """wrapper around bundler.newpart adding an extra part making the |
|
36 | > """wrapper around bundler.newpart adding an extra part making the | |
37 | > client output information about each processed part""" |
|
37 | > client output information about each processed part""" | |
38 | > bundler.newpart('output', data=name) |
|
38 | > bundler.newpart('output', data=name) | |
39 | > part = bundler.newpart(name, data=data) |
|
39 | > part = bundler.newpart(name, data=data) | |
40 | > return part |
|
40 | > return part | |
41 | > |
|
41 | > | |
42 | > for line in open(repo.vfs.join('bundle2maker'), 'r'): |
|
42 | > for line in open(repo.vfs.join('bundle2maker'), 'r'): | |
43 | > line = line.strip() |
|
43 | > line = line.strip() | |
44 | > try: |
|
44 | > try: | |
45 | > verb, args = line.split(None, 1) |
|
45 | > verb, args = line.split(None, 1) | |
46 | > except ValueError: |
|
46 | > except ValueError: | |
47 | > verb, args = line, '' |
|
47 | > verb, args = line, '' | |
48 | > if verb == 'remote-changegroup': |
|
48 | > if verb == 'remote-changegroup': | |
49 | > url, file = args.split() |
|
49 | > url, file = args.split() | |
50 | > bundledata = open(file, 'rb').read() |
|
50 | > bundledata = open(file, 'rb').read() | |
51 | > digest = util.digester.preferred(b2caps['digests']) |
|
51 | > digest = util.digester.preferred(b2caps['digests']) | |
52 | > d = util.digester([digest], bundledata) |
|
52 | > d = util.digester([digest], bundledata) | |
53 | > part = newpart('remote-changegroup') |
|
53 | > part = newpart('remote-changegroup') | |
54 | > part.addparam('url', url) |
|
54 | > part.addparam('url', url) | |
55 | > part.addparam('size', str(len(bundledata))) |
|
55 | > part.addparam('size', str(len(bundledata))) | |
56 | > part.addparam('digests', digest) |
|
56 | > part.addparam('digests', digest) | |
57 | > part.addparam('digest:%s' % digest, d[digest]) |
|
57 | > part.addparam('digest:%s' % digest, d[digest]) | |
58 | > elif verb == 'raw-remote-changegroup': |
|
58 | > elif verb == 'raw-remote-changegroup': | |
59 | > part = newpart('remote-changegroup') |
|
59 | > part = newpart('remote-changegroup') | |
60 | > for k, v in eval(args).items(): |
|
60 | > for k, v in eval(args).items(): | |
61 | > part.addparam(k, str(v)) |
|
61 | > part.addparam(k, str(v)) | |
62 | > elif verb == 'changegroup': |
|
62 | > elif verb == 'changegroup': | |
63 | > _common, heads = args.split() |
|
63 | > _common, heads = args.split() | |
64 | > common.extend(repo.lookup(r) for r in repo.revs(_common)) |
|
64 | > common.extend(repo.lookup(r) for r in repo.revs(_common)) | |
65 | > heads = [repo.lookup(r) for r in repo.revs(heads)] |
|
65 | > heads = [repo.lookup(r) for r in repo.revs(heads)] | |
66 | > outgoing = discovery.outgoing(repo, common, heads) |
|
66 | > outgoing = discovery.outgoing(repo, common, heads) | |
67 | > cg = changegroup.getchangegroup(repo, 'changegroup', outgoing) |
|
67 | > cg = changegroup.getchangegroup(repo, 'changegroup', outgoing) | |
68 | > newpart('changegroup', cg.getchunks()) |
|
68 | > newpart('changegroup', cg.getchunks()) | |
69 | > else: |
|
69 | > else: | |
70 | > raise Exception('unknown verb') |
|
70 | > raise Exception('unknown verb') | |
71 | > |
|
71 | > | |
72 | > exchange.getbundle2partsmapping['changegroup'] = _getbundlechangegrouppart |
|
72 | > exchange.getbundle2partsmapping['changegroup'] = _getbundlechangegrouppart | |
73 | > EOF |
|
73 | > EOF | |
74 |
|
74 | |||
75 | Start a simple HTTP server to serve bundles |
|
75 | Start a simple HTTP server to serve bundles | |
76 |
|
76 | |||
77 | $ $PYTHON "$TESTDIR/dumbhttp.py" -p $HGPORT --pid dumb.pid |
|
77 | $ $PYTHON "$TESTDIR/dumbhttp.py" -p $HGPORT --pid dumb.pid | |
78 | $ cat dumb.pid >> $DAEMON_PIDS |
|
78 | $ cat dumb.pid >> $DAEMON_PIDS | |
79 |
|
79 | |||
80 | $ cat >> $HGRCPATH << EOF |
|
80 | $ cat >> $HGRCPATH << EOF | |
81 | > [ui] |
|
81 | > [ui] | |
82 | > ssh=python "$TESTDIR/dummyssh" |
|
82 | > ssh=python "$TESTDIR/dummyssh" | |
83 | > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline} |
|
83 | > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline} | |
84 | > EOF |
|
84 | > EOF | |
85 |
|
85 | |||
86 | $ hg init repo |
|
86 | $ hg init repo | |
87 |
|
87 | |||
88 | $ hg -R repo unbundle $TESTDIR/bundles/rebase.hg |
|
88 | $ hg -R repo unbundle $TESTDIR/bundles/rebase.hg | |
89 | adding changesets |
|
89 | adding changesets | |
90 | adding manifests |
|
90 | adding manifests | |
91 | adding file changes |
|
91 | adding file changes | |
92 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
92 | added 8 changesets with 7 changes to 7 files (+2 heads) | |
93 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
93 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
94 |
|
94 | |||
95 | $ hg -R repo log -G |
|
95 | $ hg -R repo log -G | |
96 | o 7:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> H |
|
96 | o 7:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> H | |
97 | | |
|
97 | | | |
98 | | o 6:eea13746799a draft Nicolas Dumazet <nicdumz.commits@gmail.com> G |
|
98 | | o 6:eea13746799a draft Nicolas Dumazet <nicdumz.commits@gmail.com> G | |
99 | |/| |
|
99 | |/| | |
100 | o | 5:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
100 | o | 5:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F | |
101 | | | |
|
101 | | | | |
102 | | o 4:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
102 | | o 4:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E | |
103 | |/ |
|
103 | |/ | |
104 | | o 3:32af7686d403 draft Nicolas Dumazet <nicdumz.commits@gmail.com> D |
|
104 | | o 3:32af7686d403 draft Nicolas Dumazet <nicdumz.commits@gmail.com> D | |
105 | | | |
|
105 | | | | |
106 | | o 2:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
106 | | o 2:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> C | |
107 | | | |
|
107 | | | | |
108 | | o 1:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
108 | | o 1:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> B | |
109 | |/ |
|
109 | |/ | |
110 | o 0:cd010b8cd998 draft Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
110 | o 0:cd010b8cd998 draft Nicolas Dumazet <nicdumz.commits@gmail.com> A | |
111 |
|
111 | |||
112 | $ hg clone repo orig |
|
112 | $ hg clone repo orig | |
113 | updating to branch default |
|
113 | updating to branch default | |
114 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
114 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
115 |
|
115 | |||
116 | $ cat > repo/.hg/hgrc << EOF |
|
116 | $ cat > repo/.hg/hgrc << EOF | |
117 | > [extensions] |
|
117 | > [extensions] | |
118 | > bundle2=$TESTTMP/bundle2.py |
|
118 | > bundle2=$TESTTMP/bundle2.py | |
119 | > EOF |
|
119 | > EOF | |
120 |
|
120 | |||
121 | Test a pull with an remote-changegroup |
|
121 | Test a pull with an remote-changegroup | |
122 |
|
122 | |||
123 | $ hg bundle -R repo --type v1 --base '0:4' -r '5:7' bundle.hg |
|
123 | $ hg bundle -R repo --type v1 --base '0:4' -r '5:7' bundle.hg | |
124 | 3 changesets found |
|
124 | 3 changesets found | |
125 | $ cat > repo/.hg/bundle2maker << EOF |
|
125 | $ cat > repo/.hg/bundle2maker << EOF | |
126 | > remote-changegroup http://localhost:$HGPORT/bundle.hg bundle.hg |
|
126 | > remote-changegroup http://localhost:$HGPORT/bundle.hg bundle.hg | |
127 | > EOF |
|
127 | > EOF | |
128 | $ hg clone orig clone -r 3 -r 4 |
|
128 | $ hg clone orig clone -r 3 -r 4 | |
129 | adding changesets |
|
129 | adding changesets | |
130 | adding manifests |
|
130 | adding manifests | |
131 | adding file changes |
|
131 | adding file changes | |
132 | added 5 changesets with 5 changes to 5 files (+1 heads) |
|
132 | added 5 changesets with 5 changes to 5 files (+1 heads) | |
133 | updating to branch default |
|
133 | updating to branch default | |
134 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
134 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
135 | $ hg pull -R clone ssh://user@dummy/repo |
|
135 | $ hg pull -R clone ssh://user@dummy/repo | |
136 | pulling from ssh://user@dummy/repo |
|
136 | pulling from ssh://user@dummy/repo | |
137 | searching for changes |
|
137 | searching for changes | |
138 | remote: remote-changegroup |
|
138 | remote: remote-changegroup | |
139 | adding changesets |
|
139 | adding changesets | |
140 | adding manifests |
|
140 | adding manifests | |
141 | adding file changes |
|
141 | adding file changes | |
142 | added 3 changesets with 2 changes to 2 files (+1 heads) |
|
142 | added 3 changesets with 2 changes to 2 files (+1 heads) | |
143 | (run 'hg heads .' to see heads, 'hg merge' to merge) |
|
143 | (run 'hg heads .' to see heads, 'hg merge' to merge) | |
144 | $ hg -R clone log -G |
|
144 | $ hg -R clone log -G | |
145 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H |
|
145 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H | |
146 | | |
|
146 | | | |
147 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G |
|
147 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G | |
148 | |/| |
|
148 | |/| | |
149 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
149 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F | |
150 | | | |
|
150 | | | | |
151 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
151 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E | |
152 | |/ |
|
152 | |/ | |
153 | | @ 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D |
|
153 | | @ 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D | |
154 | | | |
|
154 | | | | |
155 | | o 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
155 | | o 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C | |
156 | | | |
|
156 | | | | |
157 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
157 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B | |
158 | |/ |
|
158 | |/ | |
159 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
159 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A | |
160 |
|
160 | |||
161 | $ rm -rf clone |
|
161 | $ rm -rf clone | |
162 |
|
162 | |||
163 | Test a pull with an remote-changegroup and a following changegroup |
|
163 | Test a pull with an remote-changegroup and a following changegroup | |
164 |
|
164 | |||
165 | $ hg bundle -R repo --type v1 --base 2 -r '3:4' bundle2.hg |
|
165 | $ hg bundle -R repo --type v1 --base 2 -r '3:4' bundle2.hg | |
166 | 2 changesets found |
|
166 | 2 changesets found | |
167 | $ cat > repo/.hg/bundle2maker << EOF |
|
167 | $ cat > repo/.hg/bundle2maker << EOF | |
168 | > remote-changegroup http://localhost:$HGPORT/bundle2.hg bundle2.hg |
|
168 | > remote-changegroup http://localhost:$HGPORT/bundle2.hg bundle2.hg | |
169 | > changegroup 0:4 5:7 |
|
169 | > changegroup 0:4 5:7 | |
170 | > EOF |
|
170 | > EOF | |
171 | $ hg clone orig clone -r 2 |
|
171 | $ hg clone orig clone -r 2 | |
172 | adding changesets |
|
172 | adding changesets | |
173 | adding manifests |
|
173 | adding manifests | |
174 | adding file changes |
|
174 | adding file changes | |
175 | added 3 changesets with 3 changes to 3 files |
|
175 | added 3 changesets with 3 changes to 3 files | |
176 | updating to branch default |
|
176 | updating to branch default | |
177 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
177 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
178 | $ hg pull -R clone ssh://user@dummy/repo |
|
178 | $ hg pull -R clone ssh://user@dummy/repo | |
179 | pulling from ssh://user@dummy/repo |
|
179 | pulling from ssh://user@dummy/repo | |
180 | searching for changes |
|
180 | searching for changes | |
181 | remote: remote-changegroup |
|
181 | remote: remote-changegroup | |
182 | adding changesets |
|
182 | adding changesets | |
183 | adding manifests |
|
183 | adding manifests | |
184 | adding file changes |
|
184 | adding file changes | |
185 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
185 | added 2 changesets with 2 changes to 2 files (+1 heads) | |
186 | remote: changegroup |
|
186 | remote: changegroup | |
187 | adding changesets |
|
187 | adding changesets | |
188 | adding manifests |
|
188 | adding manifests | |
189 | adding file changes |
|
189 | adding file changes | |
190 | added 3 changesets with 2 changes to 2 files (+1 heads) |
|
190 | added 3 changesets with 2 changes to 2 files (+1 heads) | |
191 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
191 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
192 | $ hg -R clone log -G |
|
192 | $ hg -R clone log -G | |
193 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H |
|
193 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H | |
194 | | |
|
194 | | | |
195 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G |
|
195 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G | |
196 | |/| |
|
196 | |/| | |
197 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
197 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F | |
198 | | | |
|
198 | | | | |
199 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
199 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E | |
200 | |/ |
|
200 | |/ | |
201 | | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D |
|
201 | | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D | |
202 | | | |
|
202 | | | | |
203 | | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
203 | | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C | |
204 | | | |
|
204 | | | | |
205 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
205 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B | |
206 | |/ |
|
206 | |/ | |
207 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
207 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A | |
208 |
|
208 | |||
209 | $ rm -rf clone |
|
209 | $ rm -rf clone | |
210 |
|
210 | |||
211 | Test a pull with a changegroup followed by an remote-changegroup |
|
211 | Test a pull with a changegroup followed by an remote-changegroup | |
212 |
|
212 | |||
213 | $ hg bundle -R repo --type v1 --base '0:4' -r '5:7' bundle3.hg |
|
213 | $ hg bundle -R repo --type v1 --base '0:4' -r '5:7' bundle3.hg | |
214 | 3 changesets found |
|
214 | 3 changesets found | |
215 | $ cat > repo/.hg/bundle2maker << EOF |
|
215 | $ cat > repo/.hg/bundle2maker << EOF | |
216 | > changegroup 000000000000 :4 |
|
216 | > changegroup 000000000000 :4 | |
217 | > remote-changegroup http://localhost:$HGPORT/bundle3.hg bundle3.hg |
|
217 | > remote-changegroup http://localhost:$HGPORT/bundle3.hg bundle3.hg | |
218 | > EOF |
|
218 | > EOF | |
219 | $ hg clone orig clone -r 2 |
|
219 | $ hg clone orig clone -r 2 | |
220 | adding changesets |
|
220 | adding changesets | |
221 | adding manifests |
|
221 | adding manifests | |
222 | adding file changes |
|
222 | adding file changes | |
223 | added 3 changesets with 3 changes to 3 files |
|
223 | added 3 changesets with 3 changes to 3 files | |
224 | updating to branch default |
|
224 | updating to branch default | |
225 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
225 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
226 | $ hg pull -R clone ssh://user@dummy/repo |
|
226 | $ hg pull -R clone ssh://user@dummy/repo | |
227 | pulling from ssh://user@dummy/repo |
|
227 | pulling from ssh://user@dummy/repo | |
228 | searching for changes |
|
228 | searching for changes | |
229 | remote: changegroup |
|
229 | remote: changegroup | |
230 | adding changesets |
|
230 | adding changesets | |
231 | adding manifests |
|
231 | adding manifests | |
232 | adding file changes |
|
232 | adding file changes | |
233 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
233 | added 2 changesets with 2 changes to 2 files (+1 heads) | |
234 | remote: remote-changegroup |
|
234 | remote: remote-changegroup | |
235 | adding changesets |
|
235 | adding changesets | |
236 | adding manifests |
|
236 | adding manifests | |
237 | adding file changes |
|
237 | adding file changes | |
238 | added 3 changesets with 2 changes to 2 files (+1 heads) |
|
238 | added 3 changesets with 2 changes to 2 files (+1 heads) | |
239 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
239 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
240 | $ hg -R clone log -G |
|
240 | $ hg -R clone log -G | |
241 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H |
|
241 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H | |
242 | | |
|
242 | | | |
243 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G |
|
243 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G | |
244 | |/| |
|
244 | |/| | |
245 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
245 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F | |
246 | | | |
|
246 | | | | |
247 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
247 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E | |
248 | |/ |
|
248 | |/ | |
249 | | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D |
|
249 | | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D | |
250 | | | |
|
250 | | | | |
251 | | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
251 | | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C | |
252 | | | |
|
252 | | | | |
253 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
253 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B | |
254 | |/ |
|
254 | |/ | |
255 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
255 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A | |
256 |
|
256 | |||
257 | $ rm -rf clone |
|
257 | $ rm -rf clone | |
258 |
|
258 | |||
259 | Test a pull with two remote-changegroups and a changegroup |
|
259 | Test a pull with two remote-changegroups and a changegroup | |
260 |
|
260 | |||
261 | $ hg bundle -R repo --type v1 --base 2 -r '3:4' bundle4.hg |
|
261 | $ hg bundle -R repo --type v1 --base 2 -r '3:4' bundle4.hg | |
262 | 2 changesets found |
|
262 | 2 changesets found | |
263 | $ hg bundle -R repo --type v1 --base '3:4' -r '5:6' bundle5.hg |
|
263 | $ hg bundle -R repo --type v1 --base '3:4' -r '5:6' bundle5.hg | |
264 | 2 changesets found |
|
264 | 2 changesets found | |
265 | $ cat > repo/.hg/bundle2maker << EOF |
|
265 | $ cat > repo/.hg/bundle2maker << EOF | |
266 | > remote-changegroup http://localhost:$HGPORT/bundle4.hg bundle4.hg |
|
266 | > remote-changegroup http://localhost:$HGPORT/bundle4.hg bundle4.hg | |
267 | > remote-changegroup http://localhost:$HGPORT/bundle5.hg bundle5.hg |
|
267 | > remote-changegroup http://localhost:$HGPORT/bundle5.hg bundle5.hg | |
268 | > changegroup 0:6 7 |
|
268 | > changegroup 0:6 7 | |
269 | > EOF |
|
269 | > EOF | |
270 | $ hg clone orig clone -r 2 |
|
270 | $ hg clone orig clone -r 2 | |
271 | adding changesets |
|
271 | adding changesets | |
272 | adding manifests |
|
272 | adding manifests | |
273 | adding file changes |
|
273 | adding file changes | |
274 | added 3 changesets with 3 changes to 3 files |
|
274 | added 3 changesets with 3 changes to 3 files | |
275 | updating to branch default |
|
275 | updating to branch default | |
276 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
276 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
277 | $ hg pull -R clone ssh://user@dummy/repo |
|
277 | $ hg pull -R clone ssh://user@dummy/repo | |
278 | pulling from ssh://user@dummy/repo |
|
278 | pulling from ssh://user@dummy/repo | |
279 | searching for changes |
|
279 | searching for changes | |
280 | remote: remote-changegroup |
|
280 | remote: remote-changegroup | |
281 | adding changesets |
|
281 | adding changesets | |
282 | adding manifests |
|
282 | adding manifests | |
283 | adding file changes |
|
283 | adding file changes | |
284 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
284 | added 2 changesets with 2 changes to 2 files (+1 heads) | |
285 | remote: remote-changegroup |
|
285 | remote: remote-changegroup | |
286 | adding changesets |
|
286 | adding changesets | |
287 | adding manifests |
|
287 | adding manifests | |
288 | adding file changes |
|
288 | adding file changes | |
289 | added 2 changesets with 1 changes to 1 files |
|
289 | added 2 changesets with 1 changes to 1 files | |
290 | remote: changegroup |
|
290 | remote: changegroup | |
291 | adding changesets |
|
291 | adding changesets | |
292 | adding manifests |
|
292 | adding manifests | |
293 | adding file changes |
|
293 | adding file changes | |
294 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
294 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
295 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
295 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
296 | $ hg -R clone log -G |
|
296 | $ hg -R clone log -G | |
297 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H |
|
297 | o 7:02de42196ebe public Nicolas Dumazet <nicdumz.commits@gmail.com> H | |
298 | | |
|
298 | | | |
299 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G |
|
299 | | o 6:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> G | |
300 | |/| |
|
300 | |/| | |
301 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F |
|
301 | o | 5:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F | |
302 | | | |
|
302 | | | | |
303 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E |
|
303 | | o 4:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E | |
304 | |/ |
|
304 | |/ | |
305 | | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D |
|
305 | | o 3:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> D | |
306 | | | |
|
306 | | | | |
307 | | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
307 | | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C | |
308 | | | |
|
308 | | | | |
309 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
309 | | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B | |
310 | |/ |
|
310 | |/ | |
311 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
311 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A | |
312 |
|
312 | |||
313 | $ rm -rf clone |
|
313 | $ rm -rf clone | |
314 |
|
314 | |||
315 | Hash digest tests |
|
315 | Hash digest tests | |
316 |
|
316 | |||
317 | $ hg bundle -R repo --type v1 -a bundle6.hg |
|
317 | $ hg bundle -R repo --type v1 -a bundle6.hg | |
318 | 8 changesets found |
|
318 | 8 changesets found | |
319 |
|
319 | |||
320 | $ cat > repo/.hg/bundle2maker << EOF |
|
320 | $ cat > repo/.hg/bundle2maker << EOF | |
321 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'} |
|
321 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'} | |
322 | > EOF |
|
322 | > EOF | |
323 | $ hg clone ssh://user@dummy/repo clone |
|
323 | $ hg clone ssh://user@dummy/repo clone | |
324 | requesting all changes |
|
324 | requesting all changes | |
325 | remote: remote-changegroup |
|
325 | remote: remote-changegroup | |
326 | adding changesets |
|
326 | adding changesets | |
327 | adding manifests |
|
327 | adding manifests | |
328 | adding file changes |
|
328 | adding file changes | |
329 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
329 | added 8 changesets with 7 changes to 7 files (+2 heads) | |
330 | updating to branch default |
|
330 | updating to branch default | |
331 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
331 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
332 | $ rm -rf clone |
|
332 | $ rm -rf clone | |
333 |
|
333 | |||
334 | $ cat > repo/.hg/bundle2maker << EOF |
|
334 | $ cat > repo/.hg/bundle2maker << EOF | |
335 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394'} |
|
335 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394'} | |
336 | > EOF |
|
336 | > EOF | |
337 | $ hg clone ssh://user@dummy/repo clone |
|
337 | $ hg clone ssh://user@dummy/repo clone | |
338 | requesting all changes |
|
338 | requesting all changes | |
339 | remote: remote-changegroup |
|
339 | remote: remote-changegroup | |
340 | adding changesets |
|
340 | adding changesets | |
341 | adding manifests |
|
341 | adding manifests | |
342 | adding file changes |
|
342 | adding file changes | |
343 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
343 | added 8 changesets with 7 changes to 7 files (+2 heads) | |
344 | updating to branch default |
|
344 | updating to branch default | |
345 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
345 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
346 | $ rm -rf clone |
|
346 | $ rm -rf clone | |
347 |
|
347 | |||
348 | Hash digest mismatch throws an error |
|
348 | Hash digest mismatch throws an error | |
349 |
|
349 | |||
350 | $ cat > repo/.hg/bundle2maker << EOF |
|
350 | $ cat > repo/.hg/bundle2maker << EOF | |
351 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '0' * 40} |
|
351 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'sha1', 'digest:sha1': '0' * 40} | |
352 | > EOF |
|
352 | > EOF | |
353 | $ hg clone ssh://user@dummy/repo clone |
|
353 | $ hg clone ssh://user@dummy/repo clone | |
354 | requesting all changes |
|
354 | requesting all changes | |
355 | remote: remote-changegroup |
|
355 | remote: remote-changegroup | |
356 | adding changesets |
|
356 | adding changesets | |
357 | adding manifests |
|
357 | adding manifests | |
358 | adding file changes |
|
358 | adding file changes | |
359 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
359 | added 8 changesets with 7 changes to 7 files (+2 heads) | |
360 | transaction abort! |
|
360 | transaction abort! | |
361 | rollback completed |
|
361 | rollback completed | |
362 | abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted: |
|
362 | abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted: | |
363 | sha1 mismatch: expected 0000000000000000000000000000000000000000, got 2c880cfec23cff7d8f80c2f12958d1563cbdaba6 |
|
363 | sha1 mismatch: expected 0000000000000000000000000000000000000000, got 2c880cfec23cff7d8f80c2f12958d1563cbdaba6 | |
364 | [255] |
|
364 | [255] | |
365 |
|
365 | |||
366 | Multiple hash digests can be given |
|
366 | Multiple hash digests can be given | |
367 |
|
367 | |||
368 | $ cat > repo/.hg/bundle2maker << EOF |
|
368 | $ cat > repo/.hg/bundle2maker << EOF | |
369 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'} |
|
369 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'} | |
370 | > EOF |
|
370 | > EOF | |
371 | $ hg clone ssh://user@dummy/repo clone |
|
371 | $ hg clone ssh://user@dummy/repo clone | |
372 | requesting all changes |
|
372 | requesting all changes | |
373 | remote: remote-changegroup |
|
373 | remote: remote-changegroup | |
374 | adding changesets |
|
374 | adding changesets | |
375 | adding manifests |
|
375 | adding manifests | |
376 | adding file changes |
|
376 | adding file changes | |
377 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
377 | added 8 changesets with 7 changes to 7 files (+2 heads) | |
378 | updating to branch default |
|
378 | updating to branch default | |
379 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
379 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
380 | $ rm -rf clone |
|
380 | $ rm -rf clone | |
381 |
|
381 | |||
382 | If either of the multiple hash digests mismatches, an error is thrown |
|
382 | If either of the multiple hash digests mismatches, an error is thrown | |
383 |
|
383 | |||
384 | $ cat > repo/.hg/bundle2maker << EOF |
|
384 | $ cat > repo/.hg/bundle2maker << EOF | |
385 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': '0' * 32, 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'} |
|
385 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': '0' * 32, 'digest:sha1': '2c880cfec23cff7d8f80c2f12958d1563cbdaba6'} | |
386 | > EOF |
|
386 | > EOF | |
387 | $ hg clone ssh://user@dummy/repo clone |
|
387 | $ hg clone ssh://user@dummy/repo clone | |
388 | requesting all changes |
|
388 | requesting all changes | |
389 | remote: remote-changegroup |
|
389 | remote: remote-changegroup | |
390 | adding changesets |
|
390 | adding changesets | |
391 | adding manifests |
|
391 | adding manifests | |
392 | adding file changes |
|
392 | adding file changes | |
393 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
393 | added 8 changesets with 7 changes to 7 files (+2 heads) | |
394 | transaction abort! |
|
394 | transaction abort! | |
395 | rollback completed |
|
395 | rollback completed | |
396 | abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted: |
|
396 | abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted: | |
397 | md5 mismatch: expected 00000000000000000000000000000000, got e22172c2907ef88794b7bea6642c2394 |
|
397 | md5 mismatch: expected 00000000000000000000000000000000, got e22172c2907ef88794b7bea6642c2394 | |
398 | [255] |
|
398 | [255] | |
399 |
|
399 | |||
400 | $ cat > repo/.hg/bundle2maker << EOF |
|
400 | $ cat > repo/.hg/bundle2maker << EOF | |
401 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '0' * 40} |
|
401 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle6.hg', 'size': 1663, 'digests': 'md5 sha1', 'digest:md5': 'e22172c2907ef88794b7bea6642c2394', 'digest:sha1': '0' * 40} | |
402 | > EOF |
|
402 | > EOF | |
403 | $ hg clone ssh://user@dummy/repo clone |
|
403 | $ hg clone ssh://user@dummy/repo clone | |
404 | requesting all changes |
|
404 | requesting all changes | |
405 | remote: remote-changegroup |
|
405 | remote: remote-changegroup | |
406 | adding changesets |
|
406 | adding changesets | |
407 | adding manifests |
|
407 | adding manifests | |
408 | adding file changes |
|
408 | adding file changes | |
409 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
409 | added 8 changesets with 7 changes to 7 files (+2 heads) | |
410 | transaction abort! |
|
410 | transaction abort! | |
411 | rollback completed |
|
411 | rollback completed | |
412 | abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted: |
|
412 | abort: bundle at http://localhost:$HGPORT/bundle6.hg is corrupted: | |
413 | sha1 mismatch: expected 0000000000000000000000000000000000000000, got 2c880cfec23cff7d8f80c2f12958d1563cbdaba6 |
|
413 | sha1 mismatch: expected 0000000000000000000000000000000000000000, got 2c880cfec23cff7d8f80c2f12958d1563cbdaba6 | |
414 | [255] |
|
414 | [255] | |
415 |
|
415 | |||
416 | Corruption tests |
|
416 | Corruption tests | |
417 |
|
417 | |||
418 | $ hg clone orig clone -r 2 |
|
418 | $ hg clone orig clone -r 2 | |
419 | adding changesets |
|
419 | adding changesets | |
420 | adding manifests |
|
420 | adding manifests | |
421 | adding file changes |
|
421 | adding file changes | |
422 | added 3 changesets with 3 changes to 3 files |
|
422 | added 3 changesets with 3 changes to 3 files | |
423 | updating to branch default |
|
423 | updating to branch default | |
424 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
424 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
425 |
|
425 | |||
426 | $ cat > repo/.hg/bundle2maker << EOF |
|
426 | $ cat > repo/.hg/bundle2maker << EOF | |
427 | > remote-changegroup http://localhost:$HGPORT/bundle4.hg bundle4.hg |
|
427 | > remote-changegroup http://localhost:$HGPORT/bundle4.hg bundle4.hg | |
428 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle5.hg', 'size': 578, 'digests': 'sha1', 'digest:sha1': '0' * 40} |
|
428 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle5.hg', 'size': 578, 'digests': 'sha1', 'digest:sha1': '0' * 40} | |
429 | > changegroup 0:6 7 |
|
429 | > changegroup 0:6 7 | |
430 | > EOF |
|
430 | > EOF | |
431 | $ hg pull -R clone ssh://user@dummy/repo |
|
431 | $ hg pull -R clone ssh://user@dummy/repo | |
432 | pulling from ssh://user@dummy/repo |
|
432 | pulling from ssh://user@dummy/repo | |
433 | searching for changes |
|
433 | searching for changes | |
434 | remote: remote-changegroup |
|
434 | remote: remote-changegroup | |
435 | adding changesets |
|
435 | adding changesets | |
436 | adding manifests |
|
436 | adding manifests | |
437 | adding file changes |
|
437 | adding file changes | |
438 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
438 | added 2 changesets with 2 changes to 2 files (+1 heads) | |
439 | remote: remote-changegroup |
|
439 | remote: remote-changegroup | |
440 | adding changesets |
|
440 | adding changesets | |
441 | adding manifests |
|
441 | adding manifests | |
442 | adding file changes |
|
442 | adding file changes | |
443 | added 2 changesets with 1 changes to 1 files |
|
443 | added 2 changesets with 1 changes to 1 files | |
444 | transaction abort! |
|
444 | transaction abort! | |
445 | rollback completed |
|
445 | rollback completed | |
446 | abort: bundle at http://localhost:$HGPORT/bundle5.hg is corrupted: |
|
446 | abort: bundle at http://localhost:$HGPORT/bundle5.hg is corrupted: | |
447 | sha1 mismatch: expected 0000000000000000000000000000000000000000, got f29485d6bfd37db99983cfc95ecb52f8ca396106 |
|
447 | sha1 mismatch: expected 0000000000000000000000000000000000000000, got f29485d6bfd37db99983cfc95ecb52f8ca396106 | |
448 | [255] |
|
448 | [255] | |
449 |
|
449 | |||
450 | The entire transaction has been rolled back in the pull above |
|
450 | The entire transaction has been rolled back in the pull above | |
451 |
|
451 | |||
452 | $ hg -R clone log -G |
|
452 | $ hg -R clone log -G | |
453 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
453 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C | |
454 | | |
|
454 | | | |
455 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
455 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B | |
456 | | |
|
456 | | | |
457 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
457 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A | |
458 |
|
458 | |||
459 |
|
459 | |||
460 | No params |
|
460 | No params | |
461 |
|
461 | |||
462 | $ cat > repo/.hg/bundle2maker << EOF |
|
462 | $ cat > repo/.hg/bundle2maker << EOF | |
463 | > raw-remote-changegroup {} |
|
463 | > raw-remote-changegroup {} | |
464 | > EOF |
|
464 | > EOF | |
465 | $ hg pull -R clone ssh://user@dummy/repo |
|
465 | $ hg pull -R clone ssh://user@dummy/repo | |
466 | pulling from ssh://user@dummy/repo |
|
466 | pulling from ssh://user@dummy/repo | |
467 | searching for changes |
|
467 | searching for changes | |
468 | remote: remote-changegroup |
|
468 | remote: remote-changegroup | |
469 | abort: remote-changegroup: missing "url" param |
|
469 | abort: remote-changegroup: missing "url" param | |
470 | [255] |
|
470 | [255] | |
471 |
|
471 | |||
472 | Missing size |
|
472 | Missing size | |
473 |
|
473 | |||
474 | $ cat > repo/.hg/bundle2maker << EOF |
|
474 | $ cat > repo/.hg/bundle2maker << EOF | |
475 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg'} |
|
475 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg'} | |
476 | > EOF |
|
476 | > EOF | |
477 | $ hg pull -R clone ssh://user@dummy/repo |
|
477 | $ hg pull -R clone ssh://user@dummy/repo | |
478 | pulling from ssh://user@dummy/repo |
|
478 | pulling from ssh://user@dummy/repo | |
479 | searching for changes |
|
479 | searching for changes | |
480 | remote: remote-changegroup |
|
480 | remote: remote-changegroup | |
481 | abort: remote-changegroup: missing "size" param |
|
481 | abort: remote-changegroup: missing "size" param | |
482 | [255] |
|
482 | [255] | |
483 |
|
483 | |||
484 | Invalid size |
|
484 | Invalid size | |
485 |
|
485 | |||
486 | $ cat > repo/.hg/bundle2maker << EOF |
|
486 | $ cat > repo/.hg/bundle2maker << EOF | |
487 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 'foo'} |
|
487 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 'foo'} | |
488 | > EOF |
|
488 | > EOF | |
489 | $ hg pull -R clone ssh://user@dummy/repo |
|
489 | $ hg pull -R clone ssh://user@dummy/repo | |
490 | pulling from ssh://user@dummy/repo |
|
490 | pulling from ssh://user@dummy/repo | |
491 | searching for changes |
|
491 | searching for changes | |
492 | remote: remote-changegroup |
|
492 | remote: remote-changegroup | |
493 | abort: remote-changegroup: invalid value for param "size" |
|
493 | abort: remote-changegroup: invalid value for param "size" | |
494 | [255] |
|
494 | [255] | |
495 |
|
495 | |||
496 | Size mismatch |
|
496 | Size mismatch | |
497 |
|
497 | |||
498 | $ cat > repo/.hg/bundle2maker << EOF |
|
498 | $ cat > repo/.hg/bundle2maker << EOF | |
499 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 42} |
|
499 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 42} | |
500 | > EOF |
|
500 | > EOF | |
501 | $ hg pull -R clone ssh://user@dummy/repo |
|
501 | $ hg pull -R clone ssh://user@dummy/repo | |
502 | pulling from ssh://user@dummy/repo |
|
502 | pulling from ssh://user@dummy/repo | |
503 | searching for changes |
|
503 | searching for changes | |
504 | remote: remote-changegroup |
|
504 | remote: remote-changegroup | |
505 | adding changesets |
|
505 | adding changesets | |
506 | adding manifests |
|
506 | adding manifests | |
507 | adding file changes |
|
507 | adding file changes | |
508 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
508 | added 2 changesets with 2 changes to 2 files (+1 heads) | |
509 | transaction abort! |
|
509 | transaction abort! | |
510 | rollback completed |
|
510 | rollback completed | |
511 | abort: bundle at http://localhost:$HGPORT/bundle4.hg is corrupted: |
|
511 | abort: bundle at http://localhost:$HGPORT/bundle4.hg is corrupted: | |
512 | size mismatch: expected 42, got 581 |
|
512 | size mismatch: expected 42, got 581 | |
513 | [255] |
|
513 | [255] | |
514 |
|
514 | |||
515 | Unknown digest |
|
515 | Unknown digest | |
516 |
|
516 | |||
517 | $ cat > repo/.hg/bundle2maker << EOF |
|
517 | $ cat > repo/.hg/bundle2maker << EOF | |
518 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'foo', 'digest:foo': 'bar'} |
|
518 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'foo', 'digest:foo': 'bar'} | |
519 | > EOF |
|
519 | > EOF | |
520 | $ hg pull -R clone ssh://user@dummy/repo |
|
520 | $ hg pull -R clone ssh://user@dummy/repo | |
521 | pulling from ssh://user@dummy/repo |
|
521 | pulling from ssh://user@dummy/repo | |
522 | searching for changes |
|
522 | searching for changes | |
523 | remote: remote-changegroup |
|
523 | remote: remote-changegroup | |
524 | abort: missing support for remote-changegroup - digest:foo |
|
524 | abort: missing support for remote-changegroup - digest:foo | |
525 | [255] |
|
525 | [255] | |
526 |
|
526 | |||
527 | Missing digest |
|
527 | Missing digest | |
528 |
|
528 | |||
529 | $ cat > repo/.hg/bundle2maker << EOF |
|
529 | $ cat > repo/.hg/bundle2maker << EOF | |
530 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'sha1'} |
|
530 | > raw-remote-changegroup {'url': 'http://localhost:$HGPORT/bundle4.hg', 'size': 581, 'digests': 'sha1'} | |
531 | > EOF |
|
531 | > EOF | |
532 | $ hg pull -R clone ssh://user@dummy/repo |
|
532 | $ hg pull -R clone ssh://user@dummy/repo | |
533 | pulling from ssh://user@dummy/repo |
|
533 | pulling from ssh://user@dummy/repo | |
534 | searching for changes |
|
534 | searching for changes | |
535 | remote: remote-changegroup |
|
535 | remote: remote-changegroup | |
536 | abort: remote-changegroup: missing "digest:sha1" param |
|
536 | abort: remote-changegroup: missing "digest:sha1" param | |
537 | [255] |
|
537 | [255] | |
538 |
|
538 | |||
539 | Not an HTTP url |
|
539 | Not an HTTP url | |
540 |
|
540 | |||
541 | $ cat > repo/.hg/bundle2maker << EOF |
|
541 | $ cat > repo/.hg/bundle2maker << EOF | |
542 | > raw-remote-changegroup {'url': 'ssh://localhost:$HGPORT/bundle4.hg', 'size': 581} |
|
542 | > raw-remote-changegroup {'url': 'ssh://localhost:$HGPORT/bundle4.hg', 'size': 581} | |
543 | > EOF |
|
543 | > EOF | |
544 | $ hg pull -R clone ssh://user@dummy/repo |
|
544 | $ hg pull -R clone ssh://user@dummy/repo | |
545 | pulling from ssh://user@dummy/repo |
|
545 | pulling from ssh://user@dummy/repo | |
546 | searching for changes |
|
546 | searching for changes | |
547 | remote: remote-changegroup |
|
547 | remote: remote-changegroup | |
548 | abort: remote-changegroup does not support ssh urls |
|
548 | abort: remote-changegroup does not support ssh urls | |
549 | [255] |
|
549 | [255] | |
550 |
|
550 | |||
551 | Not a bundle |
|
551 | Not a bundle | |
552 |
|
552 | |||
553 | $ cat > notbundle.hg << EOF |
|
553 | $ cat > notbundle.hg << EOF | |
554 | > foo |
|
554 | > foo | |
555 | > EOF |
|
555 | > EOF | |
556 | $ cat > repo/.hg/bundle2maker << EOF |
|
556 | $ cat > repo/.hg/bundle2maker << EOF | |
557 | > remote-changegroup http://localhost:$HGPORT/notbundle.hg notbundle.hg |
|
557 | > remote-changegroup http://localhost:$HGPORT/notbundle.hg notbundle.hg | |
558 | > EOF |
|
558 | > EOF | |
559 | $ hg pull -R clone ssh://user@dummy/repo |
|
559 | $ hg pull -R clone ssh://user@dummy/repo | |
560 | pulling from ssh://user@dummy/repo |
|
560 | pulling from ssh://user@dummy/repo | |
561 | searching for changes |
|
561 | searching for changes | |
562 | remote: remote-changegroup |
|
562 | remote: remote-changegroup | |
563 | abort: http://localhost:$HGPORT/notbundle.hg: not a Mercurial bundle |
|
563 | abort: http://localhost:$HGPORT/notbundle.hg: not a Mercurial bundle | |
564 | [255] |
|
564 | [255] | |
565 |
|
565 | |||
566 | Not a bundle 1.0 |
|
566 | Not a bundle 1.0 | |
567 |
|
567 | |||
568 | $ cat > notbundle10.hg << EOF |
|
568 | $ cat > notbundle10.hg << EOF | |
569 | > HG20 |
|
569 | > HG20 | |
570 | > EOF |
|
570 | > EOF | |
571 | $ cat > repo/.hg/bundle2maker << EOF |
|
571 | $ cat > repo/.hg/bundle2maker << EOF | |
572 | > remote-changegroup http://localhost:$HGPORT/notbundle10.hg notbundle10.hg |
|
572 | > remote-changegroup http://localhost:$HGPORT/notbundle10.hg notbundle10.hg | |
573 | > EOF |
|
573 | > EOF | |
574 | $ hg pull -R clone ssh://user@dummy/repo |
|
574 | $ hg pull -R clone ssh://user@dummy/repo | |
575 | pulling from ssh://user@dummy/repo |
|
575 | pulling from ssh://user@dummy/repo | |
576 | searching for changes |
|
576 | searching for changes | |
577 | remote: remote-changegroup |
|
577 | remote: remote-changegroup | |
578 | abort: http://localhost:$HGPORT/notbundle10.hg: not a bundle version 1.0 |
|
578 | abort: http://localhost:$HGPORT/notbundle10.hg: not a bundle version 1.0 | |
579 | [255] |
|
579 | [255] | |
580 |
|
580 | |||
581 | $ hg -R clone log -G |
|
581 | $ hg -R clone log -G | |
582 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C |
|
582 | @ 2:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> C | |
583 | | |
|
583 | | | |
584 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B |
|
584 | o 1:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> B | |
585 | | |
|
585 | | | |
586 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A |
|
586 | o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A | |
587 |
|
587 | |||
588 | $ rm -rf clone |
|
588 | $ rm -rf clone | |
589 |
|
589 | |||
590 | $ killdaemons.py |
|
590 | $ killdaemons.py |
@@ -1,937 +1,937 b'' | |||||
1 | commit hooks can see env vars |
|
1 | commit hooks can see env vars | |
2 | (and post-transaction one are run unlocked) |
|
2 | (and post-transaction one are run unlocked) | |
3 |
|
3 | |||
4 |
|
4 | |||
5 | $ cat > $TESTTMP/txnabort.checkargs.py <<EOF |
|
5 | $ cat > $TESTTMP/txnabort.checkargs.py <<EOF | |
6 | > def showargs(ui, repo, hooktype, **kwargs): |
|
6 | > def showargs(ui, repo, hooktype, **kwargs): | |
7 |
> ui.write('%s |
|
7 | > ui.write('%s Python hook: %s\n' % (hooktype, ','.join(sorted(kwargs)))) | |
8 | > EOF |
|
8 | > EOF | |
9 |
|
9 | |||
10 | $ hg init a |
|
10 | $ hg init a | |
11 | $ cd a |
|
11 | $ cd a | |
12 | $ cat > .hg/hgrc <<EOF |
|
12 | $ cat > .hg/hgrc <<EOF | |
13 | > [hooks] |
|
13 | > [hooks] | |
14 | > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit" |
|
14 | > commit = sh -c "HG_LOCAL= HG_TAG= printenv.py commit" | |
15 | > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b" |
|
15 | > commit.b = sh -c "HG_LOCAL= HG_TAG= printenv.py commit.b" | |
16 | > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit" |
|
16 | > precommit = sh -c "HG_LOCAL= HG_NODE= HG_TAG= printenv.py precommit" | |
17 | > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit" |
|
17 | > pretxncommit = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxncommit" | |
18 | > pretxncommit.tip = hg -q tip |
|
18 | > pretxncommit.tip = hg -q tip | |
19 | > pre-identify = sh -c "printenv.py pre-identify 1" |
|
19 | > pre-identify = sh -c "printenv.py pre-identify 1" | |
20 | > pre-cat = sh -c "printenv.py pre-cat" |
|
20 | > pre-cat = sh -c "printenv.py pre-cat" | |
21 | > post-cat = sh -c "printenv.py post-cat" |
|
21 | > post-cat = sh -c "printenv.py post-cat" | |
22 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen" |
|
22 | > pretxnopen = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnopen" | |
23 | > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose" |
|
23 | > pretxnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py pretxnclose" | |
24 | > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose" |
|
24 | > txnclose = sh -c "HG_LOCAL= HG_TAG= printenv.py txnclose" | |
25 | > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs |
|
25 | > txnabort.0 = python:$TESTTMP/txnabort.checkargs.py:showargs | |
26 | > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort" |
|
26 | > txnabort.1 = sh -c "HG_LOCAL= HG_TAG= printenv.py txnabort" | |
27 | > txnclose.checklock = sh -c "hg debuglock > /dev/null" |
|
27 | > txnclose.checklock = sh -c "hg debuglock > /dev/null" | |
28 | > EOF |
|
28 | > EOF | |
29 | $ echo a > a |
|
29 | $ echo a > a | |
30 | $ hg add a |
|
30 | $ hg add a | |
31 | $ hg commit -m a |
|
31 | $ hg commit -m a | |
32 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=0000000000000000000000000000000000000000 |
|
32 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=0000000000000000000000000000000000000000 | |
33 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
33 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
34 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a |
|
34 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 HG_PENDING=$TESTTMP/a | |
35 | 0:cb9a9f314b8b |
|
35 | 0:cb9a9f314b8b | |
36 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
36 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
37 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
37 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_PHASES_MOVED=1 HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
38 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 |
|
38 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 | |
39 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 |
|
39 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PARENT1=0000000000000000000000000000000000000000 | |
40 |
|
40 | |||
41 | $ hg clone . ../b |
|
41 | $ hg clone . ../b | |
42 | updating to branch default |
|
42 | updating to branch default | |
43 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
43 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
44 | $ cd ../b |
|
44 | $ cd ../b | |
45 |
|
45 | |||
46 | changegroup hooks can see env vars |
|
46 | changegroup hooks can see env vars | |
47 |
|
47 | |||
48 | $ cat > .hg/hgrc <<EOF |
|
48 | $ cat > .hg/hgrc <<EOF | |
49 | > [hooks] |
|
49 | > [hooks] | |
50 | > prechangegroup = sh -c "printenv.py prechangegroup" |
|
50 | > prechangegroup = sh -c "printenv.py prechangegroup" | |
51 | > changegroup = sh -c "printenv.py changegroup" |
|
51 | > changegroup = sh -c "printenv.py changegroup" | |
52 | > incoming = sh -c "printenv.py incoming" |
|
52 | > incoming = sh -c "printenv.py incoming" | |
53 | > EOF |
|
53 | > EOF | |
54 |
|
54 | |||
55 | pretxncommit and commit hooks can see both parents of merge |
|
55 | pretxncommit and commit hooks can see both parents of merge | |
56 |
|
56 | |||
57 | $ cd ../a |
|
57 | $ cd ../a | |
58 | $ echo b >> a |
|
58 | $ echo b >> a | |
59 | $ hg commit -m a1 -d "1 0" |
|
59 | $ hg commit -m a1 -d "1 0" | |
60 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
60 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
61 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
61 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
62 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
62 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a | |
63 | 1:ab228980c14d |
|
63 | 1:ab228980c14d | |
64 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
64 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
65 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
65 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
66 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
66 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
67 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
67 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
68 | $ hg update -C 0 |
|
68 | $ hg update -C 0 | |
69 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
69 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
70 | $ echo b > b |
|
70 | $ echo b > b | |
71 | $ hg add b |
|
71 | $ hg add b | |
72 | $ hg commit -m b -d '1 0' |
|
72 | $ hg commit -m b -d '1 0' | |
73 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
73 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
74 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
74 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
75 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a |
|
75 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b HG_PENDING=$TESTTMP/a | |
76 | 2:ee9deb46ab31 |
|
76 | 2:ee9deb46ab31 | |
77 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
77 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
78 | created new head |
|
78 | created new head | |
79 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
79 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
80 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
80 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
81 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b |
|
81 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT1=cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b | |
82 | $ hg merge 1 |
|
82 | $ hg merge 1 | |
83 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
83 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
84 | (branch merge, don't forget to commit) |
|
84 | (branch merge, don't forget to commit) | |
85 | $ hg commit -m merge -d '2 0' |
|
85 | $ hg commit -m merge -d '2 0' | |
86 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
86 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd | |
87 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
87 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
88 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a |
|
88 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd HG_PENDING=$TESTTMP/a | |
89 | 3:07f3376c1e65 |
|
89 | 3:07f3376c1e65 | |
90 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
90 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
91 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
91 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
92 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
92 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd | |
93 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd |
|
93 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PARENT1=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_PARENT2=ab228980c14deea8b9555d91c9581127383e40fd | |
94 |
|
94 | |||
95 | test generic hooks |
|
95 | test generic hooks | |
96 |
|
96 | |||
97 | $ hg id |
|
97 | $ hg id | |
98 | pre-identify hook: HG_ARGS=id HG_HOOKNAME=pre-identify HG_HOOKTYPE=pre-identify HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None, 'template': ''} HG_PATS=[] |
|
98 | pre-identify hook: HG_ARGS=id HG_HOOKNAME=pre-identify HG_HOOKTYPE=pre-identify HG_OPTS={'bookmarks': None, 'branch': None, 'id': None, 'insecure': None, 'num': None, 'remotecmd': '', 'rev': '', 'ssh': '', 'tags': None, 'template': ''} HG_PATS=[] | |
99 | abort: pre-identify hook exited with status 1 |
|
99 | abort: pre-identify hook exited with status 1 | |
100 | [255] |
|
100 | [255] | |
101 | $ hg cat b |
|
101 | $ hg cat b | |
102 | pre-cat hook: HG_ARGS=cat b HG_HOOKNAME=pre-cat HG_HOOKTYPE=pre-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] |
|
102 | pre-cat hook: HG_ARGS=cat b HG_HOOKNAME=pre-cat HG_HOOKTYPE=pre-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] | |
103 | b |
|
103 | b | |
104 | post-cat hook: HG_ARGS=cat b HG_HOOKNAME=post-cat HG_HOOKTYPE=post-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] HG_RESULT=0 |
|
104 | post-cat hook: HG_ARGS=cat b HG_HOOKNAME=post-cat HG_HOOKTYPE=post-cat HG_OPTS={'decode': None, 'exclude': [], 'include': [], 'output': '', 'rev': '', 'template': ''} HG_PATS=['b'] HG_RESULT=0 | |
105 |
|
105 | |||
106 | $ cd ../b |
|
106 | $ cd ../b | |
107 | $ hg pull ../a |
|
107 | $ hg pull ../a | |
108 | pulling from ../a |
|
108 | pulling from ../a | |
109 | searching for changes |
|
109 | searching for changes | |
110 | prechangegroup hook: HG_HOOKNAME=prechangegroup HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
110 | prechangegroup hook: HG_HOOKNAME=prechangegroup HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
111 | adding changesets |
|
111 | adding changesets | |
112 | adding manifests |
|
112 | adding manifests | |
113 | adding file changes |
|
113 | adding file changes | |
114 | added 3 changesets with 2 changes to 2 files |
|
114 | added 3 changesets with 2 changes to 2 files | |
115 | changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
115 | changegroup hook: HG_HOOKNAME=changegroup HG_HOOKTYPE=changegroup HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_NODE_LAST=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
116 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
116 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ab228980c14deea8b9555d91c9581127383e40fd HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
117 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
117 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=ee9deb46ab31e4cc3310f3cf0c3d668e4d8fffc2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
118 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
118 | incoming hook: HG_HOOKNAME=incoming HG_HOOKTYPE=incoming HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
119 | (run 'hg update' to get a working copy) |
|
119 | (run 'hg update' to get a working copy) | |
120 |
|
120 | |||
121 | tag hooks can see env vars |
|
121 | tag hooks can see env vars | |
122 |
|
122 | |||
123 | $ cd ../a |
|
123 | $ cd ../a | |
124 | $ cat >> .hg/hgrc <<EOF |
|
124 | $ cat >> .hg/hgrc <<EOF | |
125 | > pretag = sh -c "printenv.py pretag" |
|
125 | > pretag = sh -c "printenv.py pretag" | |
126 | > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag" |
|
126 | > tag = sh -c "HG_PARENT1= HG_PARENT2= printenv.py tag" | |
127 | > EOF |
|
127 | > EOF | |
128 | $ hg tag -d '3 0' a |
|
128 | $ hg tag -d '3 0' a | |
129 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a |
|
129 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a | |
130 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
130 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 | |
131 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
131 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
132 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a |
|
132 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 HG_PENDING=$TESTTMP/a | |
133 | 4:539e4b31b6dc |
|
133 | 4:539e4b31b6dc | |
134 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
134 | pretxnclose hook: HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
135 | tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a |
|
135 | tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=0 HG_NODE=07f3376c1e655977439df2a814e3cc14b27abac2 HG_TAG=a | |
136 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
136 | txnclose hook: HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
137 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
137 | commit hook: HG_HOOKNAME=commit HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 | |
138 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 |
|
138 | commit.b hook: HG_HOOKNAME=commit.b HG_HOOKTYPE=commit HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PARENT1=07f3376c1e655977439df2a814e3cc14b27abac2 | |
139 | $ hg tag -l la |
|
139 | $ hg tag -l la | |
140 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la |
|
140 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la | |
141 | tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la |
|
141 | tag hook: HG_HOOKNAME=tag HG_HOOKTYPE=tag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=la | |
142 |
|
142 | |||
143 | pretag hook can forbid tagging |
|
143 | pretag hook can forbid tagging | |
144 |
|
144 | |||
145 | $ cat >> .hg/hgrc <<EOF |
|
145 | $ cat >> .hg/hgrc <<EOF | |
146 | > pretag.forbid = sh -c "printenv.py pretag.forbid 1" |
|
146 | > pretag.forbid = sh -c "printenv.py pretag.forbid 1" | |
147 | > EOF |
|
147 | > EOF | |
148 | $ hg tag -d '4 0' fa |
|
148 | $ hg tag -d '4 0' fa | |
149 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa |
|
149 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa | |
150 | pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa |
|
150 | pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=0 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fa | |
151 | abort: pretag.forbid hook exited with status 1 |
|
151 | abort: pretag.forbid hook exited with status 1 | |
152 | [255] |
|
152 | [255] | |
153 | $ hg tag -l fla |
|
153 | $ hg tag -l fla | |
154 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla |
|
154 | pretag hook: HG_HOOKNAME=pretag HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla | |
155 | pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla |
|
155 | pretag.forbid hook: HG_HOOKNAME=pretag.forbid HG_HOOKTYPE=pretag HG_LOCAL=1 HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_TAG=fla | |
156 | abort: pretag.forbid hook exited with status 1 |
|
156 | abort: pretag.forbid hook exited with status 1 | |
157 | [255] |
|
157 | [255] | |
158 |
|
158 | |||
159 | pretxncommit hook can see changeset, can roll back txn, changeset no |
|
159 | pretxncommit hook can see changeset, can roll back txn, changeset no | |
160 | more there after |
|
160 | more there after | |
161 |
|
161 | |||
162 | $ cat >> .hg/hgrc <<EOF |
|
162 | $ cat >> .hg/hgrc <<EOF | |
163 | > pretxncommit.forbid0 = sh -c "hg tip -q" |
|
163 | > pretxncommit.forbid0 = sh -c "hg tip -q" | |
164 | > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1" |
|
164 | > pretxncommit.forbid1 = sh -c "printenv.py pretxncommit.forbid 1" | |
165 | > EOF |
|
165 | > EOF | |
166 | $ echo z > z |
|
166 | $ echo z > z | |
167 | $ hg add z |
|
167 | $ hg add z | |
168 | $ hg -q tip |
|
168 | $ hg -q tip | |
169 | 4:539e4b31b6dc |
|
169 | 4:539e4b31b6dc | |
170 | $ hg commit -m 'fail' -d '4 0' |
|
170 | $ hg commit -m 'fail' -d '4 0' | |
171 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
171 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 | |
172 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
172 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
173 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a |
|
173 | pretxncommit hook: HG_HOOKNAME=pretxncommit HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a | |
174 | 5:6f611f8018c1 |
|
174 | 5:6f611f8018c1 | |
175 | 5:6f611f8018c1 |
|
175 | 5:6f611f8018c1 | |
176 | pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1 HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a |
|
176 | pretxncommit.forbid hook: HG_HOOKNAME=pretxncommit.forbid1 HG_HOOKTYPE=pretxncommit HG_NODE=6f611f8018c10e827fee6bd2bc807f937e761567 HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/a | |
177 | transaction abort! |
|
177 | transaction abort! | |
178 |
txnabort |
|
178 | txnabort Python hook: txnid,txnname | |
179 | txnabort hook: HG_HOOKNAME=txnabort.1 HG_HOOKTYPE=txnabort HG_TXNID=TXN:$ID$ HG_TXNNAME=commit |
|
179 | txnabort hook: HG_HOOKNAME=txnabort.1 HG_HOOKTYPE=txnabort HG_TXNID=TXN:$ID$ HG_TXNNAME=commit | |
180 | rollback completed |
|
180 | rollback completed | |
181 | abort: pretxncommit.forbid1 hook exited with status 1 |
|
181 | abort: pretxncommit.forbid1 hook exited with status 1 | |
182 | [255] |
|
182 | [255] | |
183 | $ hg -q tip |
|
183 | $ hg -q tip | |
184 | 4:539e4b31b6dc |
|
184 | 4:539e4b31b6dc | |
185 |
|
185 | |||
186 | (Check that no 'changelog.i.a' file were left behind) |
|
186 | (Check that no 'changelog.i.a' file were left behind) | |
187 |
|
187 | |||
188 | $ ls -1 .hg/store/ |
|
188 | $ ls -1 .hg/store/ | |
189 | 00changelog.i |
|
189 | 00changelog.i | |
190 | 00manifest.i |
|
190 | 00manifest.i | |
191 | data |
|
191 | data | |
192 | fncache |
|
192 | fncache | |
193 | journal.phaseroots |
|
193 | journal.phaseroots | |
194 | phaseroots |
|
194 | phaseroots | |
195 | undo |
|
195 | undo | |
196 | undo.backup.fncache |
|
196 | undo.backup.fncache | |
197 | undo.backupfiles |
|
197 | undo.backupfiles | |
198 | undo.phaseroots |
|
198 | undo.phaseroots | |
199 |
|
199 | |||
200 |
|
200 | |||
201 | precommit hook can prevent commit |
|
201 | precommit hook can prevent commit | |
202 |
|
202 | |||
203 | $ cat >> .hg/hgrc <<EOF |
|
203 | $ cat >> .hg/hgrc <<EOF | |
204 | > precommit.forbid = sh -c "printenv.py precommit.forbid 1" |
|
204 | > precommit.forbid = sh -c "printenv.py precommit.forbid 1" | |
205 | > EOF |
|
205 | > EOF | |
206 | $ hg commit -m 'fail' -d '4 0' |
|
206 | $ hg commit -m 'fail' -d '4 0' | |
207 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
207 | precommit hook: HG_HOOKNAME=precommit HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 | |
208 | precommit.forbid hook: HG_HOOKNAME=precommit.forbid HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 |
|
208 | precommit.forbid hook: HG_HOOKNAME=precommit.forbid HG_HOOKTYPE=precommit HG_PARENT1=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 | |
209 | abort: precommit.forbid hook exited with status 1 |
|
209 | abort: precommit.forbid hook exited with status 1 | |
210 | [255] |
|
210 | [255] | |
211 | $ hg -q tip |
|
211 | $ hg -q tip | |
212 | 4:539e4b31b6dc |
|
212 | 4:539e4b31b6dc | |
213 |
|
213 | |||
214 | preupdate hook can prevent update |
|
214 | preupdate hook can prevent update | |
215 |
|
215 | |||
216 | $ cat >> .hg/hgrc <<EOF |
|
216 | $ cat >> .hg/hgrc <<EOF | |
217 | > preupdate = sh -c "printenv.py preupdate" |
|
217 | > preupdate = sh -c "printenv.py preupdate" | |
218 | > EOF |
|
218 | > EOF | |
219 | $ hg update 1 |
|
219 | $ hg update 1 | |
220 | preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=ab228980c14d |
|
220 | preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=ab228980c14d | |
221 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
221 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
222 |
|
222 | |||
223 | update hook |
|
223 | update hook | |
224 |
|
224 | |||
225 | $ cat >> .hg/hgrc <<EOF |
|
225 | $ cat >> .hg/hgrc <<EOF | |
226 | > update = sh -c "printenv.py update" |
|
226 | > update = sh -c "printenv.py update" | |
227 | > EOF |
|
227 | > EOF | |
228 | $ hg update |
|
228 | $ hg update | |
229 | preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=539e4b31b6dc |
|
229 | preupdate hook: HG_HOOKNAME=preupdate HG_HOOKTYPE=preupdate HG_PARENT1=539e4b31b6dc | |
230 | update hook: HG_ERROR=0 HG_HOOKNAME=update HG_HOOKTYPE=update HG_PARENT1=539e4b31b6dc |
|
230 | update hook: HG_ERROR=0 HG_HOOKNAME=update HG_HOOKTYPE=update HG_PARENT1=539e4b31b6dc | |
231 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
231 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
232 |
|
232 | |||
233 | pushkey hook |
|
233 | pushkey hook | |
234 |
|
234 | |||
235 | $ cat >> .hg/hgrc <<EOF |
|
235 | $ cat >> .hg/hgrc <<EOF | |
236 | > pushkey = sh -c "printenv.py pushkey" |
|
236 | > pushkey = sh -c "printenv.py pushkey" | |
237 | > EOF |
|
237 | > EOF | |
238 | $ cd ../b |
|
238 | $ cd ../b | |
239 | $ hg bookmark -r null foo |
|
239 | $ hg bookmark -r null foo | |
240 | $ hg push -B foo ../a |
|
240 | $ hg push -B foo ../a | |
241 | pushing to ../a |
|
241 | pushing to ../a | |
242 | searching for changes |
|
242 | searching for changes | |
243 | no changes found |
|
243 | no changes found | |
244 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push |
|
244 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push | |
245 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a |
|
245 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a | |
246 | pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1 |
|
246 | pushkey hook: HG_HOOKNAME=pushkey HG_HOOKTYPE=pushkey HG_KEY=foo HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_RET=1 | |
247 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a |
|
247 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_TXNNAME=push HG_URL=file:$TESTTMP/a | |
248 | exporting bookmark foo |
|
248 | exporting bookmark foo | |
249 | [1] |
|
249 | [1] | |
250 | $ cd ../a |
|
250 | $ cd ../a | |
251 |
|
251 | |||
252 | listkeys hook |
|
252 | listkeys hook | |
253 |
|
253 | |||
254 | $ cat >> .hg/hgrc <<EOF |
|
254 | $ cat >> .hg/hgrc <<EOF | |
255 | > listkeys = sh -c "printenv.py listkeys" |
|
255 | > listkeys = sh -c "printenv.py listkeys" | |
256 | > EOF |
|
256 | > EOF | |
257 | $ hg bookmark -r null bar |
|
257 | $ hg bookmark -r null bar | |
258 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
258 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
259 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
259 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
260 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
260 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
261 | $ cd ../b |
|
261 | $ cd ../b | |
262 | $ hg pull -B bar ../a |
|
262 | $ hg pull -B bar ../a | |
263 | pulling from ../a |
|
263 | pulling from ../a | |
264 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} |
|
264 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} | |
265 | no changes found |
|
265 | no changes found | |
266 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} |
|
266 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} | |
267 | adding remote bookmark bar |
|
267 | adding remote bookmark bar | |
268 | $ cd ../a |
|
268 | $ cd ../a | |
269 |
|
269 | |||
270 | test that prepushkey can prevent incoming keys |
|
270 | test that prepushkey can prevent incoming keys | |
271 |
|
271 | |||
272 | $ cat >> .hg/hgrc <<EOF |
|
272 | $ cat >> .hg/hgrc <<EOF | |
273 | > prepushkey = sh -c "printenv.py prepushkey.forbid 1" |
|
273 | > prepushkey = sh -c "printenv.py prepushkey.forbid 1" | |
274 | > EOF |
|
274 | > EOF | |
275 | $ cd ../b |
|
275 | $ cd ../b | |
276 | $ hg bookmark -r null baz |
|
276 | $ hg bookmark -r null baz | |
277 | $ hg push -B baz ../a |
|
277 | $ hg push -B baz ../a | |
278 | pushing to ../a |
|
278 | pushing to ../a | |
279 | searching for changes |
|
279 | searching for changes | |
280 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} |
|
280 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'} | |
281 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} |
|
281 | listkeys hook: HG_HOOKNAME=listkeys HG_HOOKTYPE=listkeys HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'} | |
282 | no changes found |
|
282 | no changes found | |
283 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push |
|
283 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=push | |
284 | prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
284 | prepushkey.forbid hook: HG_BUNDLE2=1 HG_HOOKNAME=prepushkey HG_HOOKTYPE=prepushkey HG_KEY=baz HG_NAMESPACE=bookmarks HG_NEW=0000000000000000000000000000000000000000 HG_SOURCE=push HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
285 | pushkey-abort: prepushkey hook exited with status 1 |
|
285 | pushkey-abort: prepushkey hook exited with status 1 | |
286 | abort: exporting bookmark baz failed! |
|
286 | abort: exporting bookmark baz failed! | |
287 | [255] |
|
287 | [255] | |
288 | $ cd ../a |
|
288 | $ cd ../a | |
289 |
|
289 | |||
290 | test that prelistkeys can prevent listing keys |
|
290 | test that prelistkeys can prevent listing keys | |
291 |
|
291 | |||
292 | $ cat >> .hg/hgrc <<EOF |
|
292 | $ cat >> .hg/hgrc <<EOF | |
293 | > prelistkeys = sh -c "printenv.py prelistkeys.forbid 1" |
|
293 | > prelistkeys = sh -c "printenv.py prelistkeys.forbid 1" | |
294 | > EOF |
|
294 | > EOF | |
295 | $ hg bookmark -r null quux |
|
295 | $ hg bookmark -r null quux | |
296 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
296 | pretxnopen hook: HG_HOOKNAME=pretxnopen HG_HOOKTYPE=pretxnopen HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
297 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
297 | pretxnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=pretxnclose HG_HOOKTYPE=pretxnclose HG_PENDING=$TESTTMP/a HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
298 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark |
|
298 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_HOOKNAME=txnclose HG_HOOKTYPE=txnclose HG_TXNID=TXN:$ID$ HG_TXNNAME=bookmark | |
299 | $ cd ../b |
|
299 | $ cd ../b | |
300 | $ hg pull -B quux ../a |
|
300 | $ hg pull -B quux ../a | |
301 | pulling from ../a |
|
301 | pulling from ../a | |
302 | prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys HG_HOOKTYPE=prelistkeys HG_NAMESPACE=bookmarks |
|
302 | prelistkeys.forbid hook: HG_HOOKNAME=prelistkeys HG_HOOKTYPE=prelistkeys HG_NAMESPACE=bookmarks | |
303 | abort: prelistkeys hook exited with status 1 |
|
303 | abort: prelistkeys hook exited with status 1 | |
304 | [255] |
|
304 | [255] | |
305 | $ cd ../a |
|
305 | $ cd ../a | |
306 | $ rm .hg/hgrc |
|
306 | $ rm .hg/hgrc | |
307 |
|
307 | |||
308 | prechangegroup hook can prevent incoming changes |
|
308 | prechangegroup hook can prevent incoming changes | |
309 |
|
309 | |||
310 | $ cd ../b |
|
310 | $ cd ../b | |
311 | $ hg -q tip |
|
311 | $ hg -q tip | |
312 | 3:07f3376c1e65 |
|
312 | 3:07f3376c1e65 | |
313 | $ cat > .hg/hgrc <<EOF |
|
313 | $ cat > .hg/hgrc <<EOF | |
314 | > [hooks] |
|
314 | > [hooks] | |
315 | > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1" |
|
315 | > prechangegroup.forbid = sh -c "printenv.py prechangegroup.forbid 1" | |
316 | > EOF |
|
316 | > EOF | |
317 | $ hg pull ../a |
|
317 | $ hg pull ../a | |
318 | pulling from ../a |
|
318 | pulling from ../a | |
319 | searching for changes |
|
319 | searching for changes | |
320 | prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
320 | prechangegroup.forbid hook: HG_HOOKNAME=prechangegroup.forbid HG_HOOKTYPE=prechangegroup HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
321 | abort: prechangegroup.forbid hook exited with status 1 |
|
321 | abort: prechangegroup.forbid hook exited with status 1 | |
322 | [255] |
|
322 | [255] | |
323 |
|
323 | |||
324 | pretxnchangegroup hook can see incoming changes, can roll back txn, |
|
324 | pretxnchangegroup hook can see incoming changes, can roll back txn, | |
325 | incoming changes no longer there after |
|
325 | incoming changes no longer there after | |
326 |
|
326 | |||
327 | $ cat > .hg/hgrc <<EOF |
|
327 | $ cat > .hg/hgrc <<EOF | |
328 | > [hooks] |
|
328 | > [hooks] | |
329 | > pretxnchangegroup.forbid0 = hg tip -q |
|
329 | > pretxnchangegroup.forbid0 = hg tip -q | |
330 | > pretxnchangegroup.forbid1 = sh -c "printenv.py pretxnchangegroup.forbid 1" |
|
330 | > pretxnchangegroup.forbid1 = sh -c "printenv.py pretxnchangegroup.forbid 1" | |
331 | > EOF |
|
331 | > EOF | |
332 | $ hg pull ../a |
|
332 | $ hg pull ../a | |
333 | pulling from ../a |
|
333 | pulling from ../a | |
334 | searching for changes |
|
334 | searching for changes | |
335 | adding changesets |
|
335 | adding changesets | |
336 | adding manifests |
|
336 | adding manifests | |
337 | adding file changes |
|
337 | adding file changes | |
338 | added 1 changesets with 1 changes to 1 files |
|
338 | added 1 changesets with 1 changes to 1 files | |
339 | 4:539e4b31b6dc |
|
339 | 4:539e4b31b6dc | |
340 | pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1 HG_HOOKTYPE=pretxnchangegroup HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a |
|
340 | pretxnchangegroup.forbid hook: HG_HOOKNAME=pretxnchangegroup.forbid1 HG_HOOKTYPE=pretxnchangegroup HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_NODE_LAST=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_PENDING=$TESTTMP/b HG_SOURCE=pull HG_TXNID=TXN:$ID$ HG_URL=file:$TESTTMP/a | |
341 | transaction abort! |
|
341 | transaction abort! | |
342 | rollback completed |
|
342 | rollback completed | |
343 | abort: pretxnchangegroup.forbid1 hook exited with status 1 |
|
343 | abort: pretxnchangegroup.forbid1 hook exited with status 1 | |
344 | [255] |
|
344 | [255] | |
345 | $ hg -q tip |
|
345 | $ hg -q tip | |
346 | 3:07f3376c1e65 |
|
346 | 3:07f3376c1e65 | |
347 |
|
347 | |||
348 | outgoing hooks can see env vars |
|
348 | outgoing hooks can see env vars | |
349 |
|
349 | |||
350 | $ rm .hg/hgrc |
|
350 | $ rm .hg/hgrc | |
351 | $ cat > ../a/.hg/hgrc <<EOF |
|
351 | $ cat > ../a/.hg/hgrc <<EOF | |
352 | > [hooks] |
|
352 | > [hooks] | |
353 | > preoutgoing = sh -c "printenv.py preoutgoing" |
|
353 | > preoutgoing = sh -c "printenv.py preoutgoing" | |
354 | > outgoing = sh -c "printenv.py outgoing" |
|
354 | > outgoing = sh -c "printenv.py outgoing" | |
355 | > EOF |
|
355 | > EOF | |
356 | $ hg pull ../a |
|
356 | $ hg pull ../a | |
357 | pulling from ../a |
|
357 | pulling from ../a | |
358 | searching for changes |
|
358 | searching for changes | |
359 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull |
|
359 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull | |
360 | outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull |
|
360 | outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=539e4b31b6dc99b3cfbaa6b53cbc1c1f9a1e3a10 HG_SOURCE=pull | |
361 | adding changesets |
|
361 | adding changesets | |
362 | adding manifests |
|
362 | adding manifests | |
363 | adding file changes |
|
363 | adding file changes | |
364 | added 1 changesets with 1 changes to 1 files |
|
364 | added 1 changesets with 1 changes to 1 files | |
365 | adding remote bookmark quux |
|
365 | adding remote bookmark quux | |
366 | (run 'hg update' to get a working copy) |
|
366 | (run 'hg update' to get a working copy) | |
367 | $ hg rollback |
|
367 | $ hg rollback | |
368 | repository tip rolled back to revision 3 (undo pull) |
|
368 | repository tip rolled back to revision 3 (undo pull) | |
369 |
|
369 | |||
370 | preoutgoing hook can prevent outgoing changes |
|
370 | preoutgoing hook can prevent outgoing changes | |
371 |
|
371 | |||
372 | $ cat >> ../a/.hg/hgrc <<EOF |
|
372 | $ cat >> ../a/.hg/hgrc <<EOF | |
373 | > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1" |
|
373 | > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1" | |
374 | > EOF |
|
374 | > EOF | |
375 | $ hg pull ../a |
|
375 | $ hg pull ../a | |
376 | pulling from ../a |
|
376 | pulling from ../a | |
377 | searching for changes |
|
377 | searching for changes | |
378 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull |
|
378 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=pull | |
379 | preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=pull |
|
379 | preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=pull | |
380 | abort: preoutgoing.forbid hook exited with status 1 |
|
380 | abort: preoutgoing.forbid hook exited with status 1 | |
381 | [255] |
|
381 | [255] | |
382 |
|
382 | |||
383 | outgoing hooks work for local clones |
|
383 | outgoing hooks work for local clones | |
384 |
|
384 | |||
385 | $ cd .. |
|
385 | $ cd .. | |
386 | $ cat > a/.hg/hgrc <<EOF |
|
386 | $ cat > a/.hg/hgrc <<EOF | |
387 | > [hooks] |
|
387 | > [hooks] | |
388 | > preoutgoing = sh -c "printenv.py preoutgoing" |
|
388 | > preoutgoing = sh -c "printenv.py preoutgoing" | |
389 | > outgoing = sh -c "printenv.py outgoing" |
|
389 | > outgoing = sh -c "printenv.py outgoing" | |
390 | > EOF |
|
390 | > EOF | |
391 | $ hg clone a c |
|
391 | $ hg clone a c | |
392 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone |
|
392 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone | |
393 | outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone |
|
393 | outgoing hook: HG_HOOKNAME=outgoing HG_HOOKTYPE=outgoing HG_NODE=0000000000000000000000000000000000000000 HG_SOURCE=clone | |
394 | updating to branch default |
|
394 | updating to branch default | |
395 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
395 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
396 | $ rm -rf c |
|
396 | $ rm -rf c | |
397 |
|
397 | |||
398 | preoutgoing hook can prevent outgoing changes for local clones |
|
398 | preoutgoing hook can prevent outgoing changes for local clones | |
399 |
|
399 | |||
400 | $ cat >> a/.hg/hgrc <<EOF |
|
400 | $ cat >> a/.hg/hgrc <<EOF | |
401 | > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1" |
|
401 | > preoutgoing.forbid = sh -c "printenv.py preoutgoing.forbid 1" | |
402 | > EOF |
|
402 | > EOF | |
403 | $ hg clone a zzz |
|
403 | $ hg clone a zzz | |
404 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone |
|
404 | preoutgoing hook: HG_HOOKNAME=preoutgoing HG_HOOKTYPE=preoutgoing HG_SOURCE=clone | |
405 | preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=clone |
|
405 | preoutgoing.forbid hook: HG_HOOKNAME=preoutgoing.forbid HG_HOOKTYPE=preoutgoing HG_SOURCE=clone | |
406 | abort: preoutgoing.forbid hook exited with status 1 |
|
406 | abort: preoutgoing.forbid hook exited with status 1 | |
407 | [255] |
|
407 | [255] | |
408 |
|
408 | |||
409 | $ cd "$TESTTMP/b" |
|
409 | $ cd "$TESTTMP/b" | |
410 |
|
410 | |||
411 | $ cat > hooktests.py <<EOF |
|
411 | $ cat > hooktests.py <<EOF | |
412 | > from mercurial import error |
|
412 | > from mercurial import error | |
413 | > |
|
413 | > | |
414 | > uncallable = 0 |
|
414 | > uncallable = 0 | |
415 | > |
|
415 | > | |
416 | > def printargs(args): |
|
416 | > def printargs(args): | |
417 | > args.pop('ui', None) |
|
417 | > args.pop('ui', None) | |
418 | > args.pop('repo', None) |
|
418 | > args.pop('repo', None) | |
419 | > a = list(args.items()) |
|
419 | > a = list(args.items()) | |
420 | > a.sort() |
|
420 | > a.sort() | |
421 | > print 'hook args:' |
|
421 | > print 'hook args:' | |
422 | > for k, v in a: |
|
422 | > for k, v in a: | |
423 | > print ' ', k, v |
|
423 | > print ' ', k, v | |
424 | > |
|
424 | > | |
425 | > def passhook(**args): |
|
425 | > def passhook(**args): | |
426 | > printargs(args) |
|
426 | > printargs(args) | |
427 | > |
|
427 | > | |
428 | > def failhook(**args): |
|
428 | > def failhook(**args): | |
429 | > printargs(args) |
|
429 | > printargs(args) | |
430 | > return True |
|
430 | > return True | |
431 | > |
|
431 | > | |
432 | > class LocalException(Exception): |
|
432 | > class LocalException(Exception): | |
433 | > pass |
|
433 | > pass | |
434 | > |
|
434 | > | |
435 | > def raisehook(**args): |
|
435 | > def raisehook(**args): | |
436 | > raise LocalException('exception from hook') |
|
436 | > raise LocalException('exception from hook') | |
437 | > |
|
437 | > | |
438 | > def aborthook(**args): |
|
438 | > def aborthook(**args): | |
439 | > raise error.Abort('raise abort from hook') |
|
439 | > raise error.Abort('raise abort from hook') | |
440 | > |
|
440 | > | |
441 | > def brokenhook(**args): |
|
441 | > def brokenhook(**args): | |
442 | > return 1 + {} |
|
442 | > return 1 + {} | |
443 | > |
|
443 | > | |
444 | > def verbosehook(ui, **args): |
|
444 | > def verbosehook(ui, **args): | |
445 | > ui.note('verbose output from hook\n') |
|
445 | > ui.note('verbose output from hook\n') | |
446 | > |
|
446 | > | |
447 | > def printtags(ui, repo, **args): |
|
447 | > def printtags(ui, repo, **args): | |
448 | > print sorted(repo.tags()) |
|
448 | > print sorted(repo.tags()) | |
449 | > |
|
449 | > | |
450 | > class container: |
|
450 | > class container: | |
451 | > unreachable = 1 |
|
451 | > unreachable = 1 | |
452 | > EOF |
|
452 | > EOF | |
453 |
|
453 | |||
454 | $ cat > syntaxerror.py << EOF |
|
454 | $ cat > syntaxerror.py << EOF | |
455 | > (foo |
|
455 | > (foo | |
456 | > EOF |
|
456 | > EOF | |
457 |
|
457 | |||
458 | test python hooks |
|
458 | test python hooks | |
459 |
|
459 | |||
460 | #if windows |
|
460 | #if windows | |
461 | $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH" |
|
461 | $ PYTHONPATH="$TESTTMP/b;$PYTHONPATH" | |
462 | #else |
|
462 | #else | |
463 | $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH" |
|
463 | $ PYTHONPATH="$TESTTMP/b:$PYTHONPATH" | |
464 | #endif |
|
464 | #endif | |
465 | $ export PYTHONPATH |
|
465 | $ export PYTHONPATH | |
466 |
|
466 | |||
467 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
467 | $ echo '[hooks]' > ../a/.hg/hgrc | |
468 | $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc |
|
468 | $ echo 'preoutgoing.broken = python:hooktests.brokenhook' >> ../a/.hg/hgrc | |
469 | $ hg pull ../a 2>&1 | grep 'raised an exception' |
|
469 | $ hg pull ../a 2>&1 | grep 'raised an exception' | |
470 | error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' |
|
470 | error: preoutgoing.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' | |
471 |
|
471 | |||
472 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
472 | $ echo '[hooks]' > ../a/.hg/hgrc | |
473 | $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc |
|
473 | $ echo 'preoutgoing.raise = python:hooktests.raisehook' >> ../a/.hg/hgrc | |
474 | $ hg pull ../a 2>&1 | grep 'raised an exception' |
|
474 | $ hg pull ../a 2>&1 | grep 'raised an exception' | |
475 | error: preoutgoing.raise hook raised an exception: exception from hook |
|
475 | error: preoutgoing.raise hook raised an exception: exception from hook | |
476 |
|
476 | |||
477 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
477 | $ echo '[hooks]' > ../a/.hg/hgrc | |
478 | $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc |
|
478 | $ echo 'preoutgoing.abort = python:hooktests.aborthook' >> ../a/.hg/hgrc | |
479 | $ hg pull ../a |
|
479 | $ hg pull ../a | |
480 | pulling from ../a |
|
480 | pulling from ../a | |
481 | searching for changes |
|
481 | searching for changes | |
482 | error: preoutgoing.abort hook failed: raise abort from hook |
|
482 | error: preoutgoing.abort hook failed: raise abort from hook | |
483 | abort: raise abort from hook |
|
483 | abort: raise abort from hook | |
484 | [255] |
|
484 | [255] | |
485 |
|
485 | |||
486 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
486 | $ echo '[hooks]' > ../a/.hg/hgrc | |
487 | $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc |
|
487 | $ echo 'preoutgoing.fail = python:hooktests.failhook' >> ../a/.hg/hgrc | |
488 | $ hg pull ../a |
|
488 | $ hg pull ../a | |
489 | pulling from ../a |
|
489 | pulling from ../a | |
490 | searching for changes |
|
490 | searching for changes | |
491 | hook args: |
|
491 | hook args: | |
492 | hooktype preoutgoing |
|
492 | hooktype preoutgoing | |
493 | source pull |
|
493 | source pull | |
494 | abort: preoutgoing.fail hook failed |
|
494 | abort: preoutgoing.fail hook failed | |
495 | [255] |
|
495 | [255] | |
496 |
|
496 | |||
497 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
497 | $ echo '[hooks]' > ../a/.hg/hgrc | |
498 | $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc |
|
498 | $ echo 'preoutgoing.uncallable = python:hooktests.uncallable' >> ../a/.hg/hgrc | |
499 | $ hg pull ../a |
|
499 | $ hg pull ../a | |
500 | pulling from ../a |
|
500 | pulling from ../a | |
501 | searching for changes |
|
501 | searching for changes | |
502 | abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable |
|
502 | abort: preoutgoing.uncallable hook is invalid: "hooktests.uncallable" is not callable | |
503 | [255] |
|
503 | [255] | |
504 |
|
504 | |||
505 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
505 | $ echo '[hooks]' > ../a/.hg/hgrc | |
506 | $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc |
|
506 | $ echo 'preoutgoing.nohook = python:hooktests.nohook' >> ../a/.hg/hgrc | |
507 | $ hg pull ../a |
|
507 | $ hg pull ../a | |
508 | pulling from ../a |
|
508 | pulling from ../a | |
509 | searching for changes |
|
509 | searching for changes | |
510 | abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined |
|
510 | abort: preoutgoing.nohook hook is invalid: "hooktests.nohook" is not defined | |
511 | [255] |
|
511 | [255] | |
512 |
|
512 | |||
513 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
513 | $ echo '[hooks]' > ../a/.hg/hgrc | |
514 | $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc |
|
514 | $ echo 'preoutgoing.nomodule = python:nomodule' >> ../a/.hg/hgrc | |
515 | $ hg pull ../a |
|
515 | $ hg pull ../a | |
516 | pulling from ../a |
|
516 | pulling from ../a | |
517 | searching for changes |
|
517 | searching for changes | |
518 | abort: preoutgoing.nomodule hook is invalid: "nomodule" not in a module |
|
518 | abort: preoutgoing.nomodule hook is invalid: "nomodule" not in a module | |
519 | [255] |
|
519 | [255] | |
520 |
|
520 | |||
521 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
521 | $ echo '[hooks]' > ../a/.hg/hgrc | |
522 | $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc |
|
522 | $ echo 'preoutgoing.badmodule = python:nomodule.nowhere' >> ../a/.hg/hgrc | |
523 | $ hg pull ../a |
|
523 | $ hg pull ../a | |
524 | pulling from ../a |
|
524 | pulling from ../a | |
525 | searching for changes |
|
525 | searching for changes | |
526 | abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed |
|
526 | abort: preoutgoing.badmodule hook is invalid: import of "nomodule" failed | |
527 | (run with --traceback for stack trace) |
|
527 | (run with --traceback for stack trace) | |
528 | [255] |
|
528 | [255] | |
529 |
|
529 | |||
530 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
530 | $ echo '[hooks]' > ../a/.hg/hgrc | |
531 | $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc |
|
531 | $ echo 'preoutgoing.unreachable = python:hooktests.container.unreachable' >> ../a/.hg/hgrc | |
532 | $ hg pull ../a |
|
532 | $ hg pull ../a | |
533 | pulling from ../a |
|
533 | pulling from ../a | |
534 | searching for changes |
|
534 | searching for changes | |
535 | abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed |
|
535 | abort: preoutgoing.unreachable hook is invalid: import of "hooktests.container" failed | |
536 | (run with --traceback for stack trace) |
|
536 | (run with --traceback for stack trace) | |
537 | [255] |
|
537 | [255] | |
538 |
|
538 | |||
539 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
539 | $ echo '[hooks]' > ../a/.hg/hgrc | |
540 | $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc |
|
540 | $ echo 'preoutgoing.syntaxerror = python:syntaxerror.syntaxerror' >> ../a/.hg/hgrc | |
541 | $ hg pull ../a |
|
541 | $ hg pull ../a | |
542 | pulling from ../a |
|
542 | pulling from ../a | |
543 | searching for changes |
|
543 | searching for changes | |
544 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
544 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
545 | (run with --traceback for stack trace) |
|
545 | (run with --traceback for stack trace) | |
546 | [255] |
|
546 | [255] | |
547 |
|
547 | |||
548 | The second egrep is to filter out lines like ' ^', which are slightly |
|
548 | The second egrep is to filter out lines like ' ^', which are slightly | |
549 | different between Python 2.6 and Python 2.7. |
|
549 | different between Python 2.6 and Python 2.7. | |
550 | $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$' |
|
550 | $ hg pull ../a --traceback 2>&1 | egrep -v '^( +File| [_a-zA-Z*(])' | egrep -v '^( )+(\^)?$' | |
551 | pulling from ../a |
|
551 | pulling from ../a | |
552 | searching for changes |
|
552 | searching for changes | |
553 | exception from first failed import attempt: |
|
553 | exception from first failed import attempt: | |
554 | Traceback (most recent call last): |
|
554 | Traceback (most recent call last): | |
555 | SyntaxError: * (glob) |
|
555 | SyntaxError: * (glob) | |
556 | exception from second failed import attempt: |
|
556 | exception from second failed import attempt: | |
557 | Traceback (most recent call last): |
|
557 | Traceback (most recent call last): | |
558 | ImportError: No module named hgext_syntaxerror |
|
558 | ImportError: No module named hgext_syntaxerror | |
559 | Traceback (most recent call last): |
|
559 | Traceback (most recent call last): | |
560 | HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
560 | HookLoadError: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
561 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed |
|
561 | abort: preoutgoing.syntaxerror hook is invalid: import of "syntaxerror" failed | |
562 |
|
562 | |||
563 | $ echo '[hooks]' > ../a/.hg/hgrc |
|
563 | $ echo '[hooks]' > ../a/.hg/hgrc | |
564 | $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc |
|
564 | $ echo 'preoutgoing.pass = python:hooktests.passhook' >> ../a/.hg/hgrc | |
565 | $ hg pull ../a |
|
565 | $ hg pull ../a | |
566 | pulling from ../a |
|
566 | pulling from ../a | |
567 | searching for changes |
|
567 | searching for changes | |
568 | hook args: |
|
568 | hook args: | |
569 | hooktype preoutgoing |
|
569 | hooktype preoutgoing | |
570 | source pull |
|
570 | source pull | |
571 | adding changesets |
|
571 | adding changesets | |
572 | adding manifests |
|
572 | adding manifests | |
573 | adding file changes |
|
573 | adding file changes | |
574 | added 1 changesets with 1 changes to 1 files |
|
574 | added 1 changesets with 1 changes to 1 files | |
575 | adding remote bookmark quux |
|
575 | adding remote bookmark quux | |
576 | (run 'hg update' to get a working copy) |
|
576 | (run 'hg update' to get a working copy) | |
577 |
|
577 | |||
578 | post- python hooks that fail to *run* don't cause an abort |
|
578 | post- python hooks that fail to *run* don't cause an abort | |
579 | $ rm ../a/.hg/hgrc |
|
579 | $ rm ../a/.hg/hgrc | |
580 | $ echo '[hooks]' > .hg/hgrc |
|
580 | $ echo '[hooks]' > .hg/hgrc | |
581 | $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc |
|
581 | $ echo 'post-pull.broken = python:hooktests.brokenhook' >> .hg/hgrc | |
582 | $ hg pull ../a |
|
582 | $ hg pull ../a | |
583 | pulling from ../a |
|
583 | pulling from ../a | |
584 | searching for changes |
|
584 | searching for changes | |
585 | no changes found |
|
585 | no changes found | |
586 | error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' |
|
586 | error: post-pull.broken hook raised an exception: unsupported operand type(s) for +: 'int' and 'dict' | |
587 | (run with --traceback for stack trace) |
|
587 | (run with --traceback for stack trace) | |
588 |
|
588 | |||
589 | but post- python hooks that fail to *load* do |
|
589 | but post- python hooks that fail to *load* do | |
590 | $ echo '[hooks]' > .hg/hgrc |
|
590 | $ echo '[hooks]' > .hg/hgrc | |
591 | $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc |
|
591 | $ echo 'post-pull.nomodule = python:nomodule' >> .hg/hgrc | |
592 | $ hg pull ../a |
|
592 | $ hg pull ../a | |
593 | pulling from ../a |
|
593 | pulling from ../a | |
594 | searching for changes |
|
594 | searching for changes | |
595 | no changes found |
|
595 | no changes found | |
596 | abort: post-pull.nomodule hook is invalid: "nomodule" not in a module |
|
596 | abort: post-pull.nomodule hook is invalid: "nomodule" not in a module | |
597 | [255] |
|
597 | [255] | |
598 |
|
598 | |||
599 | $ echo '[hooks]' > .hg/hgrc |
|
599 | $ echo '[hooks]' > .hg/hgrc | |
600 | $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc |
|
600 | $ echo 'post-pull.badmodule = python:nomodule.nowhere' >> .hg/hgrc | |
601 | $ hg pull ../a |
|
601 | $ hg pull ../a | |
602 | pulling from ../a |
|
602 | pulling from ../a | |
603 | searching for changes |
|
603 | searching for changes | |
604 | no changes found |
|
604 | no changes found | |
605 | abort: post-pull.badmodule hook is invalid: import of "nomodule" failed |
|
605 | abort: post-pull.badmodule hook is invalid: import of "nomodule" failed | |
606 | (run with --traceback for stack trace) |
|
606 | (run with --traceback for stack trace) | |
607 | [255] |
|
607 | [255] | |
608 |
|
608 | |||
609 | $ echo '[hooks]' > .hg/hgrc |
|
609 | $ echo '[hooks]' > .hg/hgrc | |
610 | $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc |
|
610 | $ echo 'post-pull.nohook = python:hooktests.nohook' >> .hg/hgrc | |
611 | $ hg pull ../a |
|
611 | $ hg pull ../a | |
612 | pulling from ../a |
|
612 | pulling from ../a | |
613 | searching for changes |
|
613 | searching for changes | |
614 | no changes found |
|
614 | no changes found | |
615 | abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined |
|
615 | abort: post-pull.nohook hook is invalid: "hooktests.nohook" is not defined | |
616 | [255] |
|
616 | [255] | |
617 |
|
617 | |||
618 | make sure --traceback works |
|
618 | make sure --traceback works | |
619 |
|
619 | |||
620 | $ echo '[hooks]' > .hg/hgrc |
|
620 | $ echo '[hooks]' > .hg/hgrc | |
621 | $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc |
|
621 | $ echo 'commit.abort = python:hooktests.aborthook' >> .hg/hgrc | |
622 |
|
622 | |||
623 | $ echo aa > a |
|
623 | $ echo aa > a | |
624 | $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback' |
|
624 | $ hg --traceback commit -d '0 0' -ma 2>&1 | grep '^Traceback' | |
625 | Traceback (most recent call last): |
|
625 | Traceback (most recent call last): | |
626 |
|
626 | |||
627 | $ cd .. |
|
627 | $ cd .. | |
628 | $ hg init c |
|
628 | $ hg init c | |
629 | $ cd c |
|
629 | $ cd c | |
630 |
|
630 | |||
631 | $ cat > hookext.py <<EOF |
|
631 | $ cat > hookext.py <<EOF | |
632 | > def autohook(**args): |
|
632 | > def autohook(**args): | |
633 | > print "Automatically installed hook" |
|
633 | > print "Automatically installed hook" | |
634 | > |
|
634 | > | |
635 | > def reposetup(ui, repo): |
|
635 | > def reposetup(ui, repo): | |
636 | > repo.ui.setconfig("hooks", "commit.auto", autohook) |
|
636 | > repo.ui.setconfig("hooks", "commit.auto", autohook) | |
637 | > EOF |
|
637 | > EOF | |
638 | $ echo '[extensions]' >> .hg/hgrc |
|
638 | $ echo '[extensions]' >> .hg/hgrc | |
639 | $ echo 'hookext = hookext.py' >> .hg/hgrc |
|
639 | $ echo 'hookext = hookext.py' >> .hg/hgrc | |
640 |
|
640 | |||
641 | $ touch foo |
|
641 | $ touch foo | |
642 | $ hg add foo |
|
642 | $ hg add foo | |
643 | $ hg ci -d '0 0' -m 'add foo' |
|
643 | $ hg ci -d '0 0' -m 'add foo' | |
644 | Automatically installed hook |
|
644 | Automatically installed hook | |
645 | $ echo >> foo |
|
645 | $ echo >> foo | |
646 | $ hg ci --debug -d '0 0' -m 'change foo' |
|
646 | $ hg ci --debug -d '0 0' -m 'change foo' | |
647 | committing files: |
|
647 | committing files: | |
648 | foo |
|
648 | foo | |
649 | committing manifest |
|
649 | committing manifest | |
650 | committing changelog |
|
650 | committing changelog | |
651 | updating the branch cache |
|
651 | updating the branch cache | |
652 | committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708 |
|
652 | committed changeset 1:52998019f6252a2b893452765fcb0a47351a5708 | |
653 | calling hook commit.auto: hgext_hookext.autohook |
|
653 | calling hook commit.auto: hgext_hookext.autohook | |
654 | Automatically installed hook |
|
654 | Automatically installed hook | |
655 |
|
655 | |||
656 | $ hg showconfig hooks |
|
656 | $ hg showconfig hooks | |
657 | hooks.commit.auto=<function autohook at *> (glob) |
|
657 | hooks.commit.auto=<function autohook at *> (glob) | |
658 |
|
658 | |||
659 | test python hook configured with python:[file]:[hook] syntax |
|
659 | test python hook configured with python:[file]:[hook] syntax | |
660 |
|
660 | |||
661 | $ cd .. |
|
661 | $ cd .. | |
662 | $ mkdir d |
|
662 | $ mkdir d | |
663 | $ cd d |
|
663 | $ cd d | |
664 | $ hg init repo |
|
664 | $ hg init repo | |
665 | $ mkdir hooks |
|
665 | $ mkdir hooks | |
666 |
|
666 | |||
667 | $ cd hooks |
|
667 | $ cd hooks | |
668 | $ cat > testhooks.py <<EOF |
|
668 | $ cat > testhooks.py <<EOF | |
669 | > def testhook(**args): |
|
669 | > def testhook(**args): | |
670 | > print 'hook works' |
|
670 | > print 'hook works' | |
671 | > EOF |
|
671 | > EOF | |
672 | $ echo '[hooks]' > ../repo/.hg/hgrc |
|
672 | $ echo '[hooks]' > ../repo/.hg/hgrc | |
673 | $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc |
|
673 | $ echo "pre-commit.test = python:`pwd`/testhooks.py:testhook" >> ../repo/.hg/hgrc | |
674 |
|
674 | |||
675 | $ cd ../repo |
|
675 | $ cd ../repo | |
676 | $ hg commit -d '0 0' |
|
676 | $ hg commit -d '0 0' | |
677 | hook works |
|
677 | hook works | |
678 | nothing changed |
|
678 | nothing changed | |
679 | [1] |
|
679 | [1] | |
680 |
|
680 | |||
681 | $ echo '[hooks]' > .hg/hgrc |
|
681 | $ echo '[hooks]' > .hg/hgrc | |
682 | $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc |
|
682 | $ echo "update.ne = python:`pwd`/nonexistent.py:testhook" >> .hg/hgrc | |
683 | $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc |
|
683 | $ echo "pre-identify.npmd = python:`pwd`/:no_python_module_dir" >> .hg/hgrc | |
684 |
|
684 | |||
685 | $ hg up null |
|
685 | $ hg up null | |
686 | loading update.ne hook failed: |
|
686 | loading update.ne hook failed: | |
687 | abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py |
|
687 | abort: No such file or directory: $TESTTMP/d/repo/nonexistent.py | |
688 | [255] |
|
688 | [255] | |
689 |
|
689 | |||
690 | $ hg id |
|
690 | $ hg id | |
691 | loading pre-identify.npmd hook failed: |
|
691 | loading pre-identify.npmd hook failed: | |
692 | abort: No module named repo! |
|
692 | abort: No module named repo! | |
693 | [255] |
|
693 | [255] | |
694 |
|
694 | |||
695 | $ cd ../../b |
|
695 | $ cd ../../b | |
696 |
|
696 | |||
697 | make sure --traceback works on hook import failure |
|
697 | make sure --traceback works on hook import failure | |
698 |
|
698 | |||
699 | $ cat > importfail.py <<EOF |
|
699 | $ cat > importfail.py <<EOF | |
700 | > import somebogusmodule |
|
700 | > import somebogusmodule | |
701 | > # dereference something in the module to force demandimport to load it |
|
701 | > # dereference something in the module to force demandimport to load it | |
702 | > somebogusmodule.whatever |
|
702 | > somebogusmodule.whatever | |
703 | > EOF |
|
703 | > EOF | |
704 |
|
704 | |||
705 | $ echo '[hooks]' > .hg/hgrc |
|
705 | $ echo '[hooks]' > .hg/hgrc | |
706 | $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc |
|
706 | $ echo 'precommit.importfail = python:importfail.whatever' >> .hg/hgrc | |
707 |
|
707 | |||
708 | $ echo a >> a |
|
708 | $ echo a >> a | |
709 | $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])' |
|
709 | $ hg --traceback commit -ma 2>&1 | egrep -v '^( +File| [a-zA-Z(])' | |
710 | exception from first failed import attempt: |
|
710 | exception from first failed import attempt: | |
711 | Traceback (most recent call last): |
|
711 | Traceback (most recent call last): | |
712 | ImportError: No module named somebogusmodule |
|
712 | ImportError: No module named somebogusmodule | |
713 | exception from second failed import attempt: |
|
713 | exception from second failed import attempt: | |
714 | Traceback (most recent call last): |
|
714 | Traceback (most recent call last): | |
715 | ImportError: No module named hgext_importfail |
|
715 | ImportError: No module named hgext_importfail | |
716 | Traceback (most recent call last): |
|
716 | Traceback (most recent call last): | |
717 | HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed |
|
717 | HookLoadError: precommit.importfail hook is invalid: import of "importfail" failed | |
718 | abort: precommit.importfail hook is invalid: import of "importfail" failed |
|
718 | abort: precommit.importfail hook is invalid: import of "importfail" failed | |
719 |
|
719 | |||
720 | Issue1827: Hooks Update & Commit not completely post operation |
|
720 | Issue1827: Hooks Update & Commit not completely post operation | |
721 |
|
721 | |||
722 | commit and update hooks should run after command completion. The largefiles |
|
722 | commit and update hooks should run after command completion. The largefiles | |
723 | use demonstrates a recursive wlock, showing the hook doesn't run until the |
|
723 | use demonstrates a recursive wlock, showing the hook doesn't run until the | |
724 | final release (and dirstate flush). |
|
724 | final release (and dirstate flush). | |
725 |
|
725 | |||
726 | $ echo '[hooks]' > .hg/hgrc |
|
726 | $ echo '[hooks]' > .hg/hgrc | |
727 | $ echo 'commit = hg id' >> .hg/hgrc |
|
727 | $ echo 'commit = hg id' >> .hg/hgrc | |
728 | $ echo 'update = hg id' >> .hg/hgrc |
|
728 | $ echo 'update = hg id' >> .hg/hgrc | |
729 | $ echo bb > a |
|
729 | $ echo bb > a | |
730 | $ hg ci -ma |
|
730 | $ hg ci -ma | |
731 | 223eafe2750c tip |
|
731 | 223eafe2750c tip | |
732 | $ hg up 0 --config extensions.largefiles= |
|
732 | $ hg up 0 --config extensions.largefiles= | |
733 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) |
|
733 | The fsmonitor extension is incompatible with the largefiles extension and has been disabled. (fsmonitor !) | |
734 | cb9a9f314b8b |
|
734 | cb9a9f314b8b | |
735 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
735 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
736 |
|
736 | |||
737 | make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui |
|
737 | make sure --verbose (and --quiet/--debug etc.) are propagated to the local ui | |
738 | that is passed to pre/post hooks |
|
738 | that is passed to pre/post hooks | |
739 |
|
739 | |||
740 | $ echo '[hooks]' > .hg/hgrc |
|
740 | $ echo '[hooks]' > .hg/hgrc | |
741 | $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc |
|
741 | $ echo 'pre-identify = python:hooktests.verbosehook' >> .hg/hgrc | |
742 | $ hg id |
|
742 | $ hg id | |
743 | cb9a9f314b8b |
|
743 | cb9a9f314b8b | |
744 | $ hg id --verbose |
|
744 | $ hg id --verbose | |
745 | calling hook pre-identify: hooktests.verbosehook |
|
745 | calling hook pre-identify: hooktests.verbosehook | |
746 | verbose output from hook |
|
746 | verbose output from hook | |
747 | cb9a9f314b8b |
|
747 | cb9a9f314b8b | |
748 |
|
748 | |||
749 | Ensure hooks can be prioritized |
|
749 | Ensure hooks can be prioritized | |
750 |
|
750 | |||
751 | $ echo '[hooks]' > .hg/hgrc |
|
751 | $ echo '[hooks]' > .hg/hgrc | |
752 | $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc |
|
752 | $ echo 'pre-identify.a = python:hooktests.verbosehook' >> .hg/hgrc | |
753 | $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc |
|
753 | $ echo 'pre-identify.b = python:hooktests.verbosehook' >> .hg/hgrc | |
754 | $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc |
|
754 | $ echo 'priority.pre-identify.b = 1' >> .hg/hgrc | |
755 | $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc |
|
755 | $ echo 'pre-identify.c = python:hooktests.verbosehook' >> .hg/hgrc | |
756 | $ hg id --verbose |
|
756 | $ hg id --verbose | |
757 | calling hook pre-identify.b: hooktests.verbosehook |
|
757 | calling hook pre-identify.b: hooktests.verbosehook | |
758 | verbose output from hook |
|
758 | verbose output from hook | |
759 | calling hook pre-identify.a: hooktests.verbosehook |
|
759 | calling hook pre-identify.a: hooktests.verbosehook | |
760 | verbose output from hook |
|
760 | verbose output from hook | |
761 | calling hook pre-identify.c: hooktests.verbosehook |
|
761 | calling hook pre-identify.c: hooktests.verbosehook | |
762 | verbose output from hook |
|
762 | verbose output from hook | |
763 | cb9a9f314b8b |
|
763 | cb9a9f314b8b | |
764 |
|
764 | |||
765 | new tags must be visible in pretxncommit (issue3210) |
|
765 | new tags must be visible in pretxncommit (issue3210) | |
766 |
|
766 | |||
767 | $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc |
|
767 | $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc | |
768 | $ hg tag -f foo |
|
768 | $ hg tag -f foo | |
769 | ['a', 'foo', 'tip'] |
|
769 | ['a', 'foo', 'tip'] | |
770 |
|
770 | |||
771 | post-init hooks must not crash (issue4983) |
|
771 | post-init hooks must not crash (issue4983) | |
772 | This also creates the `to` repo for the next test block. |
|
772 | This also creates the `to` repo for the next test block. | |
773 |
|
773 | |||
774 | $ cd .. |
|
774 | $ cd .. | |
775 | $ cat << EOF >> hgrc-with-post-init-hook |
|
775 | $ cat << EOF >> hgrc-with-post-init-hook | |
776 | > [hooks] |
|
776 | > [hooks] | |
777 | > post-init = sh -c "printenv.py post-init" |
|
777 | > post-init = sh -c "printenv.py post-init" | |
778 | > EOF |
|
778 | > EOF | |
779 | $ HGRCPATH=hgrc-with-post-init-hook hg init to |
|
779 | $ HGRCPATH=hgrc-with-post-init-hook hg init to | |
780 | post-init hook: HG_ARGS=init to HG_HOOKNAME=post-init HG_HOOKTYPE=post-init HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0 |
|
780 | post-init hook: HG_ARGS=init to HG_HOOKNAME=post-init HG_HOOKTYPE=post-init HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0 | |
781 |
|
781 | |||
782 | new commits must be visible in pretxnchangegroup (issue3428) |
|
782 | new commits must be visible in pretxnchangegroup (issue3428) | |
783 |
|
783 | |||
784 | $ echo '[hooks]' >> to/.hg/hgrc |
|
784 | $ echo '[hooks]' >> to/.hg/hgrc | |
785 | $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc |
|
785 | $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc | |
786 | $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc |
|
786 | $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc | |
787 | $ echo a >> to/a |
|
787 | $ echo a >> to/a | |
788 | $ hg --cwd to ci -Ama |
|
788 | $ hg --cwd to ci -Ama | |
789 | adding a |
|
789 | adding a | |
790 | $ hg clone to from |
|
790 | $ hg clone to from | |
791 | updating to branch default |
|
791 | updating to branch default | |
792 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
792 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
793 | $ echo aa >> from/a |
|
793 | $ echo aa >> from/a | |
794 | $ hg --cwd from ci -mb |
|
794 | $ hg --cwd from ci -mb | |
795 | $ hg --cwd from push |
|
795 | $ hg --cwd from push | |
796 | pushing to $TESTTMP/to (glob) |
|
796 | pushing to $TESTTMP/to (glob) | |
797 | searching for changes |
|
797 | searching for changes | |
798 | changeset: 0:cb9a9f314b8b |
|
798 | changeset: 0:cb9a9f314b8b | |
799 | tag: tip |
|
799 | tag: tip | |
800 | user: test |
|
800 | user: test | |
801 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
801 | date: Thu Jan 01 00:00:00 1970 +0000 | |
802 | summary: a |
|
802 | summary: a | |
803 |
|
803 | |||
804 | adding changesets |
|
804 | adding changesets | |
805 | adding manifests |
|
805 | adding manifests | |
806 | adding file changes |
|
806 | adding file changes | |
807 | added 1 changesets with 1 changes to 1 files |
|
807 | added 1 changesets with 1 changes to 1 files | |
808 | changeset: 1:9836a07b9b9d |
|
808 | changeset: 1:9836a07b9b9d | |
809 | tag: tip |
|
809 | tag: tip | |
810 | user: test |
|
810 | user: test | |
811 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
811 | date: Thu Jan 01 00:00:00 1970 +0000 | |
812 | summary: b |
|
812 | summary: b | |
813 |
|
813 | |||
814 |
|
814 | |||
815 | pretxnclose hook failure should abort the transaction |
|
815 | pretxnclose hook failure should abort the transaction | |
816 |
|
816 | |||
817 | $ hg init txnfailure |
|
817 | $ hg init txnfailure | |
818 | $ cd txnfailure |
|
818 | $ cd txnfailure | |
819 | $ touch a && hg commit -Aqm a |
|
819 | $ touch a && hg commit -Aqm a | |
820 | $ cat >> .hg/hgrc <<EOF |
|
820 | $ cat >> .hg/hgrc <<EOF | |
821 | > [hooks] |
|
821 | > [hooks] | |
822 | > pretxnclose.error = exit 1 |
|
822 | > pretxnclose.error = exit 1 | |
823 | > EOF |
|
823 | > EOF | |
824 | $ hg strip -r 0 --config extensions.strip= |
|
824 | $ hg strip -r 0 --config extensions.strip= | |
825 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
825 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
826 | saved backup bundle to * (glob) |
|
826 | saved backup bundle to * (glob) | |
827 | transaction abort! |
|
827 | transaction abort! | |
828 | rollback completed |
|
828 | rollback completed | |
829 | strip failed, backup bundle stored in * (glob) |
|
829 | strip failed, backup bundle stored in * (glob) | |
830 | abort: pretxnclose.error hook exited with status 1 |
|
830 | abort: pretxnclose.error hook exited with status 1 | |
831 | [255] |
|
831 | [255] | |
832 | $ hg recover |
|
832 | $ hg recover | |
833 | no interrupted transaction available |
|
833 | no interrupted transaction available | |
834 | [1] |
|
834 | [1] | |
835 | $ cd .. |
|
835 | $ cd .. | |
836 |
|
836 | |||
837 | check whether HG_PENDING makes pending changes only in related |
|
837 | check whether HG_PENDING makes pending changes only in related | |
838 | repositories visible to an external hook. |
|
838 | repositories visible to an external hook. | |
839 |
|
839 | |||
840 | (emulate a transaction running concurrently by copied |
|
840 | (emulate a transaction running concurrently by copied | |
841 | .hg/store/00changelog.i.a in subsequent test) |
|
841 | .hg/store/00changelog.i.a in subsequent test) | |
842 |
|
842 | |||
843 | $ cat > $TESTTMP/savepending.sh <<EOF |
|
843 | $ cat > $TESTTMP/savepending.sh <<EOF | |
844 | > cp .hg/store/00changelog.i.a .hg/store/00changelog.i.a.saved |
|
844 | > cp .hg/store/00changelog.i.a .hg/store/00changelog.i.a.saved | |
845 | > exit 1 # to avoid adding new revision for subsequent tests |
|
845 | > exit 1 # to avoid adding new revision for subsequent tests | |
846 | > EOF |
|
846 | > EOF | |
847 | $ cd a |
|
847 | $ cd a | |
848 | $ hg tip -q |
|
848 | $ hg tip -q | |
849 | 4:539e4b31b6dc |
|
849 | 4:539e4b31b6dc | |
850 | $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" commit -m "invisible" |
|
850 | $ hg --config hooks.pretxnclose="sh $TESTTMP/savepending.sh" commit -m "invisible" | |
851 | transaction abort! |
|
851 | transaction abort! | |
852 | rollback completed |
|
852 | rollback completed | |
853 | abort: pretxnclose hook exited with status 1 |
|
853 | abort: pretxnclose hook exited with status 1 | |
854 | [255] |
|
854 | [255] | |
855 | $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a |
|
855 | $ cp .hg/store/00changelog.i.a.saved .hg/store/00changelog.i.a | |
856 |
|
856 | |||
857 | (check (in)visibility of new changeset while transaction running in |
|
857 | (check (in)visibility of new changeset while transaction running in | |
858 | repo) |
|
858 | repo) | |
859 |
|
859 | |||
860 | $ cat > $TESTTMP/checkpending.sh <<EOF |
|
860 | $ cat > $TESTTMP/checkpending.sh <<EOF | |
861 | > echo '@a' |
|
861 | > echo '@a' | |
862 | > hg -R "$TESTTMP/a" tip -q |
|
862 | > hg -R "$TESTTMP/a" tip -q | |
863 | > echo '@a/nested' |
|
863 | > echo '@a/nested' | |
864 | > hg -R "$TESTTMP/a/nested" tip -q |
|
864 | > hg -R "$TESTTMP/a/nested" tip -q | |
865 | > exit 1 # to avoid adding new revision for subsequent tests |
|
865 | > exit 1 # to avoid adding new revision for subsequent tests | |
866 | > EOF |
|
866 | > EOF | |
867 | $ hg init nested |
|
867 | $ hg init nested | |
868 | $ cd nested |
|
868 | $ cd nested | |
869 | $ echo a > a |
|
869 | $ echo a > a | |
870 | $ hg add a |
|
870 | $ hg add a | |
871 | $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" commit -m '#0' |
|
871 | $ hg --config hooks.pretxnclose="sh $TESTTMP/checkpending.sh" commit -m '#0' | |
872 | @a |
|
872 | @a | |
873 | 4:539e4b31b6dc |
|
873 | 4:539e4b31b6dc | |
874 | @a/nested |
|
874 | @a/nested | |
875 | 0:bf5e395ced2c |
|
875 | 0:bf5e395ced2c | |
876 | transaction abort! |
|
876 | transaction abort! | |
877 | rollback completed |
|
877 | rollback completed | |
878 | abort: pretxnclose hook exited with status 1 |
|
878 | abort: pretxnclose hook exited with status 1 | |
879 | [255] |
|
879 | [255] | |
880 |
|
880 | |||
881 | Hook from untrusted hgrc are reported as failure |
|
881 | Hook from untrusted hgrc are reported as failure | |
882 | ================================================ |
|
882 | ================================================ | |
883 |
|
883 | |||
884 | $ cat << EOF > $TESTTMP/untrusted.py |
|
884 | $ cat << EOF > $TESTTMP/untrusted.py | |
885 | > from mercurial import scmutil, util |
|
885 | > from mercurial import scmutil, util | |
886 | > def uisetup(ui): |
|
886 | > def uisetup(ui): | |
887 | > class untrustedui(ui.__class__): |
|
887 | > class untrustedui(ui.__class__): | |
888 | > def _trusted(self, fp, f): |
|
888 | > def _trusted(self, fp, f): | |
889 | > if util.normpath(fp.name).endswith('untrusted/.hg/hgrc'): |
|
889 | > if util.normpath(fp.name).endswith('untrusted/.hg/hgrc'): | |
890 | > return False |
|
890 | > return False | |
891 | > return super(untrustedui, self)._trusted(fp, f) |
|
891 | > return super(untrustedui, self)._trusted(fp, f) | |
892 | > ui.__class__ = untrustedui |
|
892 | > ui.__class__ = untrustedui | |
893 | > EOF |
|
893 | > EOF | |
894 | $ cat << EOF >> $HGRCPATH |
|
894 | $ cat << EOF >> $HGRCPATH | |
895 | > [extensions] |
|
895 | > [extensions] | |
896 | > untrusted=$TESTTMP/untrusted.py |
|
896 | > untrusted=$TESTTMP/untrusted.py | |
897 | > EOF |
|
897 | > EOF | |
898 | $ hg init untrusted |
|
898 | $ hg init untrusted | |
899 | $ cd untrusted |
|
899 | $ cd untrusted | |
900 |
|
900 | |||
901 | Non-blocking hook |
|
901 | Non-blocking hook | |
902 | ----------------- |
|
902 | ----------------- | |
903 |
|
903 | |||
904 | $ cat << EOF >> .hg/hgrc |
|
904 | $ cat << EOF >> .hg/hgrc | |
905 | > [hooks] |
|
905 | > [hooks] | |
906 | > txnclose.testing=echo txnclose hook called |
|
906 | > txnclose.testing=echo txnclose hook called | |
907 | > EOF |
|
907 | > EOF | |
908 | $ touch a && hg commit -Aqm a |
|
908 | $ touch a && hg commit -Aqm a | |
909 | warning: untrusted hook txnclose.testing not executed |
|
909 | warning: untrusted hook txnclose.testing not executed | |
910 | $ hg log |
|
910 | $ hg log | |
911 | changeset: 0:3903775176ed |
|
911 | changeset: 0:3903775176ed | |
912 | tag: tip |
|
912 | tag: tip | |
913 | user: test |
|
913 | user: test | |
914 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
914 | date: Thu Jan 01 00:00:00 1970 +0000 | |
915 | summary: a |
|
915 | summary: a | |
916 |
|
916 | |||
917 |
|
917 | |||
918 | Non-blocking hook |
|
918 | Non-blocking hook | |
919 | ----------------- |
|
919 | ----------------- | |
920 |
|
920 | |||
921 | $ cat << EOF >> .hg/hgrc |
|
921 | $ cat << EOF >> .hg/hgrc | |
922 | > [hooks] |
|
922 | > [hooks] | |
923 | > pretxnclose.testing=echo pre-txnclose hook called |
|
923 | > pretxnclose.testing=echo pre-txnclose hook called | |
924 | > EOF |
|
924 | > EOF | |
925 | $ touch b && hg commit -Aqm a |
|
925 | $ touch b && hg commit -Aqm a | |
926 | transaction abort! |
|
926 | transaction abort! | |
927 | rollback completed |
|
927 | rollback completed | |
928 | abort: untrusted hook pretxnclose.testing not executed |
|
928 | abort: untrusted hook pretxnclose.testing not executed | |
929 | (see 'hg help config.trusted') |
|
929 | (see 'hg help config.trusted') | |
930 | [255] |
|
930 | [255] | |
931 | $ hg log |
|
931 | $ hg log | |
932 | changeset: 0:3903775176ed |
|
932 | changeset: 0:3903775176ed | |
933 | tag: tip |
|
933 | tag: tip | |
934 | user: test |
|
934 | user: test | |
935 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
935 | date: Thu Jan 01 00:00:00 1970 +0000 | |
936 | summary: a |
|
936 | summary: a | |
937 |
|
937 |
General Comments 0
You need to be logged in to leave comments.
Login now