Show More
@@ -1,199 +1,198 b'' | |||
|
1 | 1 | #require test-repo |
|
2 | 2 | |
|
3 | 3 | $ cd "$TESTDIR"/.. |
|
4 | 4 | |
|
5 | 5 | $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py |
|
6 | 6 | doc/check-seclevel.py not using absolute_import |
|
7 | 7 | doc/gendoc.py not using absolute_import |
|
8 | 8 | doc/hgmanpage.py not using absolute_import |
|
9 | 9 | hgext/color.py not using absolute_import |
|
10 | 10 | hgext/eol.py not using absolute_import |
|
11 | 11 | hgext/extdiff.py not using absolute_import |
|
12 | 12 | hgext/factotum.py not using absolute_import |
|
13 | 13 | hgext/fetch.py not using absolute_import |
|
14 | 14 | hgext/fsmonitor/pywatchman/__init__.py not using absolute_import |
|
15 | 15 | hgext/fsmonitor/pywatchman/__init__.py requires print_function |
|
16 | 16 | hgext/fsmonitor/pywatchman/capabilities.py not using absolute_import |
|
17 | 17 | hgext/fsmonitor/pywatchman/pybser.py not using absolute_import |
|
18 | 18 | hgext/gpg.py not using absolute_import |
|
19 | 19 | hgext/graphlog.py not using absolute_import |
|
20 | 20 | hgext/hgcia.py not using absolute_import |
|
21 | 21 | hgext/hgk.py not using absolute_import |
|
22 | 22 | hgext/highlight/__init__.py not using absolute_import |
|
23 | 23 | hgext/highlight/highlight.py not using absolute_import |
|
24 | 24 | hgext/histedit.py not using absolute_import |
|
25 | 25 | hgext/largefiles/__init__.py not using absolute_import |
|
26 | 26 | hgext/largefiles/basestore.py not using absolute_import |
|
27 | 27 | hgext/largefiles/lfcommands.py not using absolute_import |
|
28 | 28 | hgext/largefiles/lfutil.py not using absolute_import |
|
29 | 29 | hgext/largefiles/localstore.py not using absolute_import |
|
30 | 30 | hgext/largefiles/overrides.py not using absolute_import |
|
31 | 31 | hgext/largefiles/proto.py not using absolute_import |
|
32 | 32 | hgext/largefiles/remotestore.py not using absolute_import |
|
33 | 33 | hgext/largefiles/reposetup.py not using absolute_import |
|
34 | 34 | hgext/largefiles/uisetup.py not using absolute_import |
|
35 | 35 | hgext/largefiles/wirestore.py not using absolute_import |
|
36 | 36 | hgext/mq.py not using absolute_import |
|
37 | 37 | hgext/rebase.py not using absolute_import |
|
38 | 38 | hgext/share.py not using absolute_import |
|
39 | 39 | hgext/win32text.py not using absolute_import |
|
40 | 40 | i18n/check-translation.py not using absolute_import |
|
41 | 41 | i18n/polib.py not using absolute_import |
|
42 | 42 | setup.py not using absolute_import |
|
43 | 43 | tests/heredoctest.py requires print_function |
|
44 | 44 | tests/killdaemons.py not using absolute_import |
|
45 | 45 | tests/md5sum.py not using absolute_import |
|
46 | 46 | tests/mockblackbox.py not using absolute_import |
|
47 | 47 | tests/printenv.py not using absolute_import |
|
48 | 48 | tests/readlink.py not using absolute_import |
|
49 | 49 | tests/readlink.py requires print_function |
|
50 | 50 | tests/revlog-formatv0.py not using absolute_import |
|
51 | 51 | tests/run-tests.py not using absolute_import |
|
52 | 52 | tests/sitecustomize.py not using absolute_import |
|
53 | 53 | tests/svn-safe-append.py not using absolute_import |
|
54 | 54 | tests/svnxml.py not using absolute_import |
|
55 | 55 | tests/test-atomictempfile.py not using absolute_import |
|
56 | 56 | tests/test-demandimport.py not using absolute_import |
|
57 | 57 | tests/test-demandimport.py requires print_function |
|
58 | 58 | tests/test-doctest.py not using absolute_import |
|
59 | 59 | tests/test-hgwebdir-paths.py not using absolute_import |
|
60 | 60 | tests/test-lrucachedict.py not using absolute_import |
|
61 | 61 | tests/test-lrucachedict.py requires print_function |
|
62 | tests/test-manifest.py not using absolute_import | |
|
63 | 62 | tests/test-trusted.py requires print_function |
|
64 | 63 | |
|
65 | 64 | #if py3exe |
|
66 | 65 | $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py |
|
67 | 66 | contrib/check-code.py: invalid syntax: (unicode error) 'unicodeescape' codec can't decode bytes in position *-*: malformed \N character escape (<unknown>, line *) (glob) |
|
68 | 67 | doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
69 | 68 | hgext/automv.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob) |
|
70 | 69 | hgext/blackbox.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
71 | 70 | hgext/bugzilla.py: error importing module: <ImportError> No module named 'urlparse' (line *) (glob) |
|
72 | 71 | hgext/censor.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
73 | 72 | hgext/chgserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob) |
|
74 | 73 | hgext/children.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
75 | 74 | hgext/churn.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
76 | 75 | hgext/clonebundles.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
77 | 76 | hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
78 | 77 | hgext/convert/bzr.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
79 | 78 | hgext/convert/common.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob) |
|
80 | 79 | hgext/convert/convcmd.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) |
|
81 | 80 | hgext/convert/cvs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
82 | 81 | hgext/convert/cvsps.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob) |
|
83 | 82 | hgext/convert/darcs.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
84 | 83 | hgext/convert/filemap.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
85 | 84 | hgext/convert/git.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
86 | 85 | hgext/convert/gnuarch.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
87 | 86 | hgext/convert/hg.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
88 | 87 | hgext/convert/monotone.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
89 | 88 | hgext/convert/p*.py: error importing module: <SystemError> Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) (glob) |
|
90 | 89 | hgext/convert/subversion.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob) |
|
91 | 90 | hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *) (glob) |
|
92 | 91 | hgext/eol.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
93 | 92 | hgext/extdiff.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
94 | 93 | hgext/factotum.py: error importing: <ImportError> No module named 'httplib' (error at url.py:*) (glob) |
|
95 | 94 | hgext/fetch.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob) |
|
96 | 95 | hgext/fsmonitor/watchmanclient.py: error importing module: <SystemError> Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (line *) (glob) |
|
97 | 96 | hgext/gpg.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob) |
|
98 | 97 | hgext/graphlog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
99 | 98 | hgext/hgcia.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
100 | 99 | hgext/hgk.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
101 | 100 | hgext/histedit.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob) |
|
102 | 101 | hgext/keyword.py: error importing: <ImportError> No module named 'BaseHTTPServer' (error at common.py:*) (glob) |
|
103 | 102 | hgext/largefiles/basestore.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) |
|
104 | 103 | hgext/largefiles/lfcommands.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) |
|
105 | 104 | hgext/largefiles/lfutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
106 | 105 | hgext/largefiles/localstore.py: error importing module: <ImportError> No module named 'lfutil' (line *) (glob) |
|
107 | 106 | hgext/largefiles/overrides.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) |
|
108 | 107 | hgext/largefiles/proto.py: error importing: <ImportError> No module named 'httplib' (error at httppeer.py:*) (glob) |
|
109 | 108 | hgext/largefiles/remotestore.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at wireproto.py:*) (glob) |
|
110 | 109 | hgext/largefiles/reposetup.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
111 | 110 | hgext/largefiles/uisetup.py: error importing module: <SyntaxError> invalid syntax (archival.py, line *) (line *) (glob) |
|
112 | 111 | hgext/largefiles/wirestore.py: error importing module: <ImportError> No module named 'lfutil' (line *) (glob) |
|
113 | 112 | hgext/mq.py: error importing module: <SyntaxError> invalid syntax (commands.py, line *) (line *) (glob) |
|
114 | 113 | hgext/notify.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
115 | 114 | hgext/pager.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
116 | 115 | hgext/patchbomb.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
117 | 116 | hgext/purge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
118 | 117 | hgext/rebase.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) |
|
119 | 118 | hgext/record.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
120 | 119 | hgext/relink.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
121 | 120 | hgext/schemes.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
122 | 121 | hgext/share.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
123 | 122 | hgext/shelve.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob) |
|
124 | 123 | hgext/strip.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
125 | 124 | hgext/transplant.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) |
|
126 | 125 | mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
127 | 126 | mercurial/branchmap.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
128 | 127 | mercurial/bundle*.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
129 | 128 | mercurial/bundlerepo.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob) |
|
130 | 129 | mercurial/changegroup.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
131 | 130 | mercurial/changelog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
132 | 131 | mercurial/cmdutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
133 | 132 | mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
134 | 133 | mercurial/commandserver.py: error importing module: <ImportError> No module named 'SocketServer' (line *) (glob) |
|
135 | 134 | mercurial/context.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
136 | 135 | mercurial/copies.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
137 | 136 | mercurial/crecord.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
138 | 137 | mercurial/dirstate.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
139 | 138 | mercurial/discovery.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
140 | 139 | mercurial/dispatch.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
141 | 140 | mercurial/exchange.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob) |
|
142 | 141 | mercurial/extensions.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
143 | 142 | mercurial/filelog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
144 | 143 | mercurial/filemerge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
145 | 144 | mercurial/fileset.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
146 | 145 | mercurial/formatter.py: error importing module: <ImportError> No module named 'cPickle' (line *) (glob) |
|
147 | 146 | mercurial/graphmod.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
148 | 147 | mercurial/help.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
149 | 148 | mercurial/hg.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at bundlerepo.py:*) (glob) |
|
150 | 149 | mercurial/hgweb/common.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob) |
|
151 | 150 | mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
152 | 151 | mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
153 | 152 | mercurial/hgweb/protocol.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
154 | 153 | mercurial/hgweb/request.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
155 | 154 | mercurial/hgweb/server.py: error importing module: <ImportError> No module named 'BaseHTTPServer' (line *) (glob) |
|
156 | 155 | mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
157 | 156 | mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
158 | 157 | mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob) |
|
159 | 158 | mercurial/hook.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
160 | 159 | mercurial/httpclient/_readers.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob) |
|
161 | 160 | mercurial/httpconnection.py: error importing: <ImportError> No module named 'httplib' (error at __init__.py:*) (glob) |
|
162 | 161 | mercurial/httppeer.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob) |
|
163 | 162 | mercurial/keepalive.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob) |
|
164 | 163 | mercurial/localrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
165 | 164 | mercurial/mail.py: error importing module: <AttributeError> module 'email' has no attribute 'Header' (line *) (glob) |
|
166 | 165 | mercurial/manifest.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
167 | 166 | mercurial/merge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
168 | 167 | mercurial/namespaces.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
169 | 168 | mercurial/patch.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
170 | 169 | mercurial/pure/mpatch.py: error importing module: <ImportError> cannot import name 'pycompat' (line *) (glob) |
|
171 | 170 | mercurial/pure/parsers.py: error importing module: <ImportError> No module named 'mercurial.pure.node' (line *) (glob) |
|
172 | 171 | mercurial/repair.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob) |
|
173 | 172 | mercurial/revlog.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
174 | 173 | mercurial/revset.py: error importing module: <AttributeError> 'dict' object has no attribute 'iteritems' (line *) (glob) |
|
175 | 174 | mercurial/scmutil.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
176 | 175 | mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob) |
|
177 | 176 | mercurial/simplemerge.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
178 | 177 | mercurial/sshpeer.py: error importing: <SyntaxError> invalid syntax (bundle*.py, line *) (error at wireproto.py:*) (glob) |
|
179 | 178 | mercurial/sshserver.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
180 | 179 | mercurial/statichttprepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
181 | 180 | mercurial/store.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
182 | 181 | mercurial/streamclone.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
183 | 182 | mercurial/subrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
184 | 183 | mercurial/templatefilters.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
185 | 184 | mercurial/templatekw.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
186 | 185 | mercurial/templater.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
187 | 186 | mercurial/ui.py: error importing: <ImportError> No module named 'cPickle' (error at formatter.py:*) (glob) |
|
188 | 187 | mercurial/unionrepo.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
189 | 188 | mercurial/url.py: error importing module: <ImportError> No module named 'httplib' (line *) (glob) |
|
190 | 189 | mercurial/verify.py: error importing: <AttributeError> 'dict' object has no attribute 'iteritems' (error at revset.py:*) (glob) |
|
191 | 190 | mercurial/win*.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob) |
|
192 | 191 | mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob) |
|
193 | 192 | mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob) |
|
194 | 193 | tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
195 | 194 | tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
196 | 195 | tests/test-lrucachedict.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
197 | 196 | tests/test-trusted.py: invalid syntax: invalid syntax (<unknown>, line *) (glob) |
|
198 | 197 | |
|
199 | 198 | #endif |
@@ -1,468 +1,471 b'' | |||
|
1 | import binascii | |
|
2 | import unittest | |
|
3 | import itertools | |
|
1 | from __future__ import absolute_import | |
|
4 | 2 | |
|
3 | import binascii | |
|
4 | import itertools | |
|
5 | 5 | import silenttestrunner |
|
6 | import unittest | |
|
6 | 7 | |
|
7 |
from mercurial import |
|
|
8 | from mercurial import match as matchmod | |
|
8 | from mercurial import ( | |
|
9 | manifest as manifestmod, | |
|
10 | match as matchmod, | |
|
11 | ) | |
|
9 | 12 | |
|
10 | 13 | EMTPY_MANIFEST = '' |
|
11 | 14 | EMTPY_MANIFEST_V2 = '\0\n' |
|
12 | 15 | |
|
13 | 16 | HASH_1 = '1' * 40 |
|
14 | 17 | BIN_HASH_1 = binascii.unhexlify(HASH_1) |
|
15 | 18 | HASH_2 = 'f' * 40 |
|
16 | 19 | BIN_HASH_2 = binascii.unhexlify(HASH_2) |
|
17 | 20 | HASH_3 = '1234567890abcdef0987654321deadbeef0fcafe' |
|
18 | 21 | BIN_HASH_3 = binascii.unhexlify(HASH_3) |
|
19 | 22 | A_SHORT_MANIFEST = ( |
|
20 | 23 | 'bar/baz/qux.py\0%(hash2)s%(flag2)s\n' |
|
21 | 24 | 'foo\0%(hash1)s%(flag1)s\n' |
|
22 | 25 | ) % {'hash1': HASH_1, |
|
23 | 26 | 'flag1': '', |
|
24 | 27 | 'hash2': HASH_2, |
|
25 | 28 | 'flag2': 'l', |
|
26 | 29 | } |
|
27 | 30 | |
|
28 | 31 | # Same data as A_SHORT_MANIFEST |
|
29 | 32 | A_SHORT_MANIFEST_V2 = ( |
|
30 | 33 | '\0\n' |
|
31 | 34 | '\x00bar/baz/qux.py\0%(flag2)s\n%(hash2)s\n' |
|
32 | 35 | '\x00foo\0%(flag1)s\n%(hash1)s\n' |
|
33 | 36 | ) % {'hash1': BIN_HASH_1, |
|
34 | 37 | 'flag1': '', |
|
35 | 38 | 'hash2': BIN_HASH_2, |
|
36 | 39 | 'flag2': 'l', |
|
37 | 40 | } |
|
38 | 41 | |
|
39 | 42 | # Same data as A_SHORT_MANIFEST |
|
40 | 43 | A_METADATA_MANIFEST = ( |
|
41 | 44 | '\0foo\0bar\n' |
|
42 | 45 | '\x00bar/baz/qux.py\0%(flag2)s\0foo\0bar\n%(hash2)s\n' # flag and metadata |
|
43 | 46 | '\x00foo\0%(flag1)s\0foo\n%(hash1)s\n' # no flag, but metadata |
|
44 | 47 | ) % {'hash1': BIN_HASH_1, |
|
45 | 48 | 'flag1': '', |
|
46 | 49 | 'hash2': BIN_HASH_2, |
|
47 | 50 | 'flag2': 'l', |
|
48 | 51 | } |
|
49 | 52 | |
|
50 | 53 | A_STEM_COMPRESSED_MANIFEST = ( |
|
51 | 54 | '\0\n' |
|
52 | 55 | '\x00bar/baz/qux.py\0%(flag2)s\n%(hash2)s\n' |
|
53 | 56 | '\x04qux/foo.py\0%(flag1)s\n%(hash1)s\n' # simple case of 4 stem chars |
|
54 | 57 | '\x0az.py\0%(flag1)s\n%(hash1)s\n' # tricky newline = 10 stem characters |
|
55 | 58 | '\x00%(verylongdir)sx/x\0\n%(hash1)s\n' |
|
56 | 59 | '\xffx/y\0\n%(hash2)s\n' # more than 255 stem chars |
|
57 | 60 | ) % {'hash1': BIN_HASH_1, |
|
58 | 61 | 'flag1': '', |
|
59 | 62 | 'hash2': BIN_HASH_2, |
|
60 | 63 | 'flag2': 'l', |
|
61 | 64 | 'verylongdir': 255 * 'x', |
|
62 | 65 | } |
|
63 | 66 | |
|
64 | 67 | A_DEEPER_MANIFEST = ( |
|
65 | 68 | 'a/b/c/bar.py\0%(hash3)s%(flag1)s\n' |
|
66 | 69 | 'a/b/c/bar.txt\0%(hash1)s%(flag1)s\n' |
|
67 | 70 | 'a/b/c/foo.py\0%(hash3)s%(flag1)s\n' |
|
68 | 71 | 'a/b/c/foo.txt\0%(hash2)s%(flag2)s\n' |
|
69 | 72 | 'a/b/d/baz.py\0%(hash3)s%(flag1)s\n' |
|
70 | 73 | 'a/b/d/qux.py\0%(hash1)s%(flag2)s\n' |
|
71 | 74 | 'a/b/d/ten.txt\0%(hash3)s%(flag2)s\n' |
|
72 | 75 | 'a/b/dog.py\0%(hash3)s%(flag1)s\n' |
|
73 | 76 | 'a/b/fish.py\0%(hash2)s%(flag1)s\n' |
|
74 | 77 | 'a/c/london.py\0%(hash3)s%(flag2)s\n' |
|
75 | 78 | 'a/c/paper.txt\0%(hash2)s%(flag2)s\n' |
|
76 | 79 | 'a/c/paris.py\0%(hash2)s%(flag1)s\n' |
|
77 | 80 | 'a/d/apple.py\0%(hash3)s%(flag1)s\n' |
|
78 | 81 | 'a/d/pizza.py\0%(hash3)s%(flag2)s\n' |
|
79 | 82 | 'a/green.py\0%(hash1)s%(flag2)s\n' |
|
80 | 83 | 'a/purple.py\0%(hash2)s%(flag1)s\n' |
|
81 | 84 | 'app.py\0%(hash3)s%(flag1)s\n' |
|
82 | 85 | 'readme.txt\0%(hash2)s%(flag1)s\n' |
|
83 | 86 | ) % {'hash1': HASH_1, |
|
84 | 87 | 'flag1': '', |
|
85 | 88 | 'hash2': HASH_2, |
|
86 | 89 | 'flag2': 'l', |
|
87 | 90 | 'hash3': HASH_3, |
|
88 | 91 | } |
|
89 | 92 | |
|
90 | 93 | HUGE_MANIFEST_ENTRIES = 200001 |
|
91 | 94 | |
|
92 | 95 | A_HUGE_MANIFEST = ''.join(sorted( |
|
93 | 96 | 'file%d\0%s%s\n' % (i, h, f) for i, h, f in |
|
94 | 97 | itertools.izip(xrange(200001), |
|
95 | 98 | itertools.cycle((HASH_1, HASH_2)), |
|
96 | 99 | itertools.cycle(('', 'x', 'l'))))) |
|
97 | 100 | |
|
98 | 101 | class basemanifesttests(object): |
|
99 | 102 | def parsemanifest(self, text): |
|
100 | 103 | raise NotImplementedError('parsemanifest not implemented by test case') |
|
101 | 104 | |
|
102 | 105 | def assertIn(self, thing, container, msg=None): |
|
103 | 106 | # assertIn new in 2.7, use it if available, otherwise polyfill |
|
104 | 107 | sup = getattr(unittest.TestCase, 'assertIn', False) |
|
105 | 108 | if sup: |
|
106 | 109 | return sup(self, thing, container, msg=msg) |
|
107 | 110 | if not msg: |
|
108 | 111 | msg = 'Expected %r in %r' % (thing, container) |
|
109 | 112 | self.assert_(thing in container, msg) |
|
110 | 113 | |
|
111 | 114 | def testEmptyManifest(self): |
|
112 | 115 | m = self.parsemanifest(EMTPY_MANIFEST) |
|
113 | 116 | self.assertEqual(0, len(m)) |
|
114 | 117 | self.assertEqual([], list(m)) |
|
115 | 118 | |
|
116 | 119 | def testEmptyManifestv2(self): |
|
117 | 120 | m = self.parsemanifest(EMTPY_MANIFEST_V2) |
|
118 | 121 | self.assertEqual(0, len(m)) |
|
119 | 122 | self.assertEqual([], list(m)) |
|
120 | 123 | |
|
121 | 124 | def testManifest(self): |
|
122 | 125 | m = self.parsemanifest(A_SHORT_MANIFEST) |
|
123 | 126 | self.assertEqual(['bar/baz/qux.py', 'foo'], list(m)) |
|
124 | 127 | self.assertEqual(BIN_HASH_2, m['bar/baz/qux.py']) |
|
125 | 128 | self.assertEqual('l', m.flags('bar/baz/qux.py')) |
|
126 | 129 | self.assertEqual(BIN_HASH_1, m['foo']) |
|
127 | 130 | self.assertEqual('', m.flags('foo')) |
|
128 | 131 | self.assertRaises(KeyError, lambda : m['wat']) |
|
129 | 132 | |
|
130 | 133 | def testParseManifestV2(self): |
|
131 | 134 | m1 = self.parsemanifest(A_SHORT_MANIFEST) |
|
132 | 135 | m2 = self.parsemanifest(A_SHORT_MANIFEST_V2) |
|
133 | 136 | # Should have same content as A_SHORT_MANIFEST |
|
134 | 137 | self.assertEqual(m1.text(), m2.text()) |
|
135 | 138 | |
|
136 | 139 | def testParseManifestMetadata(self): |
|
137 | 140 | # Metadata is for future-proofing and should be accepted but ignored |
|
138 | 141 | m = self.parsemanifest(A_METADATA_MANIFEST) |
|
139 | 142 | self.assertEqual(A_SHORT_MANIFEST, m.text()) |
|
140 | 143 | |
|
141 | 144 | def testParseManifestStemCompression(self): |
|
142 | 145 | m = self.parsemanifest(A_STEM_COMPRESSED_MANIFEST) |
|
143 | 146 | self.assertIn('bar/baz/qux.py', m) |
|
144 | 147 | self.assertIn('bar/qux/foo.py', m) |
|
145 | 148 | self.assertIn('bar/qux/foz.py', m) |
|
146 | 149 | self.assertIn(256 * 'x' + '/x', m) |
|
147 | 150 | self.assertIn(256 * 'x' + '/y', m) |
|
148 | 151 | self.assertEqual(A_STEM_COMPRESSED_MANIFEST, m.text(usemanifestv2=True)) |
|
149 | 152 | |
|
150 | 153 | def testTextV2(self): |
|
151 | 154 | m1 = self.parsemanifest(A_SHORT_MANIFEST) |
|
152 | 155 | v2text = m1.text(usemanifestv2=True) |
|
153 | 156 | self.assertEqual(A_SHORT_MANIFEST_V2, v2text) |
|
154 | 157 | |
|
155 | 158 | def testSetItem(self): |
|
156 | 159 | want = BIN_HASH_1 |
|
157 | 160 | |
|
158 | 161 | m = self.parsemanifest(EMTPY_MANIFEST) |
|
159 | 162 | m['a'] = want |
|
160 | 163 | self.assertIn('a', m) |
|
161 | 164 | self.assertEqual(want, m['a']) |
|
162 | 165 | self.assertEqual('a\0' + HASH_1 + '\n', m.text()) |
|
163 | 166 | |
|
164 | 167 | m = self.parsemanifest(A_SHORT_MANIFEST) |
|
165 | 168 | m['a'] = want |
|
166 | 169 | self.assertEqual(want, m['a']) |
|
167 | 170 | self.assertEqual('a\0' + HASH_1 + '\n' + A_SHORT_MANIFEST, |
|
168 | 171 | m.text()) |
|
169 | 172 | |
|
170 | 173 | def testSetFlag(self): |
|
171 | 174 | want = 'x' |
|
172 | 175 | |
|
173 | 176 | m = self.parsemanifest(EMTPY_MANIFEST) |
|
174 | 177 | # first add a file; a file-less flag makes no sense |
|
175 | 178 | m['a'] = BIN_HASH_1 |
|
176 | 179 | m.setflag('a', want) |
|
177 | 180 | self.assertEqual(want, m.flags('a')) |
|
178 | 181 | self.assertEqual('a\0' + HASH_1 + want + '\n', m.text()) |
|
179 | 182 | |
|
180 | 183 | m = self.parsemanifest(A_SHORT_MANIFEST) |
|
181 | 184 | # first add a file; a file-less flag makes no sense |
|
182 | 185 | m['a'] = BIN_HASH_1 |
|
183 | 186 | m.setflag('a', want) |
|
184 | 187 | self.assertEqual(want, m.flags('a')) |
|
185 | 188 | self.assertEqual('a\0' + HASH_1 + want + '\n' + A_SHORT_MANIFEST, |
|
186 | 189 | m.text()) |
|
187 | 190 | |
|
188 | 191 | def testCopy(self): |
|
189 | 192 | m = self.parsemanifest(A_SHORT_MANIFEST) |
|
190 | 193 | m['a'] = BIN_HASH_1 |
|
191 | 194 | m2 = m.copy() |
|
192 | 195 | del m |
|
193 | 196 | del m2 # make sure we don't double free() anything |
|
194 | 197 | |
|
195 | 198 | def testCompaction(self): |
|
196 | 199 | unhex = binascii.unhexlify |
|
197 | 200 | h1, h2 = unhex(HASH_1), unhex(HASH_2) |
|
198 | 201 | m = self.parsemanifest(A_SHORT_MANIFEST) |
|
199 | 202 | m['alpha'] = h1 |
|
200 | 203 | m['beta'] = h2 |
|
201 | 204 | del m['foo'] |
|
202 | 205 | want = 'alpha\0%s\nbar/baz/qux.py\0%sl\nbeta\0%s\n' % ( |
|
203 | 206 | HASH_1, HASH_2, HASH_2) |
|
204 | 207 | self.assertEqual(want, m.text()) |
|
205 | 208 | self.assertEqual(3, len(m)) |
|
206 | 209 | self.assertEqual(['alpha', 'bar/baz/qux.py', 'beta'], list(m)) |
|
207 | 210 | self.assertEqual(h1, m['alpha']) |
|
208 | 211 | self.assertEqual(h2, m['bar/baz/qux.py']) |
|
209 | 212 | self.assertEqual(h2, m['beta']) |
|
210 | 213 | self.assertEqual('', m.flags('alpha')) |
|
211 | 214 | self.assertEqual('l', m.flags('bar/baz/qux.py')) |
|
212 | 215 | self.assertEqual('', m.flags('beta')) |
|
213 | 216 | self.assertRaises(KeyError, lambda : m['foo']) |
|
214 | 217 | |
|
215 | 218 | def testSetGetNodeSuffix(self): |
|
216 | 219 | clean = self.parsemanifest(A_SHORT_MANIFEST) |
|
217 | 220 | m = self.parsemanifest(A_SHORT_MANIFEST) |
|
218 | 221 | h = m['foo'] |
|
219 | 222 | f = m.flags('foo') |
|
220 | 223 | want = h + 'a' |
|
221 | 224 | # Merge code wants to set 21-byte fake hashes at times |
|
222 | 225 | m['foo'] = want |
|
223 | 226 | self.assertEqual(want, m['foo']) |
|
224 | 227 | self.assertEqual([('bar/baz/qux.py', BIN_HASH_2), |
|
225 | 228 | ('foo', BIN_HASH_1 + 'a')], |
|
226 | 229 | list(m.iteritems())) |
|
227 | 230 | # Sometimes it even tries a 22-byte fake hash, but we can |
|
228 | 231 | # return 21 and it'll work out |
|
229 | 232 | m['foo'] = want + '+' |
|
230 | 233 | self.assertEqual(want, m['foo']) |
|
231 | 234 | # make sure the suffix survives a copy |
|
232 | 235 | match = matchmod.match('', '', ['re:foo']) |
|
233 | 236 | m2 = m.matches(match) |
|
234 | 237 | self.assertEqual(want, m2['foo']) |
|
235 | 238 | self.assertEqual(1, len(m2)) |
|
236 | 239 | m2 = m.copy() |
|
237 | 240 | self.assertEqual(want, m2['foo']) |
|
238 | 241 | # suffix with iteration |
|
239 | 242 | self.assertEqual([('bar/baz/qux.py', BIN_HASH_2), |
|
240 | 243 | ('foo', want)], |
|
241 | 244 | list(m.iteritems())) |
|
242 | 245 | |
|
243 | 246 | # shows up in diff |
|
244 | 247 | self.assertEqual({'foo': ((want, f), (h, ''))}, m.diff(clean)) |
|
245 | 248 | self.assertEqual({'foo': ((h, ''), (want, f))}, clean.diff(m)) |
|
246 | 249 | |
|
247 | 250 | def testMatchException(self): |
|
248 | 251 | m = self.parsemanifest(A_SHORT_MANIFEST) |
|
249 | 252 | match = matchmod.match('', '', ['re:.*']) |
|
250 | 253 | def filt(path): |
|
251 | 254 | if path == 'foo': |
|
252 | 255 | assert False |
|
253 | 256 | return True |
|
254 | 257 | match.matchfn = filt |
|
255 | 258 | self.assertRaises(AssertionError, m.matches, match) |
|
256 | 259 | |
|
257 | 260 | def testRemoveItem(self): |
|
258 | 261 | m = self.parsemanifest(A_SHORT_MANIFEST) |
|
259 | 262 | del m['foo'] |
|
260 | 263 | self.assertRaises(KeyError, lambda : m['foo']) |
|
261 | 264 | self.assertEqual(1, len(m)) |
|
262 | 265 | self.assertEqual(1, len(list(m))) |
|
263 | 266 | # now restore and make sure everything works right |
|
264 | 267 | m['foo'] = 'a' * 20 |
|
265 | 268 | self.assertEqual(2, len(m)) |
|
266 | 269 | self.assertEqual(2, len(list(m))) |
|
267 | 270 | |
|
268 | 271 | def testManifestDiff(self): |
|
269 | 272 | MISSING = (None, '') |
|
270 | 273 | addl = 'z-only-in-left\0' + HASH_1 + '\n' |
|
271 | 274 | addr = 'z-only-in-right\0' + HASH_2 + 'x\n' |
|
272 | 275 | left = self.parsemanifest( |
|
273 | 276 | A_SHORT_MANIFEST.replace(HASH_1, HASH_3 + 'x') + addl) |
|
274 | 277 | right = self.parsemanifest(A_SHORT_MANIFEST + addr) |
|
275 | 278 | want = { |
|
276 | 279 | 'foo': ((BIN_HASH_3, 'x'), |
|
277 | 280 | (BIN_HASH_1, '')), |
|
278 | 281 | 'z-only-in-left': ((BIN_HASH_1, ''), MISSING), |
|
279 | 282 | 'z-only-in-right': (MISSING, (BIN_HASH_2, 'x')), |
|
280 | 283 | } |
|
281 | 284 | self.assertEqual(want, left.diff(right)) |
|
282 | 285 | |
|
283 | 286 | want = { |
|
284 | 287 | 'bar/baz/qux.py': (MISSING, (BIN_HASH_2, 'l')), |
|
285 | 288 | 'foo': (MISSING, (BIN_HASH_3, 'x')), |
|
286 | 289 | 'z-only-in-left': (MISSING, (BIN_HASH_1, '')), |
|
287 | 290 | } |
|
288 | 291 | self.assertEqual(want, self.parsemanifest(EMTPY_MANIFEST).diff(left)) |
|
289 | 292 | |
|
290 | 293 | want = { |
|
291 | 294 | 'bar/baz/qux.py': ((BIN_HASH_2, 'l'), MISSING), |
|
292 | 295 | 'foo': ((BIN_HASH_3, 'x'), MISSING), |
|
293 | 296 | 'z-only-in-left': ((BIN_HASH_1, ''), MISSING), |
|
294 | 297 | } |
|
295 | 298 | self.assertEqual(want, left.diff(self.parsemanifest(EMTPY_MANIFEST))) |
|
296 | 299 | copy = right.copy() |
|
297 | 300 | del copy['z-only-in-right'] |
|
298 | 301 | del right['foo'] |
|
299 | 302 | want = { |
|
300 | 303 | 'foo': (MISSING, (BIN_HASH_1, '')), |
|
301 | 304 | 'z-only-in-right': ((BIN_HASH_2, 'x'), MISSING), |
|
302 | 305 | } |
|
303 | 306 | self.assertEqual(want, right.diff(copy)) |
|
304 | 307 | |
|
305 | 308 | short = self.parsemanifest(A_SHORT_MANIFEST) |
|
306 | 309 | pruned = short.copy() |
|
307 | 310 | del pruned['foo'] |
|
308 | 311 | want = { |
|
309 | 312 | 'foo': ((BIN_HASH_1, ''), MISSING), |
|
310 | 313 | } |
|
311 | 314 | self.assertEqual(want, short.diff(pruned)) |
|
312 | 315 | want = { |
|
313 | 316 | 'foo': (MISSING, (BIN_HASH_1, '')), |
|
314 | 317 | } |
|
315 | 318 | self.assertEqual(want, pruned.diff(short)) |
|
316 | 319 | want = { |
|
317 | 320 | 'bar/baz/qux.py': None, |
|
318 | 321 | 'foo': (MISSING, (BIN_HASH_1, '')), |
|
319 | 322 | } |
|
320 | 323 | self.assertEqual(want, pruned.diff(short, True)) |
|
321 | 324 | |
|
322 | 325 | def testReversedLines(self): |
|
323 | 326 | backwards = ''.join( |
|
324 | 327 | l + '\n' for l in reversed(A_SHORT_MANIFEST.split('\n')) if l) |
|
325 | 328 | try: |
|
326 | 329 | self.parsemanifest(backwards) |
|
327 | 330 | self.fail('Should have raised ValueError') |
|
328 | 331 | except ValueError as v: |
|
329 | 332 | self.assertIn('Manifest lines not in sorted order.', str(v)) |
|
330 | 333 | |
|
331 | 334 | def testNoTerminalNewline(self): |
|
332 | 335 | try: |
|
333 | 336 | self.parsemanifest(A_SHORT_MANIFEST + 'wat') |
|
334 | 337 | self.fail('Should have raised ValueError') |
|
335 | 338 | except ValueError as v: |
|
336 | 339 | self.assertIn('Manifest did not end in a newline.', str(v)) |
|
337 | 340 | |
|
338 | 341 | def testNoNewLineAtAll(self): |
|
339 | 342 | try: |
|
340 | 343 | self.parsemanifest('wat') |
|
341 | 344 | self.fail('Should have raised ValueError') |
|
342 | 345 | except ValueError as v: |
|
343 | 346 | self.assertIn('Manifest did not end in a newline.', str(v)) |
|
344 | 347 | |
|
345 | 348 | def testHugeManifest(self): |
|
346 | 349 | m = self.parsemanifest(A_HUGE_MANIFEST) |
|
347 | 350 | self.assertEqual(HUGE_MANIFEST_ENTRIES, len(m)) |
|
348 | 351 | self.assertEqual(len(m), len(list(m))) |
|
349 | 352 | |
|
350 | 353 | def testMatchesMetadata(self): |
|
351 | 354 | '''Tests matches() for a few specific files to make sure that both |
|
352 | 355 | the set of files as well as their flags and nodeids are correct in |
|
353 | 356 | the resulting manifest.''' |
|
354 | 357 | m = self.parsemanifest(A_HUGE_MANIFEST) |
|
355 | 358 | |
|
356 | 359 | match = matchmod.match('/', '', |
|
357 | 360 | ['file1', 'file200', 'file300'], exact=True) |
|
358 | 361 | m2 = m.matches(match) |
|
359 | 362 | |
|
360 | 363 | w = ('file1\0%sx\n' |
|
361 | 364 | 'file200\0%sl\n' |
|
362 | 365 | 'file300\0%s\n') % (HASH_2, HASH_1, HASH_1) |
|
363 | 366 | self.assertEqual(w, m2.text()) |
|
364 | 367 | |
|
365 | 368 | def testMatchesNonexistentFile(self): |
|
366 | 369 | '''Tests matches() for a small set of specific files, including one |
|
367 | 370 | nonexistent file to make sure in only matches against existing files. |
|
368 | 371 | ''' |
|
369 | 372 | m = self.parsemanifest(A_DEEPER_MANIFEST) |
|
370 | 373 | |
|
371 | 374 | match = matchmod.match('/', '', |
|
372 | 375 | ['a/b/c/bar.txt', 'a/b/d/qux.py', 'readme.txt', 'nonexistent'], |
|
373 | 376 | exact=True) |
|
374 | 377 | m2 = m.matches(match) |
|
375 | 378 | |
|
376 | 379 | self.assertEqual( |
|
377 | 380 | ['a/b/c/bar.txt', 'a/b/d/qux.py', 'readme.txt'], |
|
378 | 381 | m2.keys()) |
|
379 | 382 | |
|
380 | 383 | def testMatchesNonexistentDirectory(self): |
|
381 | 384 | '''Tests matches() for a relpath match on a directory that doesn't |
|
382 | 385 | actually exist.''' |
|
383 | 386 | m = self.parsemanifest(A_DEEPER_MANIFEST) |
|
384 | 387 | |
|
385 | 388 | match = matchmod.match('/', '', ['a/f'], default='relpath') |
|
386 | 389 | m2 = m.matches(match) |
|
387 | 390 | |
|
388 | 391 | self.assertEqual([], m2.keys()) |
|
389 | 392 | |
|
390 | 393 | def testMatchesExactLarge(self): |
|
391 | 394 | '''Tests matches() for files matching a large list of exact files. |
|
392 | 395 | ''' |
|
393 | 396 | m = self.parsemanifest(A_HUGE_MANIFEST) |
|
394 | 397 | |
|
395 | 398 | flist = m.keys()[80:300] |
|
396 | 399 | match = matchmod.match('/', '', flist, exact=True) |
|
397 | 400 | m2 = m.matches(match) |
|
398 | 401 | |
|
399 | 402 | self.assertEqual(flist, m2.keys()) |
|
400 | 403 | |
|
401 | 404 | def testMatchesFull(self): |
|
402 | 405 | '''Tests matches() for what should be a full match.''' |
|
403 | 406 | m = self.parsemanifest(A_DEEPER_MANIFEST) |
|
404 | 407 | |
|
405 | 408 | match = matchmod.match('/', '', ['']) |
|
406 | 409 | m2 = m.matches(match) |
|
407 | 410 | |
|
408 | 411 | self.assertEqual(m.keys(), m2.keys()) |
|
409 | 412 | |
|
410 | 413 | def testMatchesDirectory(self): |
|
411 | 414 | '''Tests matches() on a relpath match on a directory, which should |
|
412 | 415 | match against all files within said directory.''' |
|
413 | 416 | m = self.parsemanifest(A_DEEPER_MANIFEST) |
|
414 | 417 | |
|
415 | 418 | match = matchmod.match('/', '', ['a/b'], default='relpath') |
|
416 | 419 | m2 = m.matches(match) |
|
417 | 420 | |
|
418 | 421 | self.assertEqual([ |
|
419 | 422 | 'a/b/c/bar.py', 'a/b/c/bar.txt', 'a/b/c/foo.py', 'a/b/c/foo.txt', |
|
420 | 423 | 'a/b/d/baz.py', 'a/b/d/qux.py', 'a/b/d/ten.txt', 'a/b/dog.py', |
|
421 | 424 | 'a/b/fish.py'], m2.keys()) |
|
422 | 425 | |
|
423 | 426 | def testMatchesExactPath(self): |
|
424 | 427 | '''Tests matches() on an exact match on a directory, which should |
|
425 | 428 | result in an empty manifest because you can't perform an exact match |
|
426 | 429 | against a directory.''' |
|
427 | 430 | m = self.parsemanifest(A_DEEPER_MANIFEST) |
|
428 | 431 | |
|
429 | 432 | match = matchmod.match('/', '', ['a/b'], exact=True) |
|
430 | 433 | m2 = m.matches(match) |
|
431 | 434 | |
|
432 | 435 | self.assertEqual([], m2.keys()) |
|
433 | 436 | |
|
434 | 437 | def testMatchesCwd(self): |
|
435 | 438 | '''Tests matches() on a relpath match with the current directory ('.') |
|
436 | 439 | when not in the root directory.''' |
|
437 | 440 | m = self.parsemanifest(A_DEEPER_MANIFEST) |
|
438 | 441 | |
|
439 | 442 | match = matchmod.match('/', 'a/b', ['.'], default='relpath') |
|
440 | 443 | m2 = m.matches(match) |
|
441 | 444 | |
|
442 | 445 | self.assertEqual([ |
|
443 | 446 | 'a/b/c/bar.py', 'a/b/c/bar.txt', 'a/b/c/foo.py', 'a/b/c/foo.txt', |
|
444 | 447 | 'a/b/d/baz.py', 'a/b/d/qux.py', 'a/b/d/ten.txt', 'a/b/dog.py', |
|
445 | 448 | 'a/b/fish.py'], m2.keys()) |
|
446 | 449 | |
|
447 | 450 | def testMatchesWithPattern(self): |
|
448 | 451 | '''Tests matches() for files matching a pattern that reside |
|
449 | 452 | deeper than the specified directory.''' |
|
450 | 453 | m = self.parsemanifest(A_DEEPER_MANIFEST) |
|
451 | 454 | |
|
452 | 455 | match = matchmod.match('/', '', ['a/b/*/*.txt']) |
|
453 | 456 | m2 = m.matches(match) |
|
454 | 457 | |
|
455 | 458 | self.assertEqual( |
|
456 | 459 | ['a/b/c/bar.txt', 'a/b/c/foo.txt', 'a/b/d/ten.txt'], |
|
457 | 460 | m2.keys()) |
|
458 | 461 | |
|
459 | 462 | class testmanifestdict(unittest.TestCase, basemanifesttests): |
|
460 | 463 | def parsemanifest(self, text): |
|
461 | 464 | return manifestmod.manifestdict(text) |
|
462 | 465 | |
|
463 | 466 | class testtreemanifest(unittest.TestCase, basemanifesttests): |
|
464 | 467 | def parsemanifest(self, text): |
|
465 | 468 | return manifestmod.treemanifest('', text) |
|
466 | 469 | |
|
467 | 470 | if __name__ == '__main__': |
|
468 | 471 | silenttestrunner.main(__name__) |
General Comments 0
You need to be logged in to leave comments.
Login now