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