##// END OF EJS Templates
py3: use bytes.endswith() instead of bytes[n]
Yuya Nishihara -
r38611:21be76e0 default
parent child Browse files
Show More
@@ -1,530 +1,531
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-alias.t
5 test-amend-subrepo.t
6 test-amend-subrepo.t
6 test-amend.t
7 test-amend.t
7 test-ancestor.py
8 test-ancestor.py
8 test-annotate.py
9 test-annotate.py
9 test-annotate.t
10 test-annotate.t
10 test-archive-symlinks.t
11 test-archive-symlinks.t
11 test-atomictempfile.py
12 test-atomictempfile.py
12 test-audit-path.t
13 test-audit-path.t
13 test-audit-subrepo.t
14 test-audit-subrepo.t
14 test-automv.t
15 test-automv.t
15 test-backout.t
16 test-backout.t
16 test-backwards-remove.t
17 test-backwards-remove.t
17 test-basic.t
18 test-basic.t
18 test-bheads.t
19 test-bheads.t
19 test-bisect.t
20 test-bisect.t
20 test-bisect2.t
21 test-bisect2.t
21 test-bisect3.t
22 test-bisect3.t
22 test-blackbox.t
23 test-blackbox.t
23 test-bookmarks-current.t
24 test-bookmarks-current.t
24 test-bookmarks-merge.t
25 test-bookmarks-merge.t
25 test-bookmarks-rebase.t
26 test-bookmarks-rebase.t
26 test-bookmarks-strip.t
27 test-bookmarks-strip.t
27 test-bookmarks.t
28 test-bookmarks.t
28 test-branch-change.t
29 test-branch-change.t
29 test-branch-option.t
30 test-branch-option.t
30 test-branch-tag-confict.t
31 test-branch-tag-confict.t
31 test-branches.t
32 test-branches.t
32 test-bundle-phases.t
33 test-bundle-phases.t
33 test-bundle-type.t
34 test-bundle-type.t
34 test-bundle-vs-outgoing.t
35 test-bundle-vs-outgoing.t
35 test-bundle2-multiple-changegroups.t
36 test-bundle2-multiple-changegroups.t
36 test-bundle2-pushback.t
37 test-bundle2-pushback.t
37 test-cappedreader.py
38 test-cappedreader.py
38 test-casecollision.t
39 test-casecollision.t
39 test-cat.t
40 test-cat.t
40 test-cbor.py
41 test-cbor.py
41 test-censor.t
42 test-censor.t
42 test-changelog-exec.t
43 test-changelog-exec.t
43 test-check-commit.t
44 test-check-commit.t
44 test-check-execute.t
45 test-check-execute.t
45 test-check-interfaces.py
46 test-check-interfaces.py
46 test-check-module-imports.t
47 test-check-module-imports.t
47 test-check-pyflakes.t
48 test-check-pyflakes.t
48 test-check-pylint.t
49 test-check-pylint.t
49 test-check-shbang.t
50 test-check-shbang.t
50 test-children.t
51 test-children.t
51 test-clone-cgi.t
52 test-clone-cgi.t
52 test-clone-pull-corruption.t
53 test-clone-pull-corruption.t
53 test-clone-r.t
54 test-clone-r.t
54 test-clone-update-order.t
55 test-clone-update-order.t
55 test-commit-amend.t
56 test-commit-amend.t
56 test-commit-interactive.t
57 test-commit-interactive.t
57 test-commit-multiple.t
58 test-commit-multiple.t
58 test-commit-unresolved.t
59 test-commit-unresolved.t
59 test-commit.t
60 test-commit.t
60 test-committer.t
61 test-committer.t
61 test-completion.t
62 test-completion.t
62 test-config-env.py
63 test-config-env.py
63 test-config.t
64 test-config.t
64 test-conflict.t
65 test-conflict.t
65 test-confused-revert.t
66 test-confused-revert.t
66 test-context.py
67 test-context.py
67 test-contrib-check-code.t
68 test-contrib-check-code.t
68 test-contrib-check-commit.t
69 test-contrib-check-commit.t
69 test-convert-authormap.t
70 test-convert-authormap.t
70 test-convert-clonebranches.t
71 test-convert-clonebranches.t
71 test-convert-cvs-branch.t
72 test-convert-cvs-branch.t
72 test-convert-cvs-detectmerge.t
73 test-convert-cvs-detectmerge.t
73 test-convert-cvs-synthetic.t
74 test-convert-cvs-synthetic.t
74 test-convert-cvs.t
75 test-convert-cvs.t
75 test-convert-cvsnt-mergepoints.t
76 test-convert-cvsnt-mergepoints.t
76 test-convert-datesort.t
77 test-convert-datesort.t
77 test-convert-filemap.t
78 test-convert-filemap.t
78 test-convert-hg-sink.t
79 test-convert-hg-sink.t
79 test-convert-hg-source.t
80 test-convert-hg-source.t
80 test-convert-hg-startrev.t
81 test-convert-hg-startrev.t
81 test-convert-splicemap.t
82 test-convert-splicemap.t
82 test-convert-tagsbranch-topology.t
83 test-convert-tagsbranch-topology.t
83 test-copy-move-merge.t
84 test-copy-move-merge.t
84 test-copy.t
85 test-copy.t
85 test-copytrace-heuristics.t
86 test-copytrace-heuristics.t
86 test-debugbuilddag.t
87 test-debugbuilddag.t
87 test-debugbundle.t
88 test-debugbundle.t
88 test-debugextensions.t
89 test-debugextensions.t
89 test-debugindexdot.t
90 test-debugindexdot.t
90 test-debugrename.t
91 test-debugrename.t
91 test-default-push.t
92 test-default-push.t
92 test-diff-antipatience.t
93 test-diff-antipatience.t
93 test-diff-binary-file.t
94 test-diff-binary-file.t
94 test-diff-change.t
95 test-diff-change.t
95 test-diff-copy-depth.t
96 test-diff-copy-depth.t
96 test-diff-hashes.t
97 test-diff-hashes.t
97 test-diff-ignore-whitespace.t
98 test-diff-ignore-whitespace.t
98 test-diff-indent-heuristic.t
99 test-diff-indent-heuristic.t
99 test-diff-issue2761.t
100 test-diff-issue2761.t
100 test-diff-newlines.t
101 test-diff-newlines.t
101 test-diff-reverse.t
102 test-diff-reverse.t
102 test-diff-subdir.t
103 test-diff-subdir.t
103 test-diff-unified.t
104 test-diff-unified.t
104 test-diff-upgrade.t
105 test-diff-upgrade.t
105 test-diffdir.t
106 test-diffdir.t
106 test-diffstat.t
107 test-diffstat.t
107 test-directaccess.t
108 test-directaccess.t
108 test-dirstate-backup.t
109 test-dirstate-backup.t
109 test-dirstate-nonnormalset.t
110 test-dirstate-nonnormalset.t
110 test-dirstate.t
111 test-dirstate.t
111 test-dispatch.py
112 test-dispatch.py
112 test-doctest.py
113 test-doctest.py
113 test-double-merge.t
114 test-double-merge.t
114 test-drawdag.t
115 test-drawdag.t
115 test-duplicateoptions.py
116 test-duplicateoptions.py
116 test-editor-filename.t
117 test-editor-filename.t
117 test-empty-dir.t
118 test-empty-dir.t
118 test-empty-file.t
119 test-empty-file.t
119 test-empty-group.t
120 test-empty-group.t
120 test-empty.t
121 test-empty.t
121 test-encode.t
122 test-encode.t
122 test-encoding-func.py
123 test-encoding-func.py
123 test-encoding.t
124 test-encoding.t
124 test-eol-add.t
125 test-eol-add.t
125 test-eol-clone.t
126 test-eol-clone.t
126 test-eol-hook.t
127 test-eol-hook.t
127 test-eol-patch.t
128 test-eol-patch.t
128 test-eol-tag.t
129 test-eol-tag.t
129 test-eol-update.t
130 test-eol-update.t
130 test-eol.t
131 test-eol.t
131 test-eolfilename.t
132 test-eolfilename.t
132 test-excessive-merge.t
133 test-excessive-merge.t
133 test-exchange-obsmarkers-case-A1.t
134 test-exchange-obsmarkers-case-A1.t
134 test-exchange-obsmarkers-case-A2.t
135 test-exchange-obsmarkers-case-A2.t
135 test-exchange-obsmarkers-case-A3.t
136 test-exchange-obsmarkers-case-A3.t
136 test-exchange-obsmarkers-case-A4.t
137 test-exchange-obsmarkers-case-A4.t
137 test-exchange-obsmarkers-case-A5.t
138 test-exchange-obsmarkers-case-A5.t
138 test-exchange-obsmarkers-case-A6.t
139 test-exchange-obsmarkers-case-A6.t
139 test-exchange-obsmarkers-case-A7.t
140 test-exchange-obsmarkers-case-A7.t
140 test-exchange-obsmarkers-case-B1.t
141 test-exchange-obsmarkers-case-B1.t
141 test-exchange-obsmarkers-case-B2.t
142 test-exchange-obsmarkers-case-B2.t
142 test-exchange-obsmarkers-case-B3.t
143 test-exchange-obsmarkers-case-B3.t
143 test-exchange-obsmarkers-case-B4.t
144 test-exchange-obsmarkers-case-B4.t
144 test-exchange-obsmarkers-case-B5.t
145 test-exchange-obsmarkers-case-B5.t
145 test-exchange-obsmarkers-case-B6.t
146 test-exchange-obsmarkers-case-B6.t
146 test-exchange-obsmarkers-case-B7.t
147 test-exchange-obsmarkers-case-B7.t
147 test-exchange-obsmarkers-case-C1.t
148 test-exchange-obsmarkers-case-C1.t
148 test-exchange-obsmarkers-case-C2.t
149 test-exchange-obsmarkers-case-C2.t
149 test-exchange-obsmarkers-case-C3.t
150 test-exchange-obsmarkers-case-C3.t
150 test-exchange-obsmarkers-case-C4.t
151 test-exchange-obsmarkers-case-C4.t
151 test-exchange-obsmarkers-case-D1.t
152 test-exchange-obsmarkers-case-D1.t
152 test-exchange-obsmarkers-case-D2.t
153 test-exchange-obsmarkers-case-D2.t
153 test-exchange-obsmarkers-case-D3.t
154 test-exchange-obsmarkers-case-D3.t
154 test-exchange-obsmarkers-case-D4.t
155 test-exchange-obsmarkers-case-D4.t
155 test-execute-bit.t
156 test-execute-bit.t
156 test-export.t
157 test-export.t
157 test-extdata.t
158 test-extdata.t
158 test-extdiff.t
159 test-extdiff.t
159 test-extensions-afterloaded.t
160 test-extensions-afterloaded.t
160 test-extensions-wrapfunction.py
161 test-extensions-wrapfunction.py
161 test-extra-filelog-entry.t
162 test-extra-filelog-entry.t
162 test-fetch.t
163 test-fetch.t
163 test-filebranch.t
164 test-filebranch.t
164 test-filecache.py
165 test-filecache.py
165 test-filelog.py
166 test-filelog.py
166 test-fileset-generated.t
167 test-fileset-generated.t
167 test-fileset.t
168 test-fileset.t
168 test-fix-topology.t
169 test-fix-topology.t
169 test-flags.t
170 test-flags.t
170 test-generaldelta.t
171 test-generaldelta.t
171 test-getbundle.t
172 test-getbundle.t
172 test-git-export.t
173 test-git-export.t
173 test-glog-topological.t
174 test-glog-topological.t
174 test-gpg.t
175 test-gpg.t
175 test-graft.t
176 test-graft.t
176 test-hg-parseurl.py
177 test-hg-parseurl.py
177 test-hghave.t
178 test-hghave.t
178 test-hgignore.t
179 test-hgignore.t
179 test-hgk.t
180 test-hgk.t
180 test-hgrc.t
181 test-hgrc.t
181 test-hgweb-bundle.t
182 test-hgweb-bundle.t
182 test-hgweb-descend-empties.t
183 test-hgweb-descend-empties.t
183 test-hgweb-empty.t
184 test-hgweb-empty.t
184 test-hgweb-removed.t
185 test-hgweb-removed.t
185 test-hgwebdir-paths.py
186 test-hgwebdir-paths.py
186 test-hgwebdirsym.t
187 test-hgwebdirsym.t
187 test-histedit-arguments.t
188 test-histedit-arguments.t
188 test-histedit-base.t
189 test-histedit-base.t
189 test-histedit-bookmark-motion.t
190 test-histedit-bookmark-motion.t
190 test-histedit-commute.t
191 test-histedit-commute.t
191 test-histedit-drop.t
192 test-histedit-drop.t
192 test-histedit-edit.t
193 test-histedit-edit.t
193 test-histedit-fold-non-commute.t
194 test-histedit-fold-non-commute.t
194 test-histedit-fold.t
195 test-histedit-fold.t
195 test-histedit-no-change.t
196 test-histedit-no-change.t
196 test-histedit-non-commute-abort.t
197 test-histedit-non-commute-abort.t
197 test-histedit-non-commute.t
198 test-histedit-non-commute.t
198 test-histedit-obsolete.t
199 test-histedit-obsolete.t
199 test-histedit-outgoing.t
200 test-histedit-outgoing.t
200 test-histedit-templates.t
201 test-histedit-templates.t
201 test-http-branchmap.t
202 test-http-branchmap.t
202 test-http-bundle1.t
203 test-http-bundle1.t
203 test-http-clone-r.t
204 test-http-clone-r.t
204 test-http.t
205 test-http.t
205 test-hybridencode.py
206 test-hybridencode.py
206 test-identify.t
207 test-identify.t
207 test-impexp-branch.t
208 test-impexp-branch.t
208 test-import-bypass.t
209 test-import-bypass.t
209 test-import-eol.t
210 test-import-eol.t
210 test-import-merge.t
211 test-import-merge.t
211 test-import-unknown.t
212 test-import-unknown.t
212 test-import.t
213 test-import.t
213 test-imports-checker.t
214 test-imports-checker.t
214 test-incoming-outgoing.t
215 test-incoming-outgoing.t
215 test-inherit-mode.t
216 test-inherit-mode.t
216 test-init.t
217 test-init.t
217 test-issue1089.t
218 test-issue1089.t
218 test-issue1102.t
219 test-issue1102.t
219 test-issue1175.t
220 test-issue1175.t
220 test-issue1306.t
221 test-issue1306.t
221 test-issue1438.t
222 test-issue1438.t
222 test-issue1502.t
223 test-issue1502.t
223 test-issue1802.t
224 test-issue1802.t
224 test-issue1877.t
225 test-issue1877.t
225 test-issue1993.t
226 test-issue1993.t
226 test-issue2137.t
227 test-issue2137.t
227 test-issue3084.t
228 test-issue3084.t
228 test-issue4074.t
229 test-issue4074.t
229 test-issue522.t
230 test-issue522.t
230 test-issue586.t
231 test-issue586.t
231 test-issue612.t
232 test-issue612.t
232 test-issue619.t
233 test-issue619.t
233 test-issue660.t
234 test-issue660.t
234 test-issue672.t
235 test-issue672.t
235 test-issue842.t
236 test-issue842.t
236 test-journal-exists.t
237 test-journal-exists.t
237 test-journal-share.t
238 test-journal-share.t
238 test-journal.t
239 test-journal.t
239 test-known.t
240 test-known.t
240 test-largefiles-cache.t
241 test-largefiles-cache.t
241 test-largefiles-misc.t
242 test-largefiles-misc.t
242 test-largefiles-small-disk.t
243 test-largefiles-small-disk.t
243 test-largefiles-update.t
244 test-largefiles-update.t
244 test-largefiles.t
245 test-largefiles.t
245 test-lfs-largefiles.t
246 test-lfs-largefiles.t
246 test-lfs-pointer.py
247 test-lfs-pointer.py
247 test-linerange.py
248 test-linerange.py
248 test-locate.t
249 test-locate.t
249 test-lock-badness.t
250 test-lock-badness.t
250 test-log-linerange.t
251 test-log-linerange.t
251 test-log.t
252 test-log.t
252 test-logexchange.t
253 test-logexchange.t
253 test-lrucachedict.py
254 test-lrucachedict.py
254 test-mactext.t
255 test-mactext.t
255 test-mailmap.t
256 test-mailmap.t
256 test-manifest-merging.t
257 test-manifest-merging.t
257 test-manifest.py
258 test-manifest.py
258 test-manifest.t
259 test-manifest.t
259 test-match.py
260 test-match.py
260 test-mdiff.py
261 test-mdiff.py
261 test-merge-changedelete.t
262 test-merge-changedelete.t
262 test-merge-closedheads.t
263 test-merge-closedheads.t
263 test-merge-commit.t
264 test-merge-commit.t
264 test-merge-criss-cross.t
265 test-merge-criss-cross.t
265 test-merge-default.t
266 test-merge-default.t
266 test-merge-force.t
267 test-merge-force.t
267 test-merge-halt.t
268 test-merge-halt.t
268 test-merge-internal-tools-pattern.t
269 test-merge-internal-tools-pattern.t
269 test-merge-local.t
270 test-merge-local.t
270 test-merge-remove.t
271 test-merge-remove.t
271 test-merge-revert.t
272 test-merge-revert.t
272 test-merge-revert2.t
273 test-merge-revert2.t
273 test-merge-subrepos.t
274 test-merge-subrepos.t
274 test-merge-symlinks.t
275 test-merge-symlinks.t
275 test-merge-tools.t
276 test-merge-tools.t
276 test-merge-types.t
277 test-merge-types.t
277 test-merge1.t
278 test-merge1.t
278 test-merge10.t
279 test-merge10.t
279 test-merge2.t
280 test-merge2.t
280 test-merge4.t
281 test-merge4.t
281 test-merge5.t
282 test-merge5.t
282 test-merge6.t
283 test-merge6.t
283 test-merge7.t
284 test-merge7.t
284 test-merge8.t
285 test-merge8.t
285 test-merge9.t
286 test-merge9.t
286 test-minifileset.py
287 test-minifileset.py
287 test-minirst.py
288 test-minirst.py
288 test-mq-git.t
289 test-mq-git.t
289 test-mq-header-date.t
290 test-mq-header-date.t
290 test-mq-header-from.t
291 test-mq-header-from.t
291 test-mq-merge.t
292 test-mq-merge.t
292 test-mq-pull-from-bundle.t
293 test-mq-pull-from-bundle.t
293 test-mq-qclone-http.t
294 test-mq-qclone-http.t
294 test-mq-qdelete.t
295 test-mq-qdelete.t
295 test-mq-qdiff.t
296 test-mq-qdiff.t
296 test-mq-qfold.t
297 test-mq-qfold.t
297 test-mq-qgoto.t
298 test-mq-qgoto.t
298 test-mq-qimport-fail-cleanup.t
299 test-mq-qimport-fail-cleanup.t
299 test-mq-qnew.t
300 test-mq-qnew.t
300 test-mq-qpush-exact.t
301 test-mq-qpush-exact.t
301 test-mq-qqueue.t
302 test-mq-qqueue.t
302 test-mq-qrefresh-interactive.t
303 test-mq-qrefresh-interactive.t
303 test-mq-qrefresh-replace-log-message.t
304 test-mq-qrefresh-replace-log-message.t
304 test-mq-qrefresh.t
305 test-mq-qrefresh.t
305 test-mq-qrename.t
306 test-mq-qrename.t
306 test-mq-qsave.t
307 test-mq-qsave.t
307 test-mq-safety.t
308 test-mq-safety.t
308 test-mq-subrepo.t
309 test-mq-subrepo.t
309 test-mq-symlinks.t
310 test-mq-symlinks.t
310 test-mv-cp-st-diff.t
311 test-mv-cp-st-diff.t
311 test-narrow-archive.t
312 test-narrow-archive.t
312 test-narrow-clone-no-ellipsis.t
313 test-narrow-clone-no-ellipsis.t
313 test-narrow-clone-non-narrow-server.t
314 test-narrow-clone-non-narrow-server.t
314 test-narrow-clone-nonlinear.t
315 test-narrow-clone-nonlinear.t
315 test-narrow-clone.t
316 test-narrow-clone.t
316 test-narrow-commit.t
317 test-narrow-commit.t
317 test-narrow-copies.t
318 test-narrow-copies.t
318 test-narrow-debugcommands.t
319 test-narrow-debugcommands.t
319 test-narrow-debugrebuilddirstate.t
320 test-narrow-debugrebuilddirstate.t
320 test-narrow-exchange-merges.t
321 test-narrow-exchange-merges.t
321 test-narrow-exchange.t
322 test-narrow-exchange.t
322 test-narrow-expanddirstate.t
323 test-narrow-expanddirstate.t
323 test-narrow-merge.t
324 test-narrow-merge.t
324 test-narrow-patch.t
325 test-narrow-patch.t
325 test-narrow-patterns.t
326 test-narrow-patterns.t
326 test-narrow-pull.t
327 test-narrow-pull.t
327 test-narrow-rebase.t
328 test-narrow-rebase.t
328 test-narrow-shallow-merges.t
329 test-narrow-shallow-merges.t
329 test-narrow-shallow.t
330 test-narrow-shallow.t
330 test-narrow-strip.t
331 test-narrow-strip.t
331 test-narrow-update.t
332 test-narrow-update.t
332 test-narrow-widen.t
333 test-narrow-widen.t
333 test-narrow.t
334 test-narrow.t
334 test-nested-repo.t
335 test-nested-repo.t
335 test-newbranch.t
336 test-newbranch.t
336 test-obshistory.t
337 test-obshistory.t
337 test-obsmarker-template.t
338 test-obsmarker-template.t
338 test-obsmarkers-effectflag.t
339 test-obsmarkers-effectflag.t
339 test-obsolete-bundle-strip.t
340 test-obsolete-bundle-strip.t
340 test-obsolete-changeset-exchange.t
341 test-obsolete-changeset-exchange.t
341 test-obsolete-checkheads.t
342 test-obsolete-checkheads.t
342 test-obsolete-distributed.t
343 test-obsolete-distributed.t
343 test-obsolete-divergent.t
344 test-obsolete-divergent.t
344 test-obsolete-tag-cache.t
345 test-obsolete-tag-cache.t
345 test-pager.t
346 test-pager.t
346 test-parents.t
347 test-parents.t
347 test-parseindex2.py
348 test-parseindex2.py
348 test-patch-offset.t
349 test-patch-offset.t
349 test-patch.t
350 test-patch.t
350 test-pathconflicts-merge.t
351 test-pathconflicts-merge.t
351 test-pathconflicts-update.t
352 test-pathconflicts-update.t
352 test-pathencode.py
353 test-pathencode.py
353 test-pending.t
354 test-pending.t
354 test-permissions.t
355 test-permissions.t
355 test-phases.t
356 test-phases.t
356 test-pull-branch.t
357 test-pull-branch.t
357 test-pull-http.t
358 test-pull-http.t
358 test-pull-permission.t
359 test-pull-permission.t
359 test-pull-pull-corruption.t
360 test-pull-pull-corruption.t
360 test-pull-r.t
361 test-pull-r.t
361 test-pull-update.t
362 test-pull-update.t
362 test-pull.t
363 test-pull.t
363 test-purge.t
364 test-purge.t
364 test-push-checkheads-partial-C1.t
365 test-push-checkheads-partial-C1.t
365 test-push-checkheads-partial-C2.t
366 test-push-checkheads-partial-C2.t
366 test-push-checkheads-partial-C3.t
367 test-push-checkheads-partial-C3.t
367 test-push-checkheads-partial-C4.t
368 test-push-checkheads-partial-C4.t
368 test-push-checkheads-pruned-B1.t
369 test-push-checkheads-pruned-B1.t
369 test-push-checkheads-pruned-B2.t
370 test-push-checkheads-pruned-B2.t
370 test-push-checkheads-pruned-B3.t
371 test-push-checkheads-pruned-B3.t
371 test-push-checkheads-pruned-B4.t
372 test-push-checkheads-pruned-B4.t
372 test-push-checkheads-pruned-B5.t
373 test-push-checkheads-pruned-B5.t
373 test-push-checkheads-pruned-B6.t
374 test-push-checkheads-pruned-B6.t
374 test-push-checkheads-pruned-B7.t
375 test-push-checkheads-pruned-B7.t
375 test-push-checkheads-pruned-B8.t
376 test-push-checkheads-pruned-B8.t
376 test-push-checkheads-superceed-A1.t
377 test-push-checkheads-superceed-A1.t
377 test-push-checkheads-superceed-A2.t
378 test-push-checkheads-superceed-A2.t
378 test-push-checkheads-superceed-A3.t
379 test-push-checkheads-superceed-A3.t
379 test-push-checkheads-superceed-A4.t
380 test-push-checkheads-superceed-A4.t
380 test-push-checkheads-superceed-A5.t
381 test-push-checkheads-superceed-A5.t
381 test-push-checkheads-superceed-A6.t
382 test-push-checkheads-superceed-A6.t
382 test-push-checkheads-superceed-A7.t
383 test-push-checkheads-superceed-A7.t
383 test-push-checkheads-superceed-A8.t
384 test-push-checkheads-superceed-A8.t
384 test-push-checkheads-unpushed-D1.t
385 test-push-checkheads-unpushed-D1.t
385 test-push-checkheads-unpushed-D2.t
386 test-push-checkheads-unpushed-D2.t
386 test-push-checkheads-unpushed-D3.t
387 test-push-checkheads-unpushed-D3.t
387 test-push-checkheads-unpushed-D4.t
388 test-push-checkheads-unpushed-D4.t
388 test-push-checkheads-unpushed-D5.t
389 test-push-checkheads-unpushed-D5.t
389 test-push-checkheads-unpushed-D6.t
390 test-push-checkheads-unpushed-D6.t
390 test-push-checkheads-unpushed-D7.t
391 test-push-checkheads-unpushed-D7.t
391 test-push-http.t
392 test-push-http.t
392 test-push-warn.t
393 test-push-warn.t
393 test-push.t
394 test-push.t
394 test-pushvars.t
395 test-pushvars.t
395 test-qrecord.t
396 test-qrecord.t
396 test-rebase-abort.t
397 test-rebase-abort.t
397 test-rebase-base-flag.t
398 test-rebase-base-flag.t
398 test-rebase-bookmarks.t
399 test-rebase-bookmarks.t
399 test-rebase-brute-force.t
400 test-rebase-brute-force.t
400 test-rebase-cache.t
401 test-rebase-cache.t
401 test-rebase-check-restore.t
402 test-rebase-check-restore.t
402 test-rebase-collapse.t
403 test-rebase-collapse.t
403 test-rebase-conflicts.t
404 test-rebase-conflicts.t
404 test-rebase-dest.t
405 test-rebase-dest.t
405 test-rebase-detach.t
406 test-rebase-detach.t
406 test-rebase-emptycommit.t
407 test-rebase-emptycommit.t
407 test-rebase-inmemory.t
408 test-rebase-inmemory.t
408 test-rebase-interruptions.t
409 test-rebase-interruptions.t
409 test-rebase-issue-noparam-single-rev.t
410 test-rebase-issue-noparam-single-rev.t
410 test-rebase-legacy.t
411 test-rebase-legacy.t
411 test-rebase-mq-skip.t
412 test-rebase-mq-skip.t
412 test-rebase-mq.t
413 test-rebase-mq.t
413 test-rebase-named-branches.t
414 test-rebase-named-branches.t
414 test-rebase-newancestor.t
415 test-rebase-newancestor.t
415 test-rebase-obsolete.t
416 test-rebase-obsolete.t
416 test-rebase-parameters.t
417 test-rebase-parameters.t
417 test-rebase-partial.t
418 test-rebase-partial.t
418 test-rebase-pull.t
419 test-rebase-pull.t
419 test-rebase-rename.t
420 test-rebase-rename.t
420 test-rebase-scenario-global.t
421 test-rebase-scenario-global.t
421 test-rebase-templates.t
422 test-rebase-templates.t
422 test-rebase-transaction.t
423 test-rebase-transaction.t
423 test-rebuildstate.t
424 test-rebuildstate.t
424 test-record.t
425 test-record.t
425 test-relink.t
426 test-relink.t
426 test-remove.t
427 test-remove.t
427 test-rename-after-merge.t
428 test-rename-after-merge.t
428 test-rename-dir-merge.t
429 test-rename-dir-merge.t
429 test-rename-merge1.t
430 test-rename-merge1.t
430 test-rename.t
431 test-rename.t
431 test-repair-strip.t
432 test-repair-strip.t
432 test-repo-compengines.t
433 test-repo-compengines.t
433 test-resolve.t
434 test-resolve.t
434 test-revert-flags.t
435 test-revert-flags.t
435 test-revert-interactive.t
436 test-revert-interactive.t
436 test-revert-unknown.t
437 test-revert-unknown.t
437 test-revlog-ancestry.py
438 test-revlog-ancestry.py
438 test-revlog-group-emptyiter.t
439 test-revlog-group-emptyiter.t
439 test-revlog-mmapindex.t
440 test-revlog-mmapindex.t
440 test-revlog-packentry.t
441 test-revlog-packentry.t
441 test-revlog-raw.py
442 test-revlog-raw.py
442 test-revlog-v2.t
443 test-revlog-v2.t
443 test-revset-dirstate-parents.t
444 test-revset-dirstate-parents.t
444 test-revset-legacy-lookup.t
445 test-revset-legacy-lookup.t
445 test-revset-outgoing.t
446 test-revset-outgoing.t
446 test-rollback.t
447 test-rollback.t
447 test-run-tests.py
448 test-run-tests.py
448 test-run-tests.t
449 test-run-tests.t
449 test-schemes.t
450 test-schemes.t
450 test-serve.t
451 test-serve.t
451 test-setdiscovery.t
452 test-setdiscovery.t
452 test-share.t
453 test-share.t
453 test-shelve.t
454 test-shelve.t
454 test-show-stack.t
455 test-show-stack.t
455 test-show-work.t
456 test-show-work.t
456 test-show.t
457 test-show.t
457 test-simple-update.t
458 test-simple-update.t
458 test-simplekeyvaluefile.py
459 test-simplekeyvaluefile.py
459 test-simplemerge.py
460 test-simplemerge.py
460 test-single-head.t
461 test-single-head.t
461 test-sparse-clear.t
462 test-sparse-clear.t
462 test-sparse-clone.t
463 test-sparse-clone.t
463 test-sparse-import.t
464 test-sparse-import.t
464 test-sparse-merges.t
465 test-sparse-merges.t
465 test-sparse-profiles.t
466 test-sparse-profiles.t
466 test-sparse-requirement.t
467 test-sparse-requirement.t
467 test-sparse-verbose-json.t
468 test-sparse-verbose-json.t
468 test-sparse.t
469 test-sparse.t
469 test-split.t
470 test-split.t
470 test-ssh-bundle1.t
471 test-ssh-bundle1.t
471 test-ssh-clone-r.t
472 test-ssh-clone-r.t
472 test-ssh-proto-unbundle.t
473 test-ssh-proto-unbundle.t
473 test-ssh-proto.t
474 test-ssh-proto.t
474 test-ssh.t
475 test-ssh.t
475 test-sshserver.py
476 test-sshserver.py
476 test-stack.t
477 test-stack.t
477 test-status-inprocess.py
478 test-status-inprocess.py
478 test-status-rev.t
479 test-status-rev.t
479 test-status-terse.t
480 test-status-terse.t
480 test-strict.t
481 test-strict.t
481 test-strip-cross.t
482 test-strip-cross.t
482 test-strip.t
483 test-strip.t
483 test-subrepo-deep-nested-change.t
484 test-subrepo-deep-nested-change.t
484 test-subrepo-missing.t
485 test-subrepo-missing.t
485 test-subrepo-paths.t
486 test-subrepo-paths.t
486 test-subrepo-recursion.t
487 test-subrepo-recursion.t
487 test-subrepo-relative-path.t
488 test-subrepo-relative-path.t
488 test-subrepo.t
489 test-subrepo.t
489 test-symlink-os-yes-fs-no.py
490 test-symlink-os-yes-fs-no.py
490 test-symlink-placeholder.t
491 test-symlink-placeholder.t
491 test-symlinks.t
492 test-symlinks.t
492 test-tag.t
493 test-tag.t
493 test-tags.t
494 test-tags.t
494 test-template-basic.t
495 test-template-basic.t
495 test-template-functions.t
496 test-template-functions.t
496 test-template-keywords.t
497 test-template-keywords.t
497 test-template-map.t
498 test-template-map.t
498 test-transplant.t
499 test-transplant.t
499 test-treemanifest.t
500 test-treemanifest.t
500 test-ui-color.py
501 test-ui-color.py
501 test-ui-config.py
502 test-ui-config.py
502 test-ui-verbosity.py
503 test-ui-verbosity.py
503 test-unamend.t
504 test-unamend.t
504 test-unbundlehash.t
505 test-unbundlehash.t
505 test-uncommit.t
506 test-uncommit.t
506 test-unified-test.t
507 test-unified-test.t
507 test-unionrepo.t
508 test-unionrepo.t
508 test-unrelated-pull.t
509 test-unrelated-pull.t
509 test-up-local-change.t
510 test-up-local-change.t
510 test-update-branches.t
511 test-update-branches.t
511 test-update-dest.t
512 test-update-dest.t
512 test-update-issue1456.t
513 test-update-issue1456.t
513 test-update-names.t
514 test-update-names.t
514 test-update-reverse.t
515 test-update-reverse.t
515 test-upgrade-repo.t
516 test-upgrade-repo.t
516 test-url-download.t
517 test-url-download.t
517 test-url-rev.t
518 test-url-rev.t
518 test-url.py
519 test-url.py
519 test-username-newline.t
520 test-username-newline.t
520 test-verify.t
521 test-verify.t
521 test-walk.t
522 test-walk.t
522 test-walkrepo.py
523 test-walkrepo.py
523 test-websub.t
524 test-websub.t
524 test-win32text.t
525 test-win32text.t
525 test-wireproto-clientreactor.py
526 test-wireproto-clientreactor.py
526 test-wireproto-framing.py
527 test-wireproto-framing.py
527 test-wireproto-serverreactor.py
528 test-wireproto-serverreactor.py
528 test-wireproto.py
529 test-wireproto.py
529 test-wsgirequest.py
530 test-wsgirequest.py
530 test-xdg.t
531 test-xdg.t
@@ -1,264 +1,264
1 from __future__ import absolute_import
1 from __future__ import absolute_import
2
2
3 import errno
3 import errno
4 import os
4 import os
5 import posixpath
5 import posixpath
6 import stat
6 import stat
7
7
8 from .i18n import _
8 from .i18n import _
9 from . import (
9 from . import (
10 encoding,
10 encoding,
11 error,
11 error,
12 pycompat,
12 pycompat,
13 util,
13 util,
14 )
14 )
15
15
16 def _lowerclean(s):
16 def _lowerclean(s):
17 return encoding.hfsignoreclean(s.lower())
17 return encoding.hfsignoreclean(s.lower())
18
18
19 class pathauditor(object):
19 class pathauditor(object):
20 '''ensure that a filesystem path contains no banned components.
20 '''ensure that a filesystem path contains no banned components.
21 the following properties of a path are checked:
21 the following properties of a path are checked:
22
22
23 - ends with a directory separator
23 - ends with a directory separator
24 - under top-level .hg
24 - under top-level .hg
25 - starts at the root of a windows drive
25 - starts at the root of a windows drive
26 - contains ".."
26 - contains ".."
27
27
28 More check are also done about the file system states:
28 More check are also done about the file system states:
29 - traverses a symlink (e.g. a/symlink_here/b)
29 - traverses a symlink (e.g. a/symlink_here/b)
30 - inside a nested repository (a callback can be used to approve
30 - inside a nested repository (a callback can be used to approve
31 some nested repositories, e.g., subrepositories)
31 some nested repositories, e.g., subrepositories)
32
32
33 The file system checks are only done when 'realfs' is set to True (the
33 The file system checks are only done when 'realfs' is set to True (the
34 default). They should be disable then we are auditing path for operation on
34 default). They should be disable then we are auditing path for operation on
35 stored history.
35 stored history.
36
36
37 If 'cached' is set to True, audited paths and sub-directories are cached.
37 If 'cached' is set to True, audited paths and sub-directories are cached.
38 Be careful to not keep the cache of unmanaged directories for long because
38 Be careful to not keep the cache of unmanaged directories for long because
39 audited paths may be replaced with symlinks.
39 audited paths may be replaced with symlinks.
40 '''
40 '''
41
41
42 def __init__(self, root, callback=None, realfs=True, cached=False):
42 def __init__(self, root, callback=None, realfs=True, cached=False):
43 self.audited = set()
43 self.audited = set()
44 self.auditeddir = set()
44 self.auditeddir = set()
45 self.root = root
45 self.root = root
46 self._realfs = realfs
46 self._realfs = realfs
47 self._cached = cached
47 self._cached = cached
48 self.callback = callback
48 self.callback = callback
49 if os.path.lexists(root) and not util.fscasesensitive(root):
49 if os.path.lexists(root) and not util.fscasesensitive(root):
50 self.normcase = util.normcase
50 self.normcase = util.normcase
51 else:
51 else:
52 self.normcase = lambda x: x
52 self.normcase = lambda x: x
53
53
54 def __call__(self, path, mode=None):
54 def __call__(self, path, mode=None):
55 '''Check the relative path.
55 '''Check the relative path.
56 path may contain a pattern (e.g. foodir/**.txt)'''
56 path may contain a pattern (e.g. foodir/**.txt)'''
57
57
58 path = util.localpath(path)
58 path = util.localpath(path)
59 normpath = self.normcase(path)
59 normpath = self.normcase(path)
60 if normpath in self.audited:
60 if normpath in self.audited:
61 return
61 return
62 # AIX ignores "/" at end of path, others raise EISDIR.
62 # AIX ignores "/" at end of path, others raise EISDIR.
63 if util.endswithsep(path):
63 if util.endswithsep(path):
64 raise error.Abort(_("path ends in directory separator: %s") % path)
64 raise error.Abort(_("path ends in directory separator: %s") % path)
65 parts = util.splitpath(path)
65 parts = util.splitpath(path)
66 if (os.path.splitdrive(path)[0]
66 if (os.path.splitdrive(path)[0]
67 or _lowerclean(parts[0]) in ('.hg', '.hg.', '')
67 or _lowerclean(parts[0]) in ('.hg', '.hg.', '')
68 or pycompat.ospardir in parts):
68 or pycompat.ospardir in parts):
69 raise error.Abort(_("path contains illegal component: %s") % path)
69 raise error.Abort(_("path contains illegal component: %s") % path)
70 # Windows shortname aliases
70 # Windows shortname aliases
71 for p in parts:
71 for p in parts:
72 if "~" in p:
72 if "~" in p:
73 first, last = p.split("~", 1)
73 first, last = p.split("~", 1)
74 if last.isdigit() and first.upper() in ["HG", "HG8B6C"]:
74 if last.isdigit() and first.upper() in ["HG", "HG8B6C"]:
75 raise error.Abort(_("path contains illegal component: %s")
75 raise error.Abort(_("path contains illegal component: %s")
76 % path)
76 % path)
77 if '.hg' in _lowerclean(path):
77 if '.hg' in _lowerclean(path):
78 lparts = [_lowerclean(p.lower()) for p in parts]
78 lparts = [_lowerclean(p.lower()) for p in parts]
79 for p in '.hg', '.hg.':
79 for p in '.hg', '.hg.':
80 if p in lparts[1:]:
80 if p in lparts[1:]:
81 pos = lparts.index(p)
81 pos = lparts.index(p)
82 base = os.path.join(*parts[:pos])
82 base = os.path.join(*parts[:pos])
83 raise error.Abort(_("path '%s' is inside nested repo %r")
83 raise error.Abort(_("path '%s' is inside nested repo %r")
84 % (path, pycompat.bytestr(base)))
84 % (path, pycompat.bytestr(base)))
85
85
86 normparts = util.splitpath(normpath)
86 normparts = util.splitpath(normpath)
87 assert len(parts) == len(normparts)
87 assert len(parts) == len(normparts)
88
88
89 parts.pop()
89 parts.pop()
90 normparts.pop()
90 normparts.pop()
91 prefixes = []
91 prefixes = []
92 # It's important that we check the path parts starting from the root.
92 # It's important that we check the path parts starting from the root.
93 # This means we won't accidentally traverse a symlink into some other
93 # This means we won't accidentally traverse a symlink into some other
94 # filesystem (which is potentially expensive to access).
94 # filesystem (which is potentially expensive to access).
95 for i in range(len(parts)):
95 for i in range(len(parts)):
96 prefix = pycompat.ossep.join(parts[:i + 1])
96 prefix = pycompat.ossep.join(parts[:i + 1])
97 normprefix = pycompat.ossep.join(normparts[:i + 1])
97 normprefix = pycompat.ossep.join(normparts[:i + 1])
98 if normprefix in self.auditeddir:
98 if normprefix in self.auditeddir:
99 continue
99 continue
100 if self._realfs:
100 if self._realfs:
101 self._checkfs(prefix, path)
101 self._checkfs(prefix, path)
102 prefixes.append(normprefix)
102 prefixes.append(normprefix)
103
103
104 if self._cached:
104 if self._cached:
105 self.audited.add(normpath)
105 self.audited.add(normpath)
106 # only add prefixes to the cache after checking everything: we don't
106 # only add prefixes to the cache after checking everything: we don't
107 # want to add "foo/bar/baz" before checking if there's a "foo/.hg"
107 # want to add "foo/bar/baz" before checking if there's a "foo/.hg"
108 self.auditeddir.update(prefixes)
108 self.auditeddir.update(prefixes)
109
109
110 def _checkfs(self, prefix, path):
110 def _checkfs(self, prefix, path):
111 """raise exception if a file system backed check fails"""
111 """raise exception if a file system backed check fails"""
112 curpath = os.path.join(self.root, prefix)
112 curpath = os.path.join(self.root, prefix)
113 try:
113 try:
114 st = os.lstat(curpath)
114 st = os.lstat(curpath)
115 except OSError as err:
115 except OSError as err:
116 # EINVAL can be raised as invalid path syntax under win32.
116 # EINVAL can be raised as invalid path syntax under win32.
117 # They must be ignored for patterns can be checked too.
117 # They must be ignored for patterns can be checked too.
118 if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
118 if err.errno not in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
119 raise
119 raise
120 else:
120 else:
121 if stat.S_ISLNK(st.st_mode):
121 if stat.S_ISLNK(st.st_mode):
122 msg = (_('path %r traverses symbolic link %r')
122 msg = (_('path %r traverses symbolic link %r')
123 % (pycompat.bytestr(path), pycompat.bytestr(prefix)))
123 % (pycompat.bytestr(path), pycompat.bytestr(prefix)))
124 raise error.Abort(msg)
124 raise error.Abort(msg)
125 elif (stat.S_ISDIR(st.st_mode) and
125 elif (stat.S_ISDIR(st.st_mode) and
126 os.path.isdir(os.path.join(curpath, '.hg'))):
126 os.path.isdir(os.path.join(curpath, '.hg'))):
127 if not self.callback or not self.callback(curpath):
127 if not self.callback or not self.callback(curpath):
128 msg = _("path '%s' is inside nested repo %r")
128 msg = _("path '%s' is inside nested repo %r")
129 raise error.Abort(msg % (path, pycompat.bytestr(prefix)))
129 raise error.Abort(msg % (path, pycompat.bytestr(prefix)))
130
130
131 def check(self, path):
131 def check(self, path):
132 try:
132 try:
133 self(path)
133 self(path)
134 return True
134 return True
135 except (OSError, error.Abort):
135 except (OSError, error.Abort):
136 return False
136 return False
137
137
138 def canonpath(root, cwd, myname, auditor=None):
138 def canonpath(root, cwd, myname, auditor=None):
139 '''return the canonical path of myname, given cwd and root
139 '''return the canonical path of myname, given cwd and root
140
140
141 >>> def check(root, cwd, myname):
141 >>> def check(root, cwd, myname):
142 ... a = pathauditor(root, realfs=False)
142 ... a = pathauditor(root, realfs=False)
143 ... try:
143 ... try:
144 ... return canonpath(root, cwd, myname, a)
144 ... return canonpath(root, cwd, myname, a)
145 ... except error.Abort:
145 ... except error.Abort:
146 ... return 'aborted'
146 ... return 'aborted'
147 >>> def unixonly(root, cwd, myname, expected='aborted'):
147 >>> def unixonly(root, cwd, myname, expected='aborted'):
148 ... if pycompat.iswindows:
148 ... if pycompat.iswindows:
149 ... return expected
149 ... return expected
150 ... return check(root, cwd, myname)
150 ... return check(root, cwd, myname)
151 >>> def winonly(root, cwd, myname, expected='aborted'):
151 >>> def winonly(root, cwd, myname, expected='aborted'):
152 ... if not pycompat.iswindows:
152 ... if not pycompat.iswindows:
153 ... return expected
153 ... return expected
154 ... return check(root, cwd, myname)
154 ... return check(root, cwd, myname)
155 >>> winonly(b'd:\\\\repo', b'c:\\\\dir', b'filename')
155 >>> winonly(b'd:\\\\repo', b'c:\\\\dir', b'filename')
156 'aborted'
156 'aborted'
157 >>> winonly(b'c:\\\\repo', b'c:\\\\dir', b'filename')
157 >>> winonly(b'c:\\\\repo', b'c:\\\\dir', b'filename')
158 'aborted'
158 'aborted'
159 >>> winonly(b'c:\\\\repo', b'c:\\\\', b'filename')
159 >>> winonly(b'c:\\\\repo', b'c:\\\\', b'filename')
160 'aborted'
160 'aborted'
161 >>> winonly(b'c:\\\\repo', b'c:\\\\', b'repo\\\\filename',
161 >>> winonly(b'c:\\\\repo', b'c:\\\\', b'repo\\\\filename',
162 ... b'filename')
162 ... b'filename')
163 'filename'
163 'filename'
164 >>> winonly(b'c:\\\\repo', b'c:\\\\repo', b'filename', b'filename')
164 >>> winonly(b'c:\\\\repo', b'c:\\\\repo', b'filename', b'filename')
165 'filename'
165 'filename'
166 >>> winonly(b'c:\\\\repo', b'c:\\\\repo\\\\subdir', b'filename',
166 >>> winonly(b'c:\\\\repo', b'c:\\\\repo\\\\subdir', b'filename',
167 ... b'subdir/filename')
167 ... b'subdir/filename')
168 'subdir/filename'
168 'subdir/filename'
169 >>> unixonly(b'/repo', b'/dir', b'filename')
169 >>> unixonly(b'/repo', b'/dir', b'filename')
170 'aborted'
170 'aborted'
171 >>> unixonly(b'/repo', b'/', b'filename')
171 >>> unixonly(b'/repo', b'/', b'filename')
172 'aborted'
172 'aborted'
173 >>> unixonly(b'/repo', b'/', b'repo/filename', b'filename')
173 >>> unixonly(b'/repo', b'/', b'repo/filename', b'filename')
174 'filename'
174 'filename'
175 >>> unixonly(b'/repo', b'/repo', b'filename', b'filename')
175 >>> unixonly(b'/repo', b'/repo', b'filename', b'filename')
176 'filename'
176 'filename'
177 >>> unixonly(b'/repo', b'/repo/subdir', b'filename', b'subdir/filename')
177 >>> unixonly(b'/repo', b'/repo/subdir', b'filename', b'subdir/filename')
178 'subdir/filename'
178 'subdir/filename'
179 '''
179 '''
180 if util.endswithsep(root):
180 if util.endswithsep(root):
181 rootsep = root
181 rootsep = root
182 else:
182 else:
183 rootsep = root + pycompat.ossep
183 rootsep = root + pycompat.ossep
184 name = myname
184 name = myname
185 if not os.path.isabs(name):
185 if not os.path.isabs(name):
186 name = os.path.join(root, cwd, name)
186 name = os.path.join(root, cwd, name)
187 name = os.path.normpath(name)
187 name = os.path.normpath(name)
188 if auditor is None:
188 if auditor is None:
189 auditor = pathauditor(root)
189 auditor = pathauditor(root)
190 if name != rootsep and name.startswith(rootsep):
190 if name != rootsep and name.startswith(rootsep):
191 name = name[len(rootsep):]
191 name = name[len(rootsep):]
192 auditor(name)
192 auditor(name)
193 return util.pconvert(name)
193 return util.pconvert(name)
194 elif name == root:
194 elif name == root:
195 return ''
195 return ''
196 else:
196 else:
197 # Determine whether `name' is in the hierarchy at or beneath `root',
197 # Determine whether `name' is in the hierarchy at or beneath `root',
198 # by iterating name=dirname(name) until that causes no change (can't
198 # by iterating name=dirname(name) until that causes no change (can't
199 # check name == '/', because that doesn't work on windows). The list
199 # check name == '/', because that doesn't work on windows). The list
200 # `rel' holds the reversed list of components making up the relative
200 # `rel' holds the reversed list of components making up the relative
201 # file name we want.
201 # file name we want.
202 rel = []
202 rel = []
203 while True:
203 while True:
204 try:
204 try:
205 s = util.samefile(name, root)
205 s = util.samefile(name, root)
206 except OSError:
206 except OSError:
207 s = False
207 s = False
208 if s:
208 if s:
209 if not rel:
209 if not rel:
210 # name was actually the same as root (maybe a symlink)
210 # name was actually the same as root (maybe a symlink)
211 return ''
211 return ''
212 rel.reverse()
212 rel.reverse()
213 name = os.path.join(*rel)
213 name = os.path.join(*rel)
214 auditor(name)
214 auditor(name)
215 return util.pconvert(name)
215 return util.pconvert(name)
216 dirname, basename = util.split(name)
216 dirname, basename = util.split(name)
217 rel.append(basename)
217 rel.append(basename)
218 if dirname == name:
218 if dirname == name:
219 break
219 break
220 name = dirname
220 name = dirname
221
221
222 # A common mistake is to use -R, but specify a file relative to the repo
222 # A common mistake is to use -R, but specify a file relative to the repo
223 # instead of cwd. Detect that case, and provide a hint to the user.
223 # instead of cwd. Detect that case, and provide a hint to the user.
224 hint = None
224 hint = None
225 try:
225 try:
226 if cwd != root:
226 if cwd != root:
227 canonpath(root, root, myname, auditor)
227 canonpath(root, root, myname, auditor)
228 relpath = util.pathto(root, cwd, '')
228 relpath = util.pathto(root, cwd, '')
229 if relpath[-1] == pycompat.ossep:
229 if relpath.endswith(pycompat.ossep):
230 relpath = relpath[:-1]
230 relpath = relpath[:-1]
231 hint = (_("consider using '--cwd %s'") % relpath)
231 hint = (_("consider using '--cwd %s'") % relpath)
232 except error.Abort:
232 except error.Abort:
233 pass
233 pass
234
234
235 raise error.Abort(_("%s not under root '%s'") % (myname, root),
235 raise error.Abort(_("%s not under root '%s'") % (myname, root),
236 hint=hint)
236 hint=hint)
237
237
238 def normasprefix(path):
238 def normasprefix(path):
239 '''normalize the specified path as path prefix
239 '''normalize the specified path as path prefix
240
240
241 Returned value can be used safely for "p.startswith(prefix)",
241 Returned value can be used safely for "p.startswith(prefix)",
242 "p[len(prefix):]", and so on.
242 "p[len(prefix):]", and so on.
243
243
244 For efficiency, this expects "path" argument to be already
244 For efficiency, this expects "path" argument to be already
245 normalized by "os.path.normpath", "os.path.realpath", and so on.
245 normalized by "os.path.normpath", "os.path.realpath", and so on.
246
246
247 See also issue3033 for detail about need of this function.
247 See also issue3033 for detail about need of this function.
248
248
249 >>> normasprefix(b'/foo/bar').replace(pycompat.ossep, b'/')
249 >>> normasprefix(b'/foo/bar').replace(pycompat.ossep, b'/')
250 '/foo/bar/'
250 '/foo/bar/'
251 >>> normasprefix(b'/').replace(pycompat.ossep, b'/')
251 >>> normasprefix(b'/').replace(pycompat.ossep, b'/')
252 '/'
252 '/'
253 '''
253 '''
254 d, p = os.path.splitdrive(path)
254 d, p = os.path.splitdrive(path)
255 if len(p) != len(pycompat.ossep):
255 if len(p) != len(pycompat.ossep):
256 return path + pycompat.ossep
256 return path + pycompat.ossep
257 else:
257 else:
258 return path
258 return path
259
259
260 # forward two methods from posixpath that do what we need, but we'd
260 # forward two methods from posixpath that do what we need, but we'd
261 # rather not let our internals know that we're thinking in posix terms
261 # rather not let our internals know that we're thinking in posix terms
262 # - instead we'll let them be oblivious.
262 # - instead we'll let them be oblivious.
263 join = posixpath.join
263 join = posixpath.join
264 dirname = posixpath.dirname
264 dirname = posixpath.dirname
General Comments 0
You need to be logged in to leave comments. Login now