##// END OF EJS Templates
bundle2: test hooking using the new transaction-level hook...
Pierre-Yves David -
r24285:8e13cc08 default
parent child Browse files
Show More
@@ -1,543 +1,590 b''
1 1 Test exchange of common information using bundle2
2 2
3 3
4 4 $ getmainid() {
5 5 > hg -R main log --template '{node}\n' --rev "$1"
6 6 > }
7 7
8 8 enable obsolescence
9 9
10 10 $ cat > $TESTTMP/bundle2-pushkey-hook.sh << EOF
11 11 > echo pushkey: lock state after \"\$HG_NAMESPACE\"
12 12 > hg debuglock
13 13 > EOF
14 14
15 15 $ cat >> $HGRCPATH << EOF
16 16 > [experimental]
17 17 > evolution=createmarkers,exchange
18 18 > bundle2-exp=True
19 19 > [ui]
20 20 > ssh=python "$TESTDIR/dummyssh"
21 21 > logtemplate={rev}:{node|short} {phase} {author} {bookmarks} {desc|firstline}
22 22 > [web]
23 23 > push_ssl = false
24 24 > allow_push = *
25 25 > [phases]
26 26 > publish=False
27 27 > [hooks]
28 > changegroup = sh -c "HG_LOCAL= python \"$TESTDIR/printenv.py\" changegroup"
29 > b2x-pretransactionclose.tip = hg log -r tip -T "pre-close-tip:{node|short} {phase} {bookmarks}\n"
30 > b2x-transactionclose.tip = hg log -r tip -T "postclose-tip:{node|short} {phase} {bookmarks}\n"
31 > b2x-transactionclose.env = sh -c "HG_LOCAL= python \"$TESTDIR/printenv.py\" b2x-transactionclose"
28 > pretxnclose.tip = hg log -r tip -T "pre-close-tip:{node|short} {phase} {bookmarks}\n"
29 > txnclose.tip = hg log -r tip -T "postclose-tip:{node|short} {phase} {bookmarks}\n"
30 > txnclose.env = sh -c "HG_LOCAL= python \"$TESTDIR/printenv.py\" txnclose"
32 31 > pushkey= sh "$TESTTMP/bundle2-pushkey-hook.sh"
33 32 > EOF
34 33
35 34 The extension requires a repo (currently unused)
36 35
37 36 $ hg init main
38 37 $ cd main
39 38 $ touch a
40 39 $ hg add a
41 40 $ hg commit -m 'a'
41 pre-close-tip:3903775176ed draft
42 postclose-tip:3903775176ed draft
43 txnclose hook: HG_PHASES_MOVED=1 HG_TXNNAME=commit
42 44
43 45 $ hg unbundle $TESTDIR/bundles/rebase.hg
44 46 adding changesets
45 47 adding manifests
46 48 adding file changes
47 49 added 8 changesets with 7 changes to 7 files (+3 heads)
48 changegroup hook: HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_SOURCE=unbundle HG_URL=bundle:*/rebase.hg (glob)
50 pre-close-tip:02de42196ebe draft
51 postclose-tip:02de42196ebe draft
52 txnclose hook: HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_PHASES_MOVED=1 HG_SOURCE=unbundle HG_TXNNAME=unbundle
53 bundle:*/tests/bundles/rebase.hg HG_URL=bundle:*/tests/bundles/rebase.hg (glob)
49 54 (run 'hg heads' to see heads, 'hg merge' to merge)
50 55
51 56 $ cd ..
52 57
53 58 Real world exchange
54 59 =====================
55 60
56 61 Add more obsolescence information
57 62
58 63 $ hg -R main debugobsolete -d '0 0' 1111111111111111111111111111111111111111 `getmainid 9520eea781bc`
64 pre-close-tip:02de42196ebe draft
65 postclose-tip:02de42196ebe draft
66 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNNAME=debugobsolete
59 67 $ hg -R main debugobsolete -d '0 0' 2222222222222222222222222222222222222222 `getmainid 24b6387c8c8c`
68 pre-close-tip:02de42196ebe draft
69 postclose-tip:02de42196ebe draft
70 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNNAME=debugobsolete
60 71
61 72 clone --pull
62 73
63 74 $ hg -R main phase --public cd010b8cd998
75 pre-close-tip:000000000000 public
76 postclose-tip:02de42196ebe draft
77 txnclose hook: HG_PHASES_MOVED=1 HG_TXNNAME=phase
64 78 $ hg clone main other --pull --rev 9520eea781bc
65 79 adding changesets
66 80 adding manifests
67 81 adding file changes
68 82 added 2 changesets with 2 changes to 2 files
69 83 1 new obsolescence markers
70 84 pre-close-tip:9520eea781bc draft
71 85 postclose-tip:9520eea781bc draft
72 b2x-transactionclose hook: HG_NEW_OBSMARKERS=1 HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
73 changegroup hook: HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
86 txnclose hook: HG_NEW_OBSMARKERS=1 HG_NODE=cd010b8cd998f3981a5a8115f94f8da4ab506089 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNNAME=pull
87 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
74 88 updating to branch default
75 89 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
76 90 $ hg -R other log -G
77 91 @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
78 92 |
79 93 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
80 94
81 95 $ hg -R other debugobsolete
82 96 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
83 97
84 98 pull
85 99
86 100 $ hg -R main phase --public 9520eea781bc
101 pre-close-tip:000000000000 public
102 postclose-tip:02de42196ebe draft
103 txnclose hook: HG_PHASES_MOVED=1 HG_TXNNAME=phase
87 104 $ hg -R other pull -r 24b6387c8c8c
88 105 pulling from $TESTTMP/main (glob)
89 106 searching for changes
90 107 adding changesets
91 108 adding manifests
92 109 adding file changes
93 110 added 1 changesets with 1 changes to 1 files (+1 heads)
94 111 1 new obsolescence markers
95 112 pre-close-tip:24b6387c8c8c draft
96 113 postclose-tip:24b6387c8c8c draft
97 b2x-transactionclose hook: HG_NEW_OBSMARKERS=1 HG_NODE=24b6387c8c8cae37178880f3fa95ded3cb1cf785 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
98 changegroup hook: HG_NODE=24b6387c8c8cae37178880f3fa95ded3cb1cf785 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
114 txnclose hook: HG_NEW_OBSMARKERS=1 HG_NODE=24b6387c8c8cae37178880f3fa95ded3cb1cf785 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNNAME=pull
115 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
99 116 (run 'hg heads' to see heads, 'hg merge' to merge)
100 117 $ hg -R other log -G
101 118 o 2:24b6387c8c8c draft Nicolas Dumazet <nicdumz.commits@gmail.com> F
102 119 |
103 120 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
104 121 |/
105 122 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
106 123
107 124 $ hg -R other debugobsolete
108 125 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
109 126 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
110 127
111 128 pull empty (with phase movement)
112 129
113 130 $ hg -R main phase --public 24b6387c8c8c
131 pre-close-tip:000000000000 public
132 postclose-tip:02de42196ebe draft
133 txnclose hook: HG_PHASES_MOVED=1 HG_TXNNAME=phase
114 134 $ hg -R other pull -r 24b6387c8c8c
115 135 pulling from $TESTTMP/main (glob)
116 136 no changes found
117 137 pre-close-tip:000000000000 public
118 138 postclose-tip:24b6387c8c8c public
119 b2x-transactionclose hook: HG_NEW_OBSMARKERS=0 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
139 txnclose hook: HG_NEW_OBSMARKERS=0 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNNAME=pull
140 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
120 141 $ hg -R other log -G
121 142 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
122 143 |
123 144 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
124 145 |/
125 146 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
126 147
127 148 $ hg -R other debugobsolete
128 149 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
129 150 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
130 151
131 152 pull empty
132 153
133 154 $ hg -R other pull -r 24b6387c8c8c
134 155 pulling from $TESTTMP/main (glob)
135 156 no changes found
136 157 pre-close-tip:24b6387c8c8c public
137 158 postclose-tip:24b6387c8c8c public
138 b2x-transactionclose hook: HG_NEW_OBSMARKERS=0 HG_SOURCE=pull HG_URL=file:$TESTTMP/main
159 txnclose hook: HG_NEW_OBSMARKERS=0 HG_SOURCE=pull HG_TXNNAME=pull
160 file:/*/$TESTTMP/main HG_URL=file:$TESTTMP/main (glob)
139 161 $ hg -R other log -G
140 162 o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
141 163 |
142 164 | @ 1:9520eea781bc draft Nicolas Dumazet <nicdumz.commits@gmail.com> E
143 165 |/
144 166 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
145 167
146 168 $ hg -R other debugobsolete
147 169 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
148 170 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
149 171
150 172 add extra data to test their exchange during push
151 173
152 174 $ hg -R main bookmark --rev eea13746799a book_eea1
153 175 $ hg -R main debugobsolete -d '0 0' 3333333333333333333333333333333333333333 `getmainid eea13746799a`
176 pre-close-tip:02de42196ebe draft
177 postclose-tip:02de42196ebe draft
178 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNNAME=debugobsolete
154 179 $ hg -R main bookmark --rev 02de42196ebe book_02de
155 180 $ hg -R main debugobsolete -d '0 0' 4444444444444444444444444444444444444444 `getmainid 02de42196ebe`
181 pre-close-tip:02de42196ebe draft book_02de
182 postclose-tip:02de42196ebe draft book_02de
183 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNNAME=debugobsolete
156 184 $ hg -R main bookmark --rev 42ccdea3bb16 book_42cc
157 185 $ hg -R main debugobsolete -d '0 0' 5555555555555555555555555555555555555555 `getmainid 42ccdea3bb16`
186 pre-close-tip:02de42196ebe draft book_02de
187 postclose-tip:02de42196ebe draft book_02de
188 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNNAME=debugobsolete
158 189 $ hg -R main bookmark --rev 5fddd98957c8 book_5fdd
159 190 $ hg -R main debugobsolete -d '0 0' 6666666666666666666666666666666666666666 `getmainid 5fddd98957c8`
191 pre-close-tip:02de42196ebe draft book_02de
192 postclose-tip:02de42196ebe draft book_02de
193 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNNAME=debugobsolete
160 194 $ hg -R main bookmark --rev 32af7686d403 book_32af
161 195 $ hg -R main debugobsolete -d '0 0' 7777777777777777777777777777777777777777 `getmainid 32af7686d403`
196 pre-close-tip:02de42196ebe draft book_02de
197 postclose-tip:02de42196ebe draft book_02de
198 txnclose hook: HG_NEW_OBSMARKERS=1 HG_TXNNAME=debugobsolete
162 199
163 200 $ hg -R other bookmark --rev cd010b8cd998 book_eea1
164 201 $ hg -R other bookmark --rev cd010b8cd998 book_02de
165 202 $ hg -R other bookmark --rev cd010b8cd998 book_42cc
166 203 $ hg -R other bookmark --rev cd010b8cd998 book_5fdd
167 204 $ hg -R other bookmark --rev cd010b8cd998 book_32af
168 205
169 206 $ hg -R main phase --public eea13746799a
207 pre-close-tip:000000000000 public
208 postclose-tip:02de42196ebe draft book_02de
209 txnclose hook: HG_PHASES_MOVED=1 HG_TXNNAME=phase
170 210
171 211 push
172 212 $ hg -R main push other --rev eea13746799a --bookmark book_eea1
173 213 pushing to other
174 214 searching for changes
175 215 pre-close-tip:eea13746799a public book_eea1
176 216 pushkey: lock state after "phases"
177 217 lock: free
178 218 wlock: free
179 219 pushkey: lock state after "bookmarks"
180 220 lock: free
181 221 wlock: free
182 222 postclose-tip:eea13746799a public book_eea1
183 b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_URL=push
184 changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_SOURCE=push HG_URL=push
223 txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_TXNNAME=unbundle HG_URL=push
185 224 remote: adding changesets
186 225 remote: adding manifests
187 226 remote: adding file changes
188 227 remote: added 1 changesets with 0 changes to 0 files (-1 heads)
189 228 remote: 1 new obsolescence markers
190 229 updating bookmark book_eea1
191 230 pre-close-tip:02de42196ebe draft book_02de
192 231 postclose-tip:02de42196ebe draft book_02de
193 b2x-transactionclose hook: HG_SOURCE=push-response HG_URL=file:$TESTTMP/other
232 txnclose hook: HG_SOURCE=push-response HG_TXNNAME=push-response
233 file:/*/$TESTTMP/other HG_URL=file:$TESTTMP/other (glob)
194 234 $ hg -R other log -G
195 235 o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
196 236 |\
197 237 | o 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
198 238 | |
199 239 @ | 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
200 240 |/
201 241 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de book_32af book_42cc book_5fdd A
202 242
203 243 $ hg -R other debugobsolete
204 244 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
205 245 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
206 246 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
207 247
208 248 pull over ssh
209 249
210 250 $ hg -R other pull ssh://user@dummy/main -r 02de42196ebe --bookmark book_02de
211 251 pulling from ssh://user@dummy/main
212 252 searching for changes
213 253 adding changesets
214 254 adding manifests
215 255 adding file changes
216 256 added 1 changesets with 1 changes to 1 files (+1 heads)
217 257 1 new obsolescence markers
218 258 updating bookmark book_02de
219 259 pre-close-tip:02de42196ebe draft book_02de
220 260 postclose-tip:02de42196ebe draft book_02de
221 b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_NODE=02de42196ebee42ef284b6780a87cdc96e8eaab6 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=ssh://user@dummy/main
222 changegroup hook: HG_NODE=02de42196ebee42ef284b6780a87cdc96e8eaab6 HG_SOURCE=pull HG_URL=ssh://user@dummy/main
261 txnclose hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_NODE=02de42196ebee42ef284b6780a87cdc96e8eaab6 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNNAME=pull
262 ssh://user@dummy/main HG_URL=ssh://user@dummy/main
223 263 (run 'hg heads' to see heads, 'hg merge' to merge)
224 264 $ hg -R other debugobsolete
225 265 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
226 266 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
227 267 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
228 268 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
229 269
230 270 pull over http
231 271
232 272 $ hg -R main serve -p $HGPORT -d --pid-file=main.pid -E main-error.log
233 273 $ cat main.pid >> $DAEMON_PIDS
234 274
235 275 $ hg -R other pull http://localhost:$HGPORT/ -r 42ccdea3bb16 --bookmark book_42cc
236 276 pulling from http://localhost:$HGPORT/
237 277 searching for changes
238 278 adding changesets
239 279 adding manifests
240 280 adding file changes
241 281 added 1 changesets with 1 changes to 1 files (+1 heads)
242 282 1 new obsolescence markers
243 283 updating bookmark book_42cc
244 284 pre-close-tip:42ccdea3bb16 draft book_42cc
245 285 postclose-tip:42ccdea3bb16 draft book_42cc
246 b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_NODE=42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/
247 changegroup hook: HG_NODE=42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 HG_SOURCE=pull HG_URL=http://localhost:$HGPORT/
286 txnclose hook: HG_BOOKMARK_MOVED=1 HG_NEW_OBSMARKERS=1 HG_NODE=42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 HG_PHASES_MOVED=1 HG_SOURCE=pull HG_TXNNAME=pull
287 http://localhost:$HGPORT/ HG_URL=http://localhost:$HGPORT/
248 288 (run 'hg heads .' to see heads, 'hg merge' to merge)
249 289 $ cat main-error.log
250 290 $ hg -R other debugobsolete
251 291 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
252 292 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
253 293 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
254 294 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
255 295 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
256 296
257 297 push over ssh
258 298
259 299 $ hg -R main push ssh://user@dummy/other -r 5fddd98957c8 --bookmark book_5fdd
260 300 pushing to ssh://user@dummy/other
261 301 searching for changes
262 302 remote: adding changesets
263 303 remote: adding manifests
264 304 remote: adding file changes
265 305 remote: added 1 changesets with 1 changes to 1 files
266 306 remote: 1 new obsolescence markers
267 307 updating bookmark book_5fdd
268 308 remote: pre-close-tip:5fddd98957c8 draft book_5fdd
269 309 remote: pushkey: lock state after "bookmarks"
270 310 remote: lock: free
271 311 remote: wlock: free
272 312 remote: postclose-tip:5fddd98957c8 draft book_5fdd
273 remote: b2x-transactionclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
274 remote: changegroup hook: HG_BUNDLE2-EXP=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_URL=remote:ssh:127.0.0.1
313 remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2-EXP=1 HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_TXNNAME=unbundle HG_URL=remote:ssh:127.0.0.1
275 314 pre-close-tip:02de42196ebe draft book_02de
276 315 postclose-tip:02de42196ebe draft book_02de
277 b2x-transactionclose hook: HG_SOURCE=push-response HG_URL=ssh://user@dummy/other
316 txnclose hook: HG_SOURCE=push-response HG_TXNNAME=push-response
317 ssh://user@dummy/other HG_URL=ssh://user@dummy/other
278 318 $ hg -R other log -G
279 319 o 6:5fddd98957c8 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
280 320 |
281 321 o 5:42ccdea3bb16 draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B
282 322 |
283 323 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H
284 324 | |
285 325 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
286 326 | |/|
287 327 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
288 328 |/ /
289 329 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
290 330 |/
291 331 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af A
292 332
293 333 $ hg -R other debugobsolete
294 334 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
295 335 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
296 336 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
297 337 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
298 338 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
299 339 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
300 340
301 341 push over http
302 342
303 343 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
304 344 $ cat other.pid >> $DAEMON_PIDS
305 345
306 346 $ hg -R main phase --public 32af7686d403
347 pre-close-tip:000000000000 public
348 postclose-tip:02de42196ebe draft book_02de
349 txnclose hook: HG_PHASES_MOVED=1 HG_TXNNAME=phase
307 350 $ hg -R main push http://localhost:$HGPORT2/ -r 32af7686d403 --bookmark book_32af
308 351 pushing to http://localhost:$HGPORT2/
309 352 searching for changes
310 353 remote: adding changesets
311 354 remote: adding manifests
312 355 remote: adding file changes
313 356 remote: added 1 changesets with 1 changes to 1 files
314 357 remote: 1 new obsolescence markers
315 358 updating bookmark book_32af
316 359 pre-close-tip:02de42196ebe draft book_02de
317 360 postclose-tip:02de42196ebe draft book_02de
318 b2x-transactionclose hook: HG_SOURCE=push-response HG_URL=http://localhost:$HGPORT2/
361 txnclose hook: HG_SOURCE=push-response HG_TXNNAME=push-response
362 http://localhost:$HGPORT2/ HG_URL=http://localhost:$HGPORT2/
319 363 $ cat other-error.log
320 364
321 365 Check final content.
322 366
323 367 $ hg -R other log -G
324 368 o 7:32af7686d403 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_32af D
325 369 |
326 370 o 6:5fddd98957c8 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_5fdd C
327 371 |
328 372 o 5:42ccdea3bb16 public Nicolas Dumazet <nicdumz.commits@gmail.com> book_42cc B
329 373 |
330 374 | o 4:02de42196ebe draft Nicolas Dumazet <nicdumz.commits@gmail.com> book_02de H
331 375 | |
332 376 | | o 3:eea13746799a public Nicolas Dumazet <nicdumz.commits@gmail.com> book_eea1 G
333 377 | |/|
334 378 | o | 2:24b6387c8c8c public Nicolas Dumazet <nicdumz.commits@gmail.com> F
335 379 |/ /
336 380 | @ 1:9520eea781bc public Nicolas Dumazet <nicdumz.commits@gmail.com> E
337 381 |/
338 382 o 0:cd010b8cd998 public Nicolas Dumazet <nicdumz.commits@gmail.com> A
339 383
340 384 $ hg -R other debugobsolete
341 385 1111111111111111111111111111111111111111 9520eea781bcca16c1e15acc0ba14335a0e8e5ba 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
342 386 2222222222222222222222222222222222222222 24b6387c8c8cae37178880f3fa95ded3cb1cf785 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
343 387 3333333333333333333333333333333333333333 eea13746799a9e0bfd88f29d3c2e9dc9389f524f 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
344 388 4444444444444444444444444444444444444444 02de42196ebee42ef284b6780a87cdc96e8eaab6 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
345 389 5555555555555555555555555555555555555555 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
346 390 6666666666666666666666666666666666666666 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
347 391 7777777777777777777777777777777777777777 32af7686d403cf45b5d95f2d70cebea587ac806a 0 (Thu Jan 01 00:00:00 1970 +0000) {'user': 'test'}
348 392
349 393 (check that no 'pending' files remain)
350 394
351 395 $ ls -1 other/.hg/bookmarks*
352 396 other/.hg/bookmarks
353 397 $ ls -1 other/.hg/store/phaseroots*
354 398 other/.hg/store/phaseroots
355 399 $ ls -1 other/.hg/store/00changelog.i*
356 400 other/.hg/store/00changelog.i
357 401
358 402 Error Handling
359 403 ==============
360 404
361 405 Check that errors are properly returned to the client during push.
362 406
363 407 Setting up
364 408
365 409 $ cat > failpush.py << EOF
366 410 > """A small extension that makes push fails when using bundle2
367 411 >
368 412 > used to test error handling in bundle2
369 413 > """
370 414 >
371 415 > from mercurial import util
372 416 > from mercurial import bundle2
373 417 > from mercurial import exchange
374 418 > from mercurial import extensions
375 419 >
376 420 > def _pushbundle2failpart(pushop, bundler):
377 421 > reason = pushop.ui.config('failpush', 'reason', None)
378 422 > part = None
379 423 > if reason == 'abort':
380 424 > bundler.newpart('test:abort')
381 425 > if reason == 'unknown':
382 426 > bundler.newpart('test:unknown')
383 427 > if reason == 'race':
384 428 > # 20 Bytes of crap
385 429 > bundler.newpart('b2x:check:heads', data='01234567890123456789')
386 430 >
387 431 > @bundle2.parthandler("test:abort")
388 432 > def handleabort(op, part):
389 433 > raise util.Abort('Abandon ship!', hint="don't panic")
390 434 >
391 435 > def uisetup(ui):
392 436 > exchange.b2partsgenmapping['failpart'] = _pushbundle2failpart
393 437 > exchange.b2partsgenorder.insert(0, 'failpart')
394 438 >
395 439 > EOF
396 440
397 441 $ cd main
398 442 $ hg up tip
399 443 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
400 444 $ echo 'I' > I
401 445 $ hg add I
402 446 $ hg ci -m 'I'
447 pre-close-tip:e7ec4e813ba6 draft
448 postclose-tip:e7ec4e813ba6 draft
449 txnclose hook: HG_TXNNAME=commit
403 450 $ hg id
404 451 e7ec4e813ba6 tip
405 452 $ cd ..
406 453
407 454 $ cat << EOF >> $HGRCPATH
408 455 > [extensions]
409 456 > failpush=$TESTTMP/failpush.py
410 457 > EOF
411 458
412 459 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
413 460 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
414 461 $ cat other.pid >> $DAEMON_PIDS
415 462
416 463 Doing the actual push: Abort error
417 464
418 465 $ cat << EOF >> $HGRCPATH
419 466 > [failpush]
420 467 > reason = abort
421 468 > EOF
422 469
423 470 $ hg -R main push other -r e7ec4e813ba6
424 471 pushing to other
425 472 searching for changes
426 473 abort: Abandon ship!
427 474 (don't panic)
428 475 [255]
429 476
430 477 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
431 478 pushing to ssh://user@dummy/other
432 479 searching for changes
433 480 abort: Abandon ship!
434 481 (don't panic)
435 482 [255]
436 483
437 484 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
438 485 pushing to http://localhost:$HGPORT2/
439 486 searching for changes
440 487 abort: Abandon ship!
441 488 (don't panic)
442 489 [255]
443 490
444 491
445 492 Doing the actual push: unknown mandatory parts
446 493
447 494 $ cat << EOF >> $HGRCPATH
448 495 > [failpush]
449 496 > reason = unknown
450 497 > EOF
451 498
452 499 $ hg -R main push other -r e7ec4e813ba6
453 500 pushing to other
454 501 searching for changes
455 502 abort: missing support for test:unknown
456 503 [255]
457 504
458 505 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
459 506 pushing to ssh://user@dummy/other
460 507 searching for changes
461 508 abort: missing support for test:unknown
462 509 [255]
463 510
464 511 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
465 512 pushing to http://localhost:$HGPORT2/
466 513 searching for changes
467 514 abort: missing support for test:unknown
468 515 [255]
469 516
470 517 Doing the actual push: race
471 518
472 519 $ cat << EOF >> $HGRCPATH
473 520 > [failpush]
474 521 > reason = race
475 522 > EOF
476 523
477 524 $ hg -R main push other -r e7ec4e813ba6
478 525 pushing to other
479 526 searching for changes
480 527 abort: push failed:
481 528 'repository changed while pushing - please try again'
482 529 [255]
483 530
484 531 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
485 532 pushing to ssh://user@dummy/other
486 533 searching for changes
487 534 abort: push failed:
488 535 'repository changed while pushing - please try again'
489 536 [255]
490 537
491 538 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
492 539 pushing to http://localhost:$HGPORT2/
493 540 searching for changes
494 541 abort: push failed:
495 542 'repository changed while pushing - please try again'
496 543 [255]
497 544
498 545 Doing the actual push: hook abort
499 546
500 547 $ cat << EOF >> $HGRCPATH
501 548 > [failpush]
502 549 > reason =
503 550 > [hooks]
504 > b2x-pretransactionclose.failpush = false
551 > pretxnclose.failpush = false
505 552 > EOF
506 553
507 554 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
508 555 $ hg -R other serve -p $HGPORT2 -d --pid-file=other.pid -E other-error.log
509 556 $ cat other.pid >> $DAEMON_PIDS
510 557
511 558 $ hg -R main push other -r e7ec4e813ba6
512 559 pushing to other
513 560 searching for changes
514 561 pre-close-tip:e7ec4e813ba6 draft
515 562 transaction abort!
516 563 rollback completed
517 abort: b2x-pretransactionclose.failpush hook exited with status 1
564 abort: pretxnclose.failpush hook exited with status 1
518 565 [255]
519 566
520 567 $ hg -R main push ssh://user@dummy/other -r e7ec4e813ba6
521 568 pushing to ssh://user@dummy/other
522 569 searching for changes
523 abort: b2x-pretransactionclose.failpush hook exited with status 1
570 abort: pretxnclose.failpush hook exited with status 1
524 571 remote: pre-close-tip:e7ec4e813ba6 draft
525 572 remote: transaction abort!
526 573 remote: rollback completed
527 574 [255]
528 575
529 576 $ hg -R main push http://localhost:$HGPORT2/ -r e7ec4e813ba6
530 577 pushing to http://localhost:$HGPORT2/
531 578 searching for changes
532 abort: b2x-pretransactionclose.failpush hook exited with status 1
579 abort: pretxnclose.failpush hook exited with status 1
533 580 [255]
534 581
535 582 (check that no 'pending' files remain)
536 583
537 584 $ ls -1 other/.hg/bookmarks*
538 585 other/.hg/bookmarks
539 586 $ ls -1 other/.hg/store/phaseroots*
540 587 other/.hg/store/phaseroots
541 588 $ ls -1 other/.hg/store/00changelog.i*
542 589 other/.hg/store/00changelog.i
543 590
General Comments 0
You need to be logged in to leave comments. Login now