Show More
@@ -1,205 +1,206 | |||
|
1 | 1 | # common patterns in test at can safely be replaced |
|
2 | 2 | |
|
3 | 3 | import os |
|
4 | 4 | |
|
5 | 5 | substitutions = [ |
|
6 | 6 | # list of possible compressions |
|
7 | 7 | (br'(zstd,)?zlib,none,bzip2', br'$USUAL_COMPRESSIONS$'), |
|
8 | 8 | (br'=(zstd,)?zlib', br'=$BUNDLE2_COMPRESSIONS$'), |
|
9 | 9 | # capabilities sent through http |
|
10 | 10 | ( |
|
11 | 11 | br'bundlecaps=HG20%2Cbundle2%3DHG20%250A' |
|
12 | 12 | br'bookmarks%250A' |
|
13 | 13 | br'changegroup%253D01%252C02%250A' |
|
14 | 14 | br'checkheads%253Drelated%250A' |
|
15 | 15 | br'digests%253Dmd5%252Csha1%252Csha512%250A' |
|
16 | 16 | br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A' |
|
17 | 17 | br'hgtagsfnodes%250A' |
|
18 | 18 | br'listkeys%250A' |
|
19 | 19 | br'phases%253Dheads%250A' |
|
20 | 20 | br'pushkey%250A' |
|
21 | 21 | br'remote-changegroup%253Dhttp%252Chttps%250A' |
|
22 | 22 | br'stream%253Dv2', |
|
23 | 23 | # (the replacement patterns) |
|
24 | 24 | br'$USUAL_BUNDLE_CAPS$', |
|
25 | 25 | ), |
|
26 | 26 | ( |
|
27 | 27 | br'bundlecaps=HG20%2Cbundle2%3DHG20%250A' |
|
28 | 28 | br'bookmarks%250A' |
|
29 | 29 | br'changegroup%253D01%252C02%250A' |
|
30 | 30 | br'checkheads%3Drelated%0A' |
|
31 | 31 | br'digests%253Dmd5%252Csha1%252Csha512%250A' |
|
32 | 32 | br'error%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250A' |
|
33 | 33 | br'hgtagsfnodes%250A' |
|
34 | 34 | br'listkeys%250A' |
|
35 | 35 | br'phases%253Dheads%250A' |
|
36 | 36 | br'pushkey%250A' |
|
37 | 37 | br'remote-changegroup%253Dhttp%252Chttps', |
|
38 | 38 | # (the replacement patterns) |
|
39 | 39 | br'$USUAL_BUNDLE_CAPS_SERVER$', |
|
40 | 40 | ), |
|
41 | 41 | # bundle2 capabilities sent through ssh |
|
42 | 42 | ( |
|
43 | 43 | br'bundle2=HG20%0A' |
|
44 | 44 | br'bookmarks%0A' |
|
45 | 45 | br'changegroup%3D01%2C02%0A' |
|
46 | 46 | br'checkheads%3Drelated%0A' |
|
47 | 47 | br'digests%3Dmd5%2Csha1%2Csha512%0A' |
|
48 | 48 | br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A' |
|
49 | 49 | br'hgtagsfnodes%0A' |
|
50 | 50 | br'listkeys%0A' |
|
51 | 51 | br'phases%3Dheads%0A' |
|
52 | 52 | br'pushkey%0A' |
|
53 | 53 | br'remote-changegroup%3Dhttp%2Chttps%0A' |
|
54 | 54 | br'stream%3Dv2', |
|
55 | 55 | # (replacement patterns) |
|
56 | 56 | br'$USUAL_BUNDLE2_CAPS$', |
|
57 | 57 | ), |
|
58 | 58 | # bundle2 capabilities advertised by the server |
|
59 | 59 | ( |
|
60 | 60 | br'bundle2=HG20%0A' |
|
61 | 61 | br'bookmarks%0A' |
|
62 | 62 | br'changegroup%3D01%2C02%0A' |
|
63 | 63 | br'checkheads%3Drelated%0A' |
|
64 | 64 | br'digests%3Dmd5%2Csha1%2Csha512%0A' |
|
65 | 65 | br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A' |
|
66 | 66 | br'hgtagsfnodes%0A' |
|
67 | 67 | br'listkeys%0A' |
|
68 | 68 | br'phases%3Dheads%0A' |
|
69 | 69 | br'pushkey%0A' |
|
70 | 70 | br'remote-changegroup%3Dhttp%2Chttps', |
|
71 | 71 | # (replacement patterns) |
|
72 | 72 | br'$USUAL_BUNDLE2_CAPS_SERVER$', |
|
73 | 73 | ), |
|
74 | 74 | ( |
|
75 | 75 | br'bundle2=HG20%0A' |
|
76 | 76 | br'bookmarks%0A' |
|
77 | 77 | br'changegroup%3D01%2C02%0A' |
|
78 | 78 | br'digests%3Dmd5%2Csha1%2Csha512%0A' |
|
79 | 79 | br'error%3Dabort%2Cunsupportedcontent%2Cpushraced%2Cpushkey%0A' |
|
80 | 80 | br'hgtagsfnodes%0A' |
|
81 | 81 | br'listkeys%0A' |
|
82 | 82 | br'pushkey%0A' |
|
83 | 83 | br'remote-changegroup%3Dhttp%2Chttps%0A' |
|
84 | 84 | br'stream%3Dv2', |
|
85 | 85 | # (replacement patterns) |
|
86 | 86 | br'$USUAL_BUNDLE2_CAPS_NO_PHASES$', |
|
87 | 87 | ), |
|
88 | 88 | # HTTP access log dates |
|
89 | 89 | ( |
|
90 | 90 | br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] "(GET|PUT|POST)', |
|
91 | 91 | lambda m: br' - - [$LOGDATE$] "' + m.group(1), |
|
92 | 92 | ), |
|
93 | 93 | # HTTP error log dates |
|
94 | 94 | ( |
|
95 | 95 | br' - - \[\d\d/.../2\d\d\d \d\d:\d\d:\d\d] (HG error:|Exception)', |
|
96 | 96 | lambda m: br' - - [$ERRDATE$] ' + m.group(1), |
|
97 | 97 | ), |
|
98 | 98 | # HTTP header dates- RFC 1123 |
|
99 | 99 | ( |
|
100 | 100 | br'([Dd]ate): [A-Za-z]{3}, \d\d [A-Za-z]{3} \d{4} \d\d:\d\d:\d\d GMT', |
|
101 | 101 | lambda m: br'%s: $HTTP_DATE$' % m.group(1), |
|
102 | 102 | ), |
|
103 | 103 | # LFS expiration value |
|
104 | 104 | ( |
|
105 | 105 | br'"expires_at": "\d{4}-\d\d-\d\dT\d\d:\d\d:\d\dZ"', |
|
106 | 106 | br'"expires_at": "$ISO_8601_DATE_TIME$"', |
|
107 | 107 | ), |
|
108 | 108 | # Windows has an extra '/' in the following lines that get globbed away: |
|
109 | 109 | # pushing to file:/*/$TESTTMP/r2 (glob) |
|
110 | 110 | # comparing with file:/*/$TESTTMP/r2 (glob) |
|
111 | 111 | # sub/maybelarge.dat: largefile 34..9c not available from |
|
112 | 112 | # file:/*/$TESTTMP/largefiles-repo (glob) |
|
113 | 113 | ( |
|
114 | 114 | br'(.*file:/)/?(/\$TESTTMP.*)', |
|
115 | 115 | lambda m: m.group(1) + b'*' + m.group(2) + b' (glob)', |
|
116 | 116 | ), |
|
117 | 117 | # `hg clone --stream` output |
|
118 | 118 | ( |
|
119 | 119 | br'transferred (\S+?) KB in \S+? seconds \(.+?/sec\)(?: \(glob\))?(.*)', |
|
120 | 120 | lambda m: ( |
|
121 | 121 | br'transferred %s KB in * seconds (* */sec) (glob)%s' |
|
122 | 122 | % (m.group(1), m.group(2)) |
|
123 | 123 | ), |
|
124 | 124 | ), |
|
125 | 125 | ] |
|
126 | 126 | |
|
127 | 127 | # Various platform error strings, keyed on a common replacement string |
|
128 | 128 | _errors = { |
|
129 | 129 | br'$ENOENT$': ( |
|
130 | 130 | # IOError in Python does not have the same error message |
|
131 | 131 | # than in Rust, and automatic conversion is not possible |
|
132 | 132 | # because of module member privacy. |
|
133 | 133 | br'No such file or directory \(os error 2\)', |
|
134 | 134 | # strerror() |
|
135 | 135 | br'No such file or directory', |
|
136 | 136 | # FormatMessage(ERROR_FILE_NOT_FOUND) |
|
137 | 137 | br'The system cannot find the file specified', |
|
138 | 138 | ), |
|
139 | 139 | br'$ENOTDIR$': ( |
|
140 | 140 | # strerror() |
|
141 | 141 | br'Not a directory', |
|
142 | 142 | # FormatMessage(ERROR_PATH_NOT_FOUND) |
|
143 | 143 | br'The system cannot find the path specified', |
|
144 | 144 | ), |
|
145 | 145 | br'$ECONNRESET$': ( |
|
146 | 146 | # strerror() |
|
147 | 147 | br'Connection reset by peer', |
|
148 | 148 | # FormatMessage(WSAECONNRESET) |
|
149 | 149 | br'An existing connection was forcibly closed by the remote host', |
|
150 | 150 | ), |
|
151 | 151 | br'$EADDRINUSE$': ( |
|
152 | 152 | # strerror() |
|
153 | 153 | br'Address already in use', |
|
154 | 154 | # FormatMessage(WSAEADDRINUSE) |
|
155 | 155 | br'Only one usage of each socket address' |
|
156 | 156 | br' \(protocol/network address/port\) is normally permitted', |
|
157 | 157 | ), |
|
158 | 158 | br'$EADDRNOTAVAIL$': ( |
|
159 | 159 | # strerror() |
|
160 | 160 | br'Cannot assign requested address', |
|
161 | br'Can\'t assign requested address', | |
|
161 | 162 | # FormatMessage(WSAEADDRNOTAVAIL) |
|
162 | 163 | ), |
|
163 | 164 | } |
|
164 | 165 | |
|
165 | 166 | for replace, msgs in _errors.items(): |
|
166 | 167 | substitutions.extend((m, replace) for m in msgs) |
|
167 | 168 | |
|
168 | 169 | # Output lines on Windows that can be autocorrected for '\' vs '/' path |
|
169 | 170 | # differences. |
|
170 | 171 | _winpathfixes = [ |
|
171 | 172 | # cloning subrepo s\ss from $TESTTMP/t/s/ss |
|
172 | 173 | # cloning subrepo foo\bar from http://localhost:$HGPORT/foo/bar |
|
173 | 174 | br'(?m)^cloning subrepo \S+\\.*', |
|
174 | 175 | # pulling from $TESTTMP\issue1852a |
|
175 | 176 | br'(?m)^pulling from \$TESTTMP\\.*', |
|
176 | 177 | # pushing to $TESTTMP\a |
|
177 | 178 | br'(?m)^pushing to \$TESTTMP\\.*', |
|
178 | 179 | # pushing subrepo s\ss to $TESTTMP/t/s/ss |
|
179 | 180 | br'(?m)^pushing subrepo \S+\\\S+ to.*', |
|
180 | 181 | # moving d1\d11\a1 to d3/d11/a1 |
|
181 | 182 | br'(?m)^moving \S+\\.*', |
|
182 | 183 | # d1\a: not recording move - dummy does not exist |
|
183 | 184 | br'\S+\\\S+: not recording move .+', |
|
184 | 185 | # reverting s\a |
|
185 | 186 | br'(?m)^reverting (?!subrepo ).*\\.*', |
|
186 | 187 | # saved backup bundle to |
|
187 | 188 | # $TESTTMP\test\.hg\strip-backup/443431ffac4f-2fc5398a-backup.hg |
|
188 | 189 | br'(?m)^saved backup bundle to \$TESTTMP.*\.hg', |
|
189 | 190 | # no changes made to subrepo s\ss since last push to ../tcc/s/ss |
|
190 | 191 | br'(?m)^no changes made to subrepo \S+\\\S+ since.*', |
|
191 | 192 | # changeset 5:9cc5aa7204f0: stuff/maybelarge.dat references missing |
|
192 | 193 | # $TESTTMP\largefiles-repo-hg\.hg\largefiles\76..38 |
|
193 | 194 | br'(?m)^changeset .* references (corrupted|missing) \$TESTTMP\\.*', |
|
194 | 195 | # stuff/maybelarge.dat: largefile 76..38 not available from |
|
195 | 196 | # file:/*/$TESTTMP\largefiles-repo (glob) |
|
196 | 197 | br'.*: largefile \S+ not available from file:/\*/.+', |
|
197 | 198 | ] |
|
198 | 199 | |
|
199 | 200 | if os.name == 'nt': |
|
200 | 201 | substitutions.extend( |
|
201 | 202 | [ |
|
202 | 203 | (s, lambda match: match.group().replace(b'\\', b'/')) |
|
203 | 204 | for s in _winpathfixes |
|
204 | 205 | ] |
|
205 | 206 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now