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