for calls expecting bool args, pass bool instead of int
authorNicolas Dumazet <nicdumz.commits@gmail.com>
Mon, 13 Jul 2009 09:50:26 +0900
changeset 9136 31177742f54a
parent 9135 df881932362f
child 9137 6f95c756d9fa
for calls expecting bool args, pass bool instead of int str.splitlines and email.message.as_string both expect a bool argument defaulting at False: replace f(1) by f(True) and f(0) by f()
contrib/hgdiff
hgext/convert/hg.py
hgext/hgcia.py
hgext/notify.py
mercurial/commands.py
mercurial/config.py
mercurial/context.py
mercurial/extensions.py
mercurial/hgweb/webcommands.py
mercurial/templatefilters.py
--- a/contrib/hgdiff	Tue Jul 14 20:24:16 2009 +0200
+++ b/contrib/hgdiff	Mon Jul 13 09:50:26 2009 +0900
@@ -38,13 +38,13 @@
 
 def diff_files(file1, file2):
     if file1 is None:
-        b = file(file2).read().splitlines(1)
+        b = file(file2).read().splitlines(True)
         l1 = "--- %s\n" % (file2)
         l2 = "+++ %s\n" % (file2)
         l3 = "@@ -0,0 +1,%d @@\n" % len(b)
         l = [l1, l2, l3] + ["+" + e for e in b]
     elif file2 is None:
-        a = file(file1).read().splitlines(1)
+        a = file(file1).read().splitlines(True)
         l1 = "--- %s\n" % (file1)
         l2 = "+++ %s\n" % (file1)
         l3 = "@@ -1,%d +0,0 @@\n" % len(a)
@@ -52,8 +52,8 @@
     else:
         t1 = file(file1).read()
         t2 = file(file2).read()
-        l1 = t1.splitlines(1)
-        l2 = t2.splitlines(1)
+        l1 = t1.splitlines(True)
+        l2 = t2.splitlines(True)
         if options.difflib:
             l = difflib.unified_diff(l1, l2, file1, file2)
         else:
--- a/hgext/convert/hg.py	Tue Jul 14 20:24:16 2009 +0200
+++ b/hgext/convert/hg.py	Mon Jul 13 09:50:26 2009 +0900
@@ -183,7 +183,7 @@
             tagparent = nullid
 
         try:
-            oldlines = sorted(parentctx['.hgtags'].data().splitlines(1))
+            oldlines = sorted(parentctx['.hgtags'].data().splitlines(True))
         except:
             oldlines = []
 
--- a/hgext/hgcia.py	Tue Jul 14 20:24:16 2009 +0200
+++ b/hgext/hgcia.py	Mon Jul 13 09:50:26 2009 +0900
@@ -205,7 +205,7 @@
         msg['From'] = self.emailfrom
         msg['Subject'] = 'DeliverXML'
         msg['Content-type'] = 'text/xml'
-        msgtext = msg.as_string(0)
+        msgtext = msg.as_string()
 
         self.ui.status(_('hgcia: sending update to %s\n') % address)
         mail.sendmail(self.ui, util.email(self.emailfrom),
--- a/hgext/notify.py	Tue Jul 14 20:24:16 2009 +0200
+++ b/hgext/notify.py	Mon Jul 13 09:50:26 2009 +0900
@@ -221,7 +221,7 @@
                                   hash(self.repo.root), socket.getfqdn()))
         msg['To'] = ', '.join(self.subs)
 
-        msgtext = msg.as_string(0)
+        msgtext = msg.as_string()
         if self.test:
             self.ui.write(msgtext)
             if not msgtext.endswith('\n'):
--- a/mercurial/commands.py	Tue Jul 14 20:24:16 2009 +0200
+++ b/mercurial/commands.py	Mon Jul 13 09:50:26 2009 +0900
@@ -1448,7 +1448,7 @@
         if not doc:
             doc = _("(no help text available)")
         if ui.quiet:
-            doc = doc.splitlines(0)[0]
+            doc = doc.splitlines()[0]
         ui.write("\n%s\n" % doc.rstrip())
 
         if not ui.quiet:
@@ -1476,7 +1476,7 @@
             doc = gettext(e[0].__doc__)
             if not doc:
                 doc = _("(no help text available)")
-            h[f] = doc.splitlines(0)[0].rstrip()
+            h[f] = doc.splitlines()[0].rstrip()
             cmds[f] = c.lstrip("^")
 
         if not h:
@@ -1523,7 +1523,7 @@
             raise error.UnknownCommand(name)
 
         doc = gettext(mod.__doc__) or _('no help text available')
-        doc = doc.splitlines(0)
+        doc = doc.splitlines()
         ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0]))
         for d in doc[1:]:
             ui.write(d, '\n')
--- a/mercurial/config.py	Tue Jul 14 20:24:16 2009 +0200
+++ b/mercurial/config.py	Mon Jul 13 09:50:26 2009 +0900
@@ -82,7 +82,7 @@
         line = 0
         cont = 0
 
-        for l in data.splitlines(1):
+        for l in data.splitlines(True):
             line += 1
             if cont:
                 m = contre.match(l)
--- a/mercurial/context.py	Tue Jul 14 20:24:16 2009 +0200
+++ b/mercurial/context.py	Mon Jul 13 09:50:26 2009 +0900
@@ -443,7 +443,7 @@
                         del hist[p]
             hist[f] = curr
 
-        return zip(hist[f][0], hist[f][1].splitlines(1))
+        return zip(hist[f][0], hist[f][1].splitlines(True))
 
     def ancestor(self, fc2):
         """
--- a/mercurial/extensions.py	Tue Jul 14 20:24:16 2009 +0200
+++ b/mercurial/extensions.py	Mon Jul 13 09:50:26 2009 +0900
@@ -173,6 +173,6 @@
         doc = (gettext(ext.__doc__) or _('(no help text available)'))
         ename = ename.split('.')[-1]
         maxlength = max(len(ename), maxlength)
-        exts[ename] = doc.splitlines(0)[0].strip()
+        exts[ename] = doc.splitlines()[0].strip()
 
     return exts, maxlength
--- a/mercurial/hgweb/webcommands.py	Tue Jul 14 20:24:16 2009 +0200
+++ b/mercurial/hgweb/webcommands.py	Mon Jul 13 09:50:26 2009 +0900
@@ -65,7 +65,7 @@
         text = '(binary:%s)' % mt
 
     def lines():
-        for lineno, t in enumerate(text.splitlines(1)):
+        for lineno, t in enumerate(text.splitlines(True)):
             yield {"line": t,
                    "lineid": "l%d" % (lineno + 1),
                    "linenumber": "% 6d" % (lineno + 1),
--- a/mercurial/templatefilters.py	Tue Jul 14 20:24:16 2009 +0200
+++ b/mercurial/templatefilters.py	Mon Jul 13 09:50:26 2009 +0900
@@ -73,7 +73,7 @@
 def firstline(text):
     '''return the first line of text'''
     try:
-        return text.splitlines(1)[0].rstrip('\r\n')
+        return text.splitlines(True)[0].rstrip('\r\n')
     except IndexError:
         return ''