##// END OF EJS Templates
tests: make test-pathencode use print_function
Pulkit Goyal -
r28918:72f68326 default
parent child Browse files
Show More
@@ -1,202 +1,201
1 #require test-repo
1 #require test-repo
2
2
3 $ cd "$TESTDIR"/..
3 $ cd "$TESTDIR"/..
4
4
5 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py
5 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py
6 doc/check-seclevel.py not using absolute_import
6 doc/check-seclevel.py not using absolute_import
7 doc/gendoc.py not using absolute_import
7 doc/gendoc.py not using absolute_import
8 doc/hgmanpage.py not using absolute_import
8 doc/hgmanpage.py not using absolute_import
9 hgext/color.py not using absolute_import
9 hgext/color.py not using absolute_import
10 hgext/eol.py not using absolute_import
10 hgext/eol.py not using absolute_import
11 hgext/extdiff.py not using absolute_import
11 hgext/extdiff.py not using absolute_import
12 hgext/factotum.py not using absolute_import
12 hgext/factotum.py not using absolute_import
13 hgext/fetch.py not using absolute_import
13 hgext/fetch.py not using absolute_import
14 hgext/fsmonitor/pywatchman/__init__.py not using absolute_import
14 hgext/fsmonitor/pywatchman/__init__.py not using absolute_import
15 hgext/fsmonitor/pywatchman/__init__.py requires print_function
15 hgext/fsmonitor/pywatchman/__init__.py requires print_function
16 hgext/fsmonitor/pywatchman/capabilities.py not using absolute_import
16 hgext/fsmonitor/pywatchman/capabilities.py not using absolute_import
17 hgext/fsmonitor/pywatchman/pybser.py not using absolute_import
17 hgext/fsmonitor/pywatchman/pybser.py not using absolute_import
18 hgext/gpg.py not using absolute_import
18 hgext/gpg.py not using absolute_import
19 hgext/graphlog.py not using absolute_import
19 hgext/graphlog.py not using absolute_import
20 hgext/hgcia.py not using absolute_import
20 hgext/hgcia.py not using absolute_import
21 hgext/hgk.py not using absolute_import
21 hgext/hgk.py not using absolute_import
22 hgext/highlight/__init__.py not using absolute_import
22 hgext/highlight/__init__.py not using absolute_import
23 hgext/highlight/highlight.py not using absolute_import
23 hgext/highlight/highlight.py not using absolute_import
24 hgext/histedit.py not using absolute_import
24 hgext/histedit.py not using absolute_import
25 hgext/largefiles/__init__.py not using absolute_import
25 hgext/largefiles/__init__.py not using absolute_import
26 hgext/largefiles/basestore.py not using absolute_import
26 hgext/largefiles/basestore.py not using absolute_import
27 hgext/largefiles/lfcommands.py not using absolute_import
27 hgext/largefiles/lfcommands.py not using absolute_import
28 hgext/largefiles/lfutil.py not using absolute_import
28 hgext/largefiles/lfutil.py not using absolute_import
29 hgext/largefiles/localstore.py not using absolute_import
29 hgext/largefiles/localstore.py not using absolute_import
30 hgext/largefiles/overrides.py not using absolute_import
30 hgext/largefiles/overrides.py not using absolute_import
31 hgext/largefiles/proto.py not using absolute_import
31 hgext/largefiles/proto.py not using absolute_import
32 hgext/largefiles/remotestore.py not using absolute_import
32 hgext/largefiles/remotestore.py not using absolute_import
33 hgext/largefiles/reposetup.py not using absolute_import
33 hgext/largefiles/reposetup.py not using absolute_import
34 hgext/largefiles/uisetup.py not using absolute_import
34 hgext/largefiles/uisetup.py not using absolute_import
35 hgext/largefiles/wirestore.py not using absolute_import
35 hgext/largefiles/wirestore.py not using absolute_import
36 hgext/mq.py not using absolute_import
36 hgext/mq.py not using absolute_import
37 hgext/rebase.py not using absolute_import
37 hgext/rebase.py not using absolute_import
38 hgext/share.py not using absolute_import
38 hgext/share.py not using absolute_import
39 hgext/win32text.py not using absolute_import
39 hgext/win32text.py not using absolute_import
40 i18n/check-translation.py not using absolute_import
40 i18n/check-translation.py not using absolute_import
41 i18n/polib.py not using absolute_import
41 i18n/polib.py not using absolute_import
42 setup.py not using absolute_import
42 setup.py not using absolute_import
43 tests/heredoctest.py requires print_function
43 tests/heredoctest.py requires print_function
44 tests/killdaemons.py not using absolute_import
44 tests/killdaemons.py not using absolute_import
45 tests/md5sum.py not using absolute_import
45 tests/md5sum.py not using absolute_import
46 tests/mockblackbox.py not using absolute_import
46 tests/mockblackbox.py not using absolute_import
47 tests/printenv.py not using absolute_import
47 tests/printenv.py not using absolute_import
48 tests/readlink.py not using absolute_import
48 tests/readlink.py not using absolute_import
49 tests/readlink.py requires print_function
49 tests/readlink.py requires print_function
50 tests/revlog-formatv0.py not using absolute_import
50 tests/revlog-formatv0.py not using absolute_import
51 tests/run-tests.py not using absolute_import
51 tests/run-tests.py not using absolute_import
52 tests/sitecustomize.py not using absolute_import
52 tests/sitecustomize.py not using absolute_import
53 tests/svn-safe-append.py not using absolute_import
53 tests/svn-safe-append.py not using absolute_import
54 tests/svnxml.py not using absolute_import
54 tests/svnxml.py not using absolute_import
55 tests/test-atomictempfile.py not using absolute_import
55 tests/test-atomictempfile.py not using absolute_import
56 tests/test-demandimport.py not using absolute_import
56 tests/test-demandimport.py not using absolute_import
57 tests/test-demandimport.py requires print_function
57 tests/test-demandimport.py requires print_function
58 tests/test-doctest.py not using absolute_import
58 tests/test-doctest.py not using absolute_import
59 tests/test-hgwebdir-paths.py not using absolute_import
59 tests/test-hgwebdir-paths.py not using absolute_import
60 tests/test-lrucachedict.py not using absolute_import
60 tests/test-lrucachedict.py not using absolute_import
61 tests/test-lrucachedict.py requires print_function
61 tests/test-lrucachedict.py requires print_function
62 tests/test-manifest.py not using absolute_import
62 tests/test-manifest.py not using absolute_import
63 tests/test-pathencode.py not using absolute_import
63 tests/test-pathencode.py not using absolute_import
64 tests/test-pathencode.py requires print_function
65 tests/test-simplemerge.py not using absolute_import
64 tests/test-simplemerge.py not using absolute_import
66 tests/test-trusted.py requires print_function
65 tests/test-trusted.py requires print_function
67
66
68 #if py3exe
67 #if py3exe
69 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py
68 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py
70 contrib/check-code.py: invalid syntax: (unicode error) 'unicodeescape' codec can't decode bytes in position *-*: malformed \N character escape (<unknown>, line *) (glob)
69 contrib/check-code.py: invalid syntax: (unicode error) 'unicodeescape' codec can't decode bytes in position *-*: malformed \N character escape (<unknown>, line *) (glob)
71 doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
70 doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
72 hgext/automv.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
71 hgext/automv.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
73 hgext/blackbox.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
72 hgext/blackbox.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
74 hgext/bugzilla.py: error importing module: <ImportError> No module named 'urlparse' (line *) (glob)
73 hgext/bugzilla.py: error importing module: <ImportError> No module named 'urlparse' (line *) (glob)
75 hgext/censor.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
74 hgext/censor.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
76 hgext/chgserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob)
75 hgext/chgserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob)
77 hgext/children.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
76 hgext/children.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
78 hgext/churn.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
77 hgext/churn.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
79 hgext/clonebundles.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
78 hgext/clonebundles.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
80 hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
79 hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
81 hgext/convert/bzr.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
80 hgext/convert/bzr.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
82 hgext/convert/common.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
81 hgext/convert/common.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
83 hgext/convert/convcmd.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
82 hgext/convert/convcmd.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
84 hgext/convert/cvs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
83 hgext/convert/cvs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
85 hgext/convert/cvsps.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
84 hgext/convert/cvsps.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
86 hgext/convert/darcs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
85 hgext/convert/darcs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
87 hgext/convert/filemap.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
86 hgext/convert/filemap.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
88 hgext/convert/git.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
87 hgext/convert/git.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
89 hgext/convert/gnuarch.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
88 hgext/convert/gnuarch.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
90 hgext/convert/hg.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
89 hgext/convert/hg.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
91 hgext/convert/monotone.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
90 hgext/convert/monotone.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
92 hgext/convert/p*.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
91 hgext/convert/p*.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob)
93 hgext/convert/subversion.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
92 hgext/convert/subversion.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
94 hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *) (glob)
93 hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *) (glob)
95 hgext/eol.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
94 hgext/eol.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
96 hgext/extdiff.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
95 hgext/extdiff.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
97 hgext/factotum.py: error importing: <ImportError> No module named 'httplib' (error at url.py:*) (glob)
96 hgext/factotum.py: error importing: <ImportError> No module named 'httplib' (error at url.py:*) (glob)
98 hgext/fetch.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
97 hgext/fetch.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
99 hgext/fsmonitor/watchmanclient.py: error importing module: <SystemError> Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (line *) (glob)
98 hgext/fsmonitor/watchmanclient.py: error importing module: <SystemError> Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (line *) (glob)
100 hgext/gpg.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
99 hgext/gpg.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
101 hgext/graphlog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
100 hgext/graphlog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
102 hgext/hgcia.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
101 hgext/hgcia.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
103 hgext/hgk.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
102 hgext/hgk.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
104 hgext/histedit.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
103 hgext/histedit.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
105 hgext/keyword.py: error importing: <ImportError> No module named 'BaseHTTPServer' (error at common.py:*) (glob)
104 hgext/keyword.py: error importing: <ImportError> No module named 'BaseHTTPServer' (error at common.py:*) (glob)
106 hgext/largefiles/basestore.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
105 hgext/largefiles/basestore.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
107 hgext/largefiles/lfcommands.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
106 hgext/largefiles/lfcommands.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
108 hgext/largefiles/lfutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
107 hgext/largefiles/lfutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
109 hgext/largefiles/localstore.py: error importing module: <ImportError> No module named 'lfutil' (line *) (glob)
108 hgext/largefiles/localstore.py: error importing module: <ImportError> No module named 'lfutil' (line *) (glob)
110 hgext/largefiles/overrides.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
109 hgext/largefiles/overrides.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
111 hgext/largefiles/proto.py: error importing: <ImportError> No module named 'httplib' (error at httppeer.py:*) (glob)
110 hgext/largefiles/proto.py: error importing: <ImportError> No module named 'httplib' (error at httppeer.py:*) (glob)
112 hgext/largefiles/remotestore.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at wireproto.py:*) (glob)
111 hgext/largefiles/remotestore.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at wireproto.py:*) (glob)
113 hgext/largefiles/reposetup.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
112 hgext/largefiles/reposetup.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
114 hgext/largefiles/uisetup.py: error importing module: <SyntaxError> invalid syntax (archival.py, line *) (line *) (glob)
113 hgext/largefiles/uisetup.py: error importing module: <SyntaxError> invalid syntax (archival.py, line *) (line *) (glob)
115 hgext/largefiles/wirestore.py: error importing module: <ImportError> No module named 'lfutil' (line *) (glob)
114 hgext/largefiles/wirestore.py: error importing module: <ImportError> No module named 'lfutil' (line *) (glob)
116 hgext/mq.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
115 hgext/mq.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob)
117 hgext/notify.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
116 hgext/notify.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
118 hgext/pager.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
117 hgext/pager.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
119 hgext/patchbomb.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
118 hgext/patchbomb.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
120 hgext/purge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
119 hgext/purge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
121 hgext/rebase.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
120 hgext/rebase.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
122 hgext/record.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
121 hgext/record.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
123 hgext/relink.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
122 hgext/relink.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
124 hgext/schemes.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
123 hgext/schemes.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
125 hgext/share.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
124 hgext/share.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
126 hgext/shelve.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
125 hgext/shelve.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
127 hgext/strip.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
126 hgext/strip.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
128 hgext/transplant.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
127 hgext/transplant.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
129 mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
128 mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
130 mercurial/branchmap.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
129 mercurial/branchmap.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
131 mercurial/bundle*.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
130 mercurial/bundle*.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
132 mercurial/bundlerepo.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
131 mercurial/bundlerepo.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
133 mercurial/changegroup.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
132 mercurial/changegroup.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
134 mercurial/changelog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
133 mercurial/changelog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
135 mercurial/cmdutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
134 mercurial/cmdutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
136 mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
135 mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
137 mercurial/commandserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob)
136 mercurial/commandserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob)
138 mercurial/context.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
137 mercurial/context.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
139 mercurial/copies.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
138 mercurial/copies.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
140 mercurial/crecord.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
139 mercurial/crecord.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
141 mercurial/dirstate.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
140 mercurial/dirstate.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
142 mercurial/discovery.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
141 mercurial/discovery.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
143 mercurial/dispatch.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
142 mercurial/dispatch.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
144 mercurial/exchange.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
143 mercurial/exchange.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
145 mercurial/extensions.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
144 mercurial/extensions.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
146 mercurial/filelog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
145 mercurial/filelog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
147 mercurial/filemerge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
146 mercurial/filemerge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
148 mercurial/fileset.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
147 mercurial/fileset.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
149 mercurial/formatter.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
148 mercurial/formatter.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob)
150 mercurial/graphmod.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
149 mercurial/graphmod.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
151 mercurial/help.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
150 mercurial/help.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
152 mercurial/hg.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
151 mercurial/hg.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob)
153 mercurial/hgweb/common.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob)
152 mercurial/hgweb/common.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob)
154 mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
153 mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
155 mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
154 mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
156 mercurial/hgweb/protocol.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
155 mercurial/hgweb/protocol.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
157 mercurial/hgweb/request.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
156 mercurial/hgweb/request.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
158 mercurial/hgweb/server.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob)
157 mercurial/hgweb/server.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob)
159 mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
158 mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
160 mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
159 mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
161 mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
160 mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
162 mercurial/hook.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
161 mercurial/hook.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
163 mercurial/httpclient/_readers.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
162 mercurial/httpclient/_readers.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
164 mercurial/httpconnection.py: error importing: <ImportError> No module named 'httplib' (error at __init__.py:*) (glob)
163 mercurial/httpconnection.py: error importing: <ImportError> No module named 'httplib' (error at __init__.py:*) (glob)
165 mercurial/httppeer.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
164 mercurial/httppeer.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
166 mercurial/keepalive.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
165 mercurial/keepalive.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
167 mercurial/localrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
166 mercurial/localrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
168 mercurial/mail.py: error importing module: <AttributeError> module 'email' has no attribute 'Header' (line *) (glob)
167 mercurial/mail.py: error importing module: <AttributeError> module 'email' has no attribute 'Header' (line *) (glob)
169 mercurial/manifest.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
168 mercurial/manifest.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
170 mercurial/merge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
169 mercurial/merge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
171 mercurial/namespaces.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
170 mercurial/namespaces.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
172 mercurial/patch.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
171 mercurial/patch.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
173 mercurial/pure/mpatch.py: error importing module: <ImportError> cannot import name 'pycompat' (line *) (glob)
172 mercurial/pure/mpatch.py: error importing module: <ImportError> cannot import name 'pycompat' (line *) (glob)
174 mercurial/pure/parsers.py: error importing module: <ImportError> No module named 'mercurial.pure.node' (line *) (glob)
173 mercurial/pure/parsers.py: error importing module: <ImportError> No module named 'mercurial.pure.node' (line *) (glob)
175 mercurial/repair.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
174 mercurial/repair.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
176 mercurial/revlog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
175 mercurial/revlog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
177 mercurial/revset.py: error importing module: <AttributeError> 'dict' object has no attribute 'iteritems' (line *) (glob)
176 mercurial/revset.py: error importing module: <AttributeError> 'dict' object has no attribute 'iteritems' (line *) (glob)
178 mercurial/scmutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
177 mercurial/scmutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
179 mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
178 mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
180 mercurial/simplemerge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
179 mercurial/simplemerge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
181 mercurial/sshpeer.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at wireproto.py:*) (glob)
180 mercurial/sshpeer.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at wireproto.py:*) (glob)
182 mercurial/sshserver.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
181 mercurial/sshserver.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
183 mercurial/statichttprepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
182 mercurial/statichttprepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
184 mercurial/store.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
183 mercurial/store.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
185 mercurial/streamclone.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
184 mercurial/streamclone.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
186 mercurial/subrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
185 mercurial/subrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
187 mercurial/templatefilters.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
186 mercurial/templatefilters.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
188 mercurial/templatekw.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
187 mercurial/templatekw.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
189 mercurial/templater.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
188 mercurial/templater.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
190 mercurial/ui.py: error importing: <ImportError> No module named 'cPickle' (error at formatter.py:*) (glob)
189 mercurial/ui.py: error importing: <ImportError> No module named 'cPickle' (error at formatter.py:*) (glob)
191 mercurial/unionrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
190 mercurial/unionrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
192 mercurial/url.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
191 mercurial/url.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob)
193 mercurial/verify.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
192 mercurial/verify.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob)
194 mercurial/win*.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob)
193 mercurial/win*.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob)
195 mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
194 mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
196 mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
195 mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
197 tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
196 tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
198 tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
197 tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
199 tests/test-lrucachedict.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
198 tests/test-lrucachedict.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
200 tests/test-trusted.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
199 tests/test-trusted.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
201
200
202 #endif
201 #endif
@@ -1,194 +1,196
1 # This is a randomized test that generates different pathnames every
1 # This is a randomized test that generates different pathnames every
2 # time it is invoked, and tests the encoding of those pathnames.
2 # time it is invoked, and tests the encoding of those pathnames.
3 #
3 #
4 # It uses a simple probabilistic model to generate valid pathnames
4 # It uses a simple probabilistic model to generate valid pathnames
5 # that have proven likely to expose bugs and divergent behavior in
5 # that have proven likely to expose bugs and divergent behavior in
6 # different encoding implementations.
6 # different encoding implementations.
7
7
8 from __future__ import print_function
9
8 from mercurial import store
10 from mercurial import store
9 import binascii, itertools, math, os, random, sys, time
11 import binascii, itertools, math, os, random, sys, time
10 import collections
12 import collections
11
13
12 validchars = set(map(chr, range(0, 256)))
14 validchars = set(map(chr, range(0, 256)))
13 alphanum = range(ord('A'), ord('Z'))
15 alphanum = range(ord('A'), ord('Z'))
14
16
15 for c in '\0/':
17 for c in '\0/':
16 validchars.remove(c)
18 validchars.remove(c)
17
19
18 winreserved = ('aux con prn nul'.split() +
20 winreserved = ('aux con prn nul'.split() +
19 ['com%d' % i for i in xrange(1, 10)] +
21 ['com%d' % i for i in xrange(1, 10)] +
20 ['lpt%d' % i for i in xrange(1, 10)])
22 ['lpt%d' % i for i in xrange(1, 10)])
21
23
22 def casecombinations(names):
24 def casecombinations(names):
23 '''Build all case-diddled combinations of names.'''
25 '''Build all case-diddled combinations of names.'''
24
26
25 combos = set()
27 combos = set()
26
28
27 for r in names:
29 for r in names:
28 for i in xrange(len(r) + 1):
30 for i in xrange(len(r) + 1):
29 for c in itertools.combinations(xrange(len(r)), i):
31 for c in itertools.combinations(xrange(len(r)), i):
30 d = r
32 d = r
31 for j in c:
33 for j in c:
32 d = ''.join((d[:j], d[j].upper(), d[j + 1:]))
34 d = ''.join((d[:j], d[j].upper(), d[j + 1:]))
33 combos.add(d)
35 combos.add(d)
34 return sorted(combos)
36 return sorted(combos)
35
37
36 def buildprobtable(fp, cmd='hg manifest tip'):
38 def buildprobtable(fp, cmd='hg manifest tip'):
37 '''Construct and print a table of probabilities for path name
39 '''Construct and print a table of probabilities for path name
38 components. The numbers are percentages.'''
40 components. The numbers are percentages.'''
39
41
40 counts = collections.defaultdict(lambda: 0)
42 counts = collections.defaultdict(lambda: 0)
41 for line in os.popen(cmd).read().splitlines():
43 for line in os.popen(cmd).read().splitlines():
42 if line[-2:] in ('.i', '.d'):
44 if line[-2:] in ('.i', '.d'):
43 line = line[:-2]
45 line = line[:-2]
44 if line.startswith('data/'):
46 if line.startswith('data/'):
45 line = line[5:]
47 line = line[5:]
46 for c in line:
48 for c in line:
47 counts[c] += 1
49 counts[c] += 1
48 for c in '\r/\n':
50 for c in '\r/\n':
49 counts.pop(c, None)
51 counts.pop(c, None)
50 t = sum(counts.itervalues()) / 100.0
52 t = sum(counts.itervalues()) / 100.0
51 fp.write('probtable = (')
53 fp.write('probtable = (')
52 for i, (k, v) in enumerate(sorted(counts.iteritems(), key=lambda x: x[1],
54 for i, (k, v) in enumerate(sorted(counts.iteritems(), key=lambda x: x[1],
53 reverse=True)):
55 reverse=True)):
54 if (i % 5) == 0:
56 if (i % 5) == 0:
55 fp.write('\n ')
57 fp.write('\n ')
56 vt = v / t
58 vt = v / t
57 if vt < 0.0005:
59 if vt < 0.0005:
58 break
60 break
59 fp.write('(%r, %.03f), ' % (k, vt))
61 fp.write('(%r, %.03f), ' % (k, vt))
60 fp.write('\n )\n')
62 fp.write('\n )\n')
61
63
62 # A table of character frequencies (as percentages), gleaned by
64 # A table of character frequencies (as percentages), gleaned by
63 # looking at filelog names from a real-world, very large repo.
65 # looking at filelog names from a real-world, very large repo.
64
66
65 probtable = (
67 probtable = (
66 ('t', 9.828), ('e', 9.042), ('s', 8.011), ('a', 6.801), ('i', 6.618),
68 ('t', 9.828), ('e', 9.042), ('s', 8.011), ('a', 6.801), ('i', 6.618),
67 ('g', 5.053), ('r', 5.030), ('o', 4.887), ('p', 4.363), ('n', 4.258),
69 ('g', 5.053), ('r', 5.030), ('o', 4.887), ('p', 4.363), ('n', 4.258),
68 ('l', 3.830), ('h', 3.693), ('_', 3.659), ('.', 3.377), ('m', 3.194),
70 ('l', 3.830), ('h', 3.693), ('_', 3.659), ('.', 3.377), ('m', 3.194),
69 ('u', 2.364), ('d', 2.296), ('c', 2.163), ('b', 1.739), ('f', 1.625),
71 ('u', 2.364), ('d', 2.296), ('c', 2.163), ('b', 1.739), ('f', 1.625),
70 ('6', 0.666), ('j', 0.610), ('y', 0.554), ('x', 0.487), ('w', 0.477),
72 ('6', 0.666), ('j', 0.610), ('y', 0.554), ('x', 0.487), ('w', 0.477),
71 ('k', 0.476), ('v', 0.473), ('3', 0.336), ('1', 0.335), ('2', 0.326),
73 ('k', 0.476), ('v', 0.473), ('3', 0.336), ('1', 0.335), ('2', 0.326),
72 ('4', 0.310), ('5', 0.305), ('9', 0.302), ('8', 0.300), ('7', 0.299),
74 ('4', 0.310), ('5', 0.305), ('9', 0.302), ('8', 0.300), ('7', 0.299),
73 ('q', 0.298), ('0', 0.250), ('z', 0.223), ('-', 0.118), ('C', 0.095),
75 ('q', 0.298), ('0', 0.250), ('z', 0.223), ('-', 0.118), ('C', 0.095),
74 ('T', 0.087), ('F', 0.085), ('B', 0.077), ('S', 0.076), ('P', 0.076),
76 ('T', 0.087), ('F', 0.085), ('B', 0.077), ('S', 0.076), ('P', 0.076),
75 ('L', 0.059), ('A', 0.058), ('N', 0.051), ('D', 0.049), ('M', 0.046),
77 ('L', 0.059), ('A', 0.058), ('N', 0.051), ('D', 0.049), ('M', 0.046),
76 ('E', 0.039), ('I', 0.035), ('R', 0.035), ('G', 0.028), ('U', 0.026),
78 ('E', 0.039), ('I', 0.035), ('R', 0.035), ('G', 0.028), ('U', 0.026),
77 ('W', 0.025), ('O', 0.017), ('V', 0.015), ('H', 0.013), ('Q', 0.011),
79 ('W', 0.025), ('O', 0.017), ('V', 0.015), ('H', 0.013), ('Q', 0.011),
78 ('J', 0.007), ('K', 0.005), ('+', 0.004), ('X', 0.003), ('Y', 0.001),
80 ('J', 0.007), ('K', 0.005), ('+', 0.004), ('X', 0.003), ('Y', 0.001),
79 )
81 )
80
82
81 for c, _ in probtable:
83 for c, _ in probtable:
82 validchars.remove(c)
84 validchars.remove(c)
83 validchars = list(validchars)
85 validchars = list(validchars)
84
86
85 def pickfrom(rng, table):
87 def pickfrom(rng, table):
86 c = 0
88 c = 0
87 r = rng.random() * sum(i[1] for i in table)
89 r = rng.random() * sum(i[1] for i in table)
88 for i, p in table:
90 for i, p in table:
89 c += p
91 c += p
90 if c >= r:
92 if c >= r:
91 return i
93 return i
92
94
93 reservedcombos = casecombinations(winreserved)
95 reservedcombos = casecombinations(winreserved)
94
96
95 # The first component of a name following a slash.
97 # The first component of a name following a slash.
96
98
97 firsttable = (
99 firsttable = (
98 (lambda rng: pickfrom(rng, probtable), 90),
100 (lambda rng: pickfrom(rng, probtable), 90),
99 (lambda rng: rng.choice(validchars), 5),
101 (lambda rng: rng.choice(validchars), 5),
100 (lambda rng: rng.choice(reservedcombos), 5),
102 (lambda rng: rng.choice(reservedcombos), 5),
101 )
103 )
102
104
103 # Components of a name following the first.
105 # Components of a name following the first.
104
106
105 resttable = firsttable[:-1]
107 resttable = firsttable[:-1]
106
108
107 # Special suffixes.
109 # Special suffixes.
108
110
109 internalsuffixcombos = casecombinations('.hg .i .d'.split())
111 internalsuffixcombos = casecombinations('.hg .i .d'.split())
110
112
111 # The last component of a path, before a slash or at the end of a name.
113 # The last component of a path, before a slash or at the end of a name.
112
114
113 lasttable = resttable + (
115 lasttable = resttable + (
114 (lambda rng: '', 95),
116 (lambda rng: '', 95),
115 (lambda rng: rng.choice(internalsuffixcombos), 5),
117 (lambda rng: rng.choice(internalsuffixcombos), 5),
116 )
118 )
117
119
118 def makepart(rng, k):
120 def makepart(rng, k):
119 '''Construct a part of a pathname, without slashes.'''
121 '''Construct a part of a pathname, without slashes.'''
120
122
121 p = pickfrom(rng, firsttable)(rng)
123 p = pickfrom(rng, firsttable)(rng)
122 l = len(p)
124 l = len(p)
123 ps = [p]
125 ps = [p]
124 maxl = rng.randint(1, k)
126 maxl = rng.randint(1, k)
125 while l < maxl:
127 while l < maxl:
126 p = pickfrom(rng, resttable)(rng)
128 p = pickfrom(rng, resttable)(rng)
127 l += len(p)
129 l += len(p)
128 ps.append(p)
130 ps.append(p)
129 ps.append(pickfrom(rng, lasttable)(rng))
131 ps.append(pickfrom(rng, lasttable)(rng))
130 return ''.join(ps)
132 return ''.join(ps)
131
133
132 def makepath(rng, j, k):
134 def makepath(rng, j, k):
133 '''Construct a complete pathname.'''
135 '''Construct a complete pathname.'''
134
136
135 return ('data/' + '/'.join(makepart(rng, k) for _ in xrange(j)) +
137 return ('data/' + '/'.join(makepart(rng, k) for _ in xrange(j)) +
136 rng.choice(['.d', '.i']))
138 rng.choice(['.d', '.i']))
137
139
138 def genpath(rng, count):
140 def genpath(rng, count):
139 '''Generate random pathnames with gradually increasing lengths.'''
141 '''Generate random pathnames with gradually increasing lengths.'''
140
142
141 mink, maxk = 1, 4096
143 mink, maxk = 1, 4096
142 def steps():
144 def steps():
143 for i in xrange(count):
145 for i in xrange(count):
144 yield mink + int(round(math.sqrt((maxk - mink) * float(i) / count)))
146 yield mink + int(round(math.sqrt((maxk - mink) * float(i) / count)))
145 for k in steps():
147 for k in steps():
146 x = rng.randint(1, k)
148 x = rng.randint(1, k)
147 y = rng.randint(1, k)
149 y = rng.randint(1, k)
148 yield makepath(rng, x, y)
150 yield makepath(rng, x, y)
149
151
150 def runtests(rng, seed, count):
152 def runtests(rng, seed, count):
151 nerrs = 0
153 nerrs = 0
152 for p in genpath(rng, count):
154 for p in genpath(rng, count):
153 h = store._pathencode(p) # uses C implementation, if available
155 h = store._pathencode(p) # uses C implementation, if available
154 r = store._hybridencode(p, True) # reference implementation in Python
156 r = store._hybridencode(p, True) # reference implementation in Python
155 if h != r:
157 if h != r:
156 if nerrs == 0:
158 if nerrs == 0:
157 print >> sys.stderr, 'seed:', hex(seed)[:-1]
159 print('seed:', hex(seed)[:-1], file=sys.stderr)
158 print >> sys.stderr, "\np: '%s'" % p.encode("string_escape")
160 print("\np: '%s'" % p.encode("string_escape"), file=sys.stderr)
159 print >> sys.stderr, "h: '%s'" % h.encode("string_escape")
161 print("h: '%s'" % h.encode("string_escape"), file=sys.stderr)
160 print >> sys.stderr, "r: '%s'" % r.encode("string_escape")
162 print("r: '%s'" % r.encode("string_escape"), file=sys.stderr)
161 nerrs += 1
163 nerrs += 1
162 return nerrs
164 return nerrs
163
165
164 def main():
166 def main():
165 import getopt
167 import getopt
166
168
167 # Empirically observed to take about a second to run
169 # Empirically observed to take about a second to run
168 count = 100
170 count = 100
169 seed = None
171 seed = None
170 opts, args = getopt.getopt(sys.argv[1:], 'c:s:',
172 opts, args = getopt.getopt(sys.argv[1:], 'c:s:',
171 ['build', 'count=', 'seed='])
173 ['build', 'count=', 'seed='])
172 for o, a in opts:
174 for o, a in opts:
173 if o in ('-c', '--count'):
175 if o in ('-c', '--count'):
174 count = int(a)
176 count = int(a)
175 elif o in ('-s', '--seed'):
177 elif o in ('-s', '--seed'):
176 seed = long(a, base=0) # accepts base 10 or 16 strings
178 seed = long(a, base=0) # accepts base 10 or 16 strings
177 elif o == '--build':
179 elif o == '--build':
178 buildprobtable(sys.stdout,
180 buildprobtable(sys.stdout,
179 'find .hg/store/data -type f && '
181 'find .hg/store/data -type f && '
180 'cat .hg/store/fncache 2>/dev/null')
182 'cat .hg/store/fncache 2>/dev/null')
181 sys.exit(0)
183 sys.exit(0)
182
184
183 if seed is None:
185 if seed is None:
184 try:
186 try:
185 seed = long(binascii.hexlify(os.urandom(16)), 16)
187 seed = long(binascii.hexlify(os.urandom(16)), 16)
186 except AttributeError:
188 except AttributeError:
187 seed = long(time.time() * 1000)
189 seed = long(time.time() * 1000)
188
190
189 rng = random.Random(seed)
191 rng = random.Random(seed)
190 if runtests(rng, seed, count):
192 if runtests(rng, seed, count):
191 sys.exit(1)
193 sys.exit(1)
192
194
193 if __name__ == '__main__':
195 if __name__ == '__main__':
194 main()
196 main()
General Comments 0
You need to be logged in to leave comments. Login now