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