<div dir="ltr"># HG changeset patch<br># User Robert Stanca <<a href="mailto:robert.stanca7@gmail.com">robert.stanca7@gmail.com</a>><br># Date 1458904536 -7200<br>#      Fri Mar 25 13:15:36 2016 +0200<br># Node ID 916d835bb60d537d47ebc6fb24b7abc20a628d42<br># Parent  537c362a11af6ddaf33299c0585e94a0235ac6bb<br>multiple: use absolute_import , print_function<br><br>diff -r 537c362a11af -r 916d835bb60d tests/test-batching.py<br>--- a/tests/test-batching.py    Fri Mar 25 07:27:19 2016 +0200<br>+++ b/tests/test-batching.py    Fri Mar 25 13:15:36 2016 +0200<br>@@ -5,8 +5,16 @@<br> # This software may be used and distributed according to the terms of the<br> # GNU General Public License version 2 or any later version.<br> <br>-from mercurial.peer import localbatch, batchable, future<br>-from mercurial.wireproto import remotebatch<br>+from __future__ import absolute_import, print_function<br>+from mercurial.peer import (<br>+    localbatch,<br>+    batchable,<br>+    future,<br>+)<br>+<br>+from mercurial.wireproto import (<br>+    remotebatch,<br>+)<br> <br> # equivalent of repo.repository<br> class thing(object):<br>@@ -31,11 +39,11 @@<br> def use(it):<br> <br>     # Direct call to base method shared between client and server.<br>-    print it.hello()<br>+    print (it.hello())<br> <br>     # Direct calls to proxied methods. They cause individual roundtrips.<br>-    print it.foo("Un", two="Deux")<br>-    print it.bar("Eins", "Zwei")<br>+    print (it.foo("Un", two="Deux"))<br>+    print (it.bar("Eins", "Zwei"))<br> <br>     # Batched call to a couple of (possibly proxied) methods.<br>     batch = it.batch()<br>@@ -53,17 +61,17 @@<br>     # as possible.<br>     batch.submit()<br>     # After the call to submit, the futures actually contain values.<br>-    print foo.value<br>-    print foo2.value<br>-    print bar.value<br>-    print greet.value<br>-    print hello.value<br>-    print bar2.value<br>+    print (foo.value)<br>+    print (foo2.value)<br>+    print (bar.value)<br>+    print (greet.value)<br>+    print (hello.value)<br>+    print (bar2.value)<br> <br> # local usage<br> mylocal = localthing()<br>-print<br>-print "== Local"<br>+print ()<br>+print ("== Local")<br> use(mylocal)<br> <br> # demo remoting; mimicks what wireproto and HTTP/SSH do<br>@@ -93,12 +101,12 @@<br>         args = dict(arg.split('=', 1) for arg in args)<br>         return getattr(self, name)(**args)<br>     def perform(self, req):<br>-        print "REQ:", req<br>+        print ("REQ:", req)<br>         name, args = req.split('?', 1)<br>         args = args.split('&')<br>         vals = dict(arg.split('=', 1) for arg in args)<br>         res = getattr(self, name)(**vals)<br>-        print "  ->", res<br>+        print ("  ->", res)<br>         return res<br>     def batch(self, cmds):<br>         res = []<br>@@ -171,6 +179,6 @@<br> # demo remote usage<br> <br> myproxy = remotething(myserver)<br>-print<br>-print "== Remote"<br>+print ()<br>+print ("== Remote")<br> use(myproxy)<br>diff -r 537c362a11af -r 916d835bb60d tests/test-check-py3-compat.t<br>--- a/tests/test-check-py3-compat.t    Fri Mar 25 07:27:19 2016 +0200<br>+++ b/tests/test-check-py3-compat.t    Fri Mar 25 13:15:36 2016 +0200<br>@@ -52,12 +52,6 @@<br>   tests/svn-safe-append.py not using absolute_import<br>   tests/svnxml.py not using absolute_import<br>   tests/test-atomictempfile.py not using absolute_import<br>-  tests/test-batching.py not using absolute_import<br>-  tests/test-batching.py requires print_function<br>-  tests/test-context.py not using absolute_import<br>-  tests/test-context.py requires print_function<br>-  tests/test-demandimport.py not using absolute_import<br>-  tests/test-demandimport.py requires print_function<br>   tests/test-doctest.py not using absolute_import<br>   tests/test-duplicateoptions.py not using absolute_import<br>   tests/test-duplicateoptions.py requires print_function<br>diff -r 537c362a11af -r 916d835bb60d tests/test-context.py<br>--- a/tests/test-context.py    Fri Mar 25 07:27:19 2016 +0200<br>+++ b/tests/test-context.py    Fri Mar 25 13:15:36 2016 +0200<br>@@ -1,5 +1,11 @@<br>+from __future__ import absolute_import, print_function<br> import os<br>-from mercurial import hg, ui, context, encoding<br>+from mercurial import (<br>+        hg,<br>+        ui,<br>+        context,<br>+        encoding,<br>+)<br> <br> u = ui.ui()<br> <br>@@ -18,9 +24,9 @@<br> <br> if <a href="http://os.name">os.name</a> == 'nt':<br>     d = repo[None]['foo'].date()<br>-    print "workingfilectx.date = (%d, %d)" % (d[0], d[1])<br>+    print ("workingfilectx.date = (%d, %d)" % (d[0], d[1]))<br> else:<br>-    print "workingfilectx.date =", repo[None]['foo'].date()<br>+    print ("workingfilectx.date =", repo[None]['foo'].date())<br> <br> # test memctx with non-ASCII commit message<br> <br>@@ -33,7 +39,7 @@<br> ctx.commit()<br> for enc in "ASCII", "Latin-1", "UTF-8":<br>     encoding.encoding = enc<br>-    print "%-8s: %s" % (enc, repo["tip"].description())<br>+    print ("%-8s: %s" % (enc, repo["tip"].description()))<br> <br> # test performing a status<br> <br>@@ -48,15 +54,15 @@<br> ctxb = context.memctx(repo, [ctxa.node(), None], "test diff", ["foo"],<br>                       getfilectx, ctxa.user(), ctxa.date())<br> <br>-print ctxb.status(ctxa)<br>+print (ctxb.status(ctxa))<br> <br> # test performing a diff on a memctx<br> <br> for d in ctxb.diff(ctxa, git=True):<br>-    print d<br>+    print (d)<br> <br> # test safeness and correctness of "ctx.status()"<br>-print '= checking context.status():'<br>+print ('= checking context.status():')<br> <br> # ancestor "wcctx ~ 2"<br> actx2 = repo['.']<br>@@ -82,26 +88,26 @@<br> <br> from mercurial import scmutil<br> <br>-print '== checking workingctx.status:'<br>+print ('== checking workingctx.status:')<br> <br> wctx = repo[None]<br>-print 'wctx._status=%s' % (str(wctx._status))<br>+print ('wctx._status=%s' % (str(wctx._status)))<br> <br>-print '=== with "pattern match":'<br>-print actx1.status(other=wctx,<br>-                   match=scmutil.matchfiles(repo, ['bar-m', 'foo']))<br>-print 'wctx._status=%s' % (str(wctx._status))<br>-print actx2.status(other=wctx,<br>-                   match=scmutil.matchfiles(repo, ['bar-m', 'foo']))<br>-print 'wctx._status=%s' % (str(wctx._status))<br>+print ('=== with "pattern match":')<br>+print (actx1.status(other=wctx,<br>+                   match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))<br>+print ('wctx._status=%s' % (str(wctx._status)))<br>+print (actx2.status(other=wctx,<br>+                   match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))<br>+print ('wctx._status=%s' % (str(wctx._status)))<br> <br>-print '=== with "always match" and "listclean=True":'<br>-print actx1.status(other=wctx, listclean=True)<br>-print 'wctx._status=%s' % (str(wctx._status))<br>-print actx2.status(other=wctx, listclean=True)<br>-print 'wctx._status=%s' % (str(wctx._status))<br>+print ('=== with "always match" and "listclean=True":')<br>+print (actx1.status(other=wctx, listclean=True))<br>+print ('wctx._status=%s' % (str(wctx._status)))<br>+print (actx2.status(other=wctx, listclean=True))<br>+print ('wctx._status=%s' % (str(wctx._status)))<br> <br>-print "== checking workingcommitctx.status:"<br>+print ("== checking workingcommitctx.status:")<br> <br> wcctx = context.workingcommitctx(repo,<br>                                  scmutil.status(['bar-m'],<br>@@ -109,34 +115,34 @@<br>                                                 [],<br>                                                 [], [], [], []),<br>                                  text='', date='0 0')<br>-print 'wcctx._status=%s' % (str(wcctx._status))<br>+print ('wcctx._status=%s' % (str(wcctx._status)))<br> <br>-print '=== with "always match":'<br>-print actx1.status(other=wcctx)<br>-print 'wcctx._status=%s' % (str(wcctx._status))<br>-print actx2.status(other=wcctx)<br>-print 'wcctx._status=%s' % (str(wcctx._status))<br>+print ('=== with "always match":')<br>+print (actx1.status(other=wcctx))<br>+print ('wcctx._status=%s' % (str(wcctx._status)))<br>+print (actx2.status(other=wcctx))<br>+print ('wcctx._status=%s' % (str(wcctx._status)))<br> <br>-print '=== with "always match" and "listclean=True":'<br>-print actx1.status(other=wcctx, listclean=True)<br>-print 'wcctx._status=%s' % (str(wcctx._status))<br>-print actx2.status(other=wcctx, listclean=True)<br>-print 'wcctx._status=%s' % (str(wcctx._status))<br>+print ('=== with "always match" and "listclean=True":')<br>+print (actx1.status(other=wcctx, listclean=True))<br>+print ('wcctx._status=%s' % (str(wcctx._status)))<br>+print (actx2.status(other=wcctx, listclean=True))<br>+print ('wcctx._status=%s' % (str(wcctx._status)))<br> <br>-print '=== with "pattern match":'<br>-print actx1.status(other=wcctx,<br>-                   match=scmutil.matchfiles(repo, ['bar-m', 'foo']))<br>-print 'wcctx._status=%s' % (str(wcctx._status))<br>-print actx2.status(other=wcctx,<br>-                   match=scmutil.matchfiles(repo, ['bar-m', 'foo']))<br>-print 'wcctx._status=%s' % (str(wcctx._status))<br>+print ('=== with "pattern match":')<br>+print (actx1.status(other=wcctx,<br>+                   match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))<br>+print ('wcctx._status=%s' % (str(wcctx._status)))<br>+print (actx2.status(other=wcctx,<br>+                   match=scmutil.matchfiles(repo, ['bar-m', 'foo'])))<br>+print ('wcctx._status=%s' % (str(wcctx._status)))<br> <br>-print '=== with "pattern match" and "listclean=True":'<br>-print actx1.status(other=wcctx,<br>+print ('=== with "pattern match" and "listclean=True":')<br>+print (actx1.status(other=wcctx,<br>                    match=scmutil.matchfiles(repo, ['bar-r', 'foo']),<br>-                   listclean=True)<br>-print 'wcctx._status=%s' % (str(wcctx._status))<br>-print actx2.status(other=wcctx,<br>+                   listclean=True))<br>+print ('wcctx._status=%s' % (str(wcctx._status)))<br>+print (actx2.status(other=wcctx,<br>                    match=scmutil.matchfiles(repo, ['bar-r', 'foo']),<br>-                   listclean=True)<br>-print 'wcctx._status=%s' % (str(wcctx._status))<br>+                   listclean=True))<br>+print ('wcctx._status=%s' % (str(wcctx._status)))<br>diff -r 537c362a11af -r 916d835bb60d tests/test-demandimport.py<br>--- a/tests/test-demandimport.py    Fri Mar 25 07:27:19 2016 +0200<br>+++ b/tests/test-demandimport.py    Fri Mar 25 13:15:36 2016 +0200<br>@@ -1,4 +1,7 @@<br>-from mercurial import demandimport<br>+from __future__ import absolute_import, print_function<br>+from mercurial import (<br>+    demandimport,<br>+)<br> demandimport.enable()<br> <br> import os<br>@@ -23,38 +26,38 @@<br> <br> import os<br> <br>-print "os =", f(os)<br>-print "os.system =", f(os.system)<br>-print "os =", f(os)<br>+print ("os =", f(os))<br>+print ("os.system =", f(os.system))<br>+print ("os =", f(os))<br> <br> from mercurial import util<br> <br>-print "util =", f(util)<br>-print "util.system =", f(util.system)<br>-print "util =", f(util)<br>-print "util.system =", f(util.system)<br>+print ("util =", f(util))<br>+print ("util.system =", f(util.system))<br>+print ("util =", f(util))<br>+print ("util.system =", f(util.system))<br> <br> from mercurial import hgweb<br>-print "hgweb =", f(hgweb)<br>-print "hgweb_mod =", f(hgweb.hgweb_mod)<br>-print "hgweb =", f(hgweb)<br>+print ("hgweb =", f(hgweb))<br>+print ("hgweb_mod =", f(hgweb.hgweb_mod))<br>+print ("hgweb =", f(hgweb))<br> <br> import re as fred<br>-print "fred =", f(fred)<br>+print ("fred =", f(fred))<br> <br> import sys as re<br>-print "re =", f(re)<br>+print ("re =", f(re))<br> <br>-print "fred =", f(fred)<br>-print "fred.sub =", f(fred.sub)<br>-print "fred =", f(fred)<br>+print ("fred =", f(fred))<br>+print ("fred.sub =", f(fred.sub))<br>+print ("fred =", f(fred))<br> <br>-print "re =", f(re)<br>-print "re.stderr =", f(re.stderr)<br>-print "re =", f(re)<br>+print ("re =", f(re))<br>+print ("re.stderr =", f(re.stderr))<br>+print ("re =", f(re))<br> <br> demandimport.disable()<br> os.environ['HGDEMANDIMPORT'] = 'disable'<br> demandimport.enable()<br> from mercurial import node<br>-print "node =", f(node)<br>+print ("node =", f(node))<br></div>