##// END OF EJS Templates
py3: lexicographical order imports and print_function in test-context.py
Robert Stanca -
r28738:706f4ab7 default
parent child Browse files
Show More
@@ -53,7 +53,6 b''
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-context.py requires print_function
57 tests/test-demandimport.py not using absolute_import
56 tests/test-demandimport.py not using absolute_import
58 tests/test-demandimport.py requires print_function
57 tests/test-demandimport.py requires print_function
59 tests/test-doctest.py not using absolute_import
58 tests/test-doctest.py not using absolute_import
@@ -248,7 +247,6 b''
248 mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
247 mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
249 mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
248 mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle*.py, line *) (line *) (glob)
250 tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
249 tests/readlink.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
251 tests/test-context.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
252 tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
250 tests/test-demandimport.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
253 tests/test-duplicateoptions.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
251 tests/test-duplicateoptions.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
254 tests/test-filecache.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
252 tests/test-filecache.py: invalid syntax: Missing parentheses in call to 'print' (<unknown>, line *) (glob)
@@ -1,10 +1,10 b''
1 from __future__ import absolute_import
1 from __future__ import absolute_import, print_function
2 import os
2 import os
3 from mercurial import (
3 from mercurial import (
4 context,
5 encoding,
4 hg,
6 hg,
5 ui,
7 ui,
6 context,
7 encoding,
8 )
8 )
9
9
10 u = ui.ui()
10 u = ui.ui()
@@ -24,9 +24,9 b' repo.commit(text=\'commit1\', date="0 0")'
24
24
25 if os.name == 'nt':
25 if os.name == 'nt':
26 d = repo[None]['foo'].date()
26 d = repo[None]['foo'].date()
27 print "workingfilectx.date = (%d, %d)" % (d[0], d[1])
27 print("workingfilectx.date = (%d, %d)" % (d[0], d[1]))
28 else:
28 else:
29 print "workingfilectx.date =", repo[None]['foo'].date()
29 print("workingfilectx.date =", repo[None]['foo'].date())
30
30
31 # test memctx with non-ASCII commit message
31 # test memctx with non-ASCII commit message
32
32
@@ -39,7 +39,7 b" ctx = context.memctx(repo, ['tip', None]"
39 ctx.commit()
39 ctx.commit()
40 for enc in "ASCII", "Latin-1", "UTF-8":
40 for enc in "ASCII", "Latin-1", "UTF-8":
41 encoding.encoding = enc
41 encoding.encoding = enc
42 print "%-8s: %s" % (enc, repo["tip"].description())
42 print("%-8s: %s" % (enc, repo["tip"].description()))
43
43
44 # test performing a status
44 # test performing a status
45
45
@@ -54,15 +54,15 b' ctxa = repo.changectx(0)'
54 ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"],
54 ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"],
55 getfilectx, ctxa.user(), ctxa.date())
55 getfilectx, ctxa.user(), ctxa.date())
56
56
57 print ctxb.status(ctxa)
57 print(ctxb.status(ctxa))
58
58
59 # test performing a diff on a memctx
59 # test performing a diff on a memctx
60
60
61 for d in ctxb.diff(ctxa, git=True):
61 for d in ctxb.diff(ctxa, git=True):
62 print d
62 print(d)
63
63
64 # test safeness and correctness of "ctx.status()"
64 # test safeness and correctness of "ctx.status()"
65 print '= checking context.status():'
65 print('= checking context.status():')
66
66
67 # ancestor "wcctx ~ 2"
67 # ancestor "wcctx ~ 2"
68 actx2 = repo['.']
68 actx2 = repo['.']
@@ -88,26 +88,26 b" repo[None].forget(['bar-r'])"
88
88
89 from mercurial import scmutil
89 from mercurial import scmutil
90
90
91 print '== checking workingctx.status:'
91 print('== checking workingctx.status:')
92
92
93 wctx = repo[None]
93 wctx = repo[None]
94 print 'wctx._status=%s' % (str(wctx._status))
94 print('wctx._status=%s' % (str(wctx._status)))
95
95
96 print '=== with "pattern match":'
96 print('=== with "pattern match":')
97 print actx1.status(other=wctx,
97 print(actx1.status(other=wctx,
98 match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
98 match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))
99 print 'wctx._status=%s' % (str(wctx._status))
99 print('wctx._status=%s' % (str(wctx._status)))
100 print actx2.status(other=wctx,
100 print(actx2.status(other=wctx,
101 match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
101 match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))
102 print 'wctx._status=%s' % (str(wctx._status))
102 print('wctx._status=%s' % (str(wctx._status)))
103
103
104 print '=== with "always match" and "listclean=True":'
104 print('=== with "always match" and "listclean=True":')
105 print actx1.status(other=wctx, listclean=True)
105 print(actx1.status(other=wctx, listclean=True))
106 print 'wctx._status=%s' % (str(wctx._status))
106 print('wctx._status=%s' % (str(wctx._status)))
107 print actx2.status(other=wctx, listclean=True)
107 print(actx2.status(other=wctx, listclean=True))
108 print 'wctx._status=%s' % (str(wctx._status))
108 print('wctx._status=%s' % (str(wctx._status)))
109
109
110 print "== checking workingcommitctx.status:"
110 print("== checking workingcommitctx.status:")
111
111
112 wcctx = context.workingcommitctx(repo,
112 wcctx = context.workingcommitctx(repo,
113 scmutil.status(['bar-m'],
113 scmutil.status(['bar-m'],
@@ -115,34 +115,34 b' wcctx = context.workingcommitctx(repo,'
115 [],
115 [],
116 [], [], [], []),
116 [], [], [], []),
117 text='', date='0 0')
117 text='', date='0 0')
118 print 'wcctx._status=%s' % (str(wcctx._status))
118 print('wcctx._status=%s' % (str(wcctx._status)))
119
119
120 print '=== with "always match":'
120 print('=== with "always match":')
121 print actx1.status(other=wcctx)
121 print(actx1.status(other=wcctx))
122 print 'wcctx._status=%s' % (str(wcctx._status))
122 print('wcctx._status=%s' % (str(wcctx._status)))
123 print actx2.status(other=wcctx)
123 print(actx2.status(other=wcctx))
124 print 'wcctx._status=%s' % (str(wcctx._status))
124 print('wcctx._status=%s' % (str(wcctx._status)))
125
125
126 print '=== with "always match" and "listclean=True":'
126 print('=== with "always match" and "listclean=True":')
127 print actx1.status(other=wcctx, listclean=True)
127 print(actx1.status(other=wcctx, listclean=True))
128 print 'wcctx._status=%s' % (str(wcctx._status))
128 print('wcctx._status=%s' % (str(wcctx._status)))
129 print actx2.status(other=wcctx, listclean=True)
129 print(actx2.status(other=wcctx, listclean=True))
130 print 'wcctx._status=%s' % (str(wcctx._status))
130 print('wcctx._status=%s' % (str(wcctx._status)))
131
131
132 print '=== with "pattern match":'
132 print('=== with "pattern match":')
133 print actx1.status(other=wcctx,
133 print(actx1.status(other=wcctx,
134 match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
134 match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))
135 print 'wcctx._status=%s' % (str(wcctx._status))
135 print('wcctx._status=%s' % (str(wcctx._status)))
136 print actx2.status(other=wcctx,
136 print(actx2.status(other=wcctx,
137 match=scmutil.matchfiles(repo, ['bar-m', 'foo']))
137 match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))
138 print 'wcctx._status=%s' % (str(wcctx._status))
138 print('wcctx._status=%s' % (str(wcctx._status)))
139
139
140 print '=== with "pattern match" and "listclean=True":'
140 print('=== with "pattern match" and "listclean=True":')
141 print actx1.status(other=wcctx,
141 print(actx1.status(other=wcctx,
142 match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
142 match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
143 listclean=True)
143 listclean=True))
144 print 'wcctx._status=%s' % (str(wcctx._status))
144 print('wcctx._status=%s' % (str(wcctx._status)))
145 print actx2.status(other=wcctx,
145 print(actx2.status(other=wcctx,
146 match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
146 match=scmutil.matchfiles(repo, ['bar-r', 'foo']),
147 listclean=True)
147 listclean=True))
148 print 'wcctx._status=%s' % (str(wcctx._status))
148 print('wcctx._status=%s' % (str(wcctx._status)))
General Comments 0
You need to be logged in to leave comments. Login now