context: eliminate handling of linenumber being None in annotate
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 11 Jul 2016 14:44:19 +0200
changeset 29527 576ff900fcc7
parent 29526 9d02bed8477b
child 29528 9c3786713926
context: eliminate handling of linenumber being None in annotate I could not find any use of this parameter value. And it arguably makes understanding of the function more difficult. Setting the parameter default value to False.
mercurial/context.py
--- a/mercurial/context.py	Tue Jul 12 22:26:04 2016 -0700
+++ b/mercurial/context.py	Mon Jul 11 14:44:19 2016 +0200
@@ -918,27 +918,20 @@
             return p[1]
         return filectx(self._repo, self._path, fileid=-1, filelog=self._filelog)
 
-    def annotate(self, follow=False, linenumber=None, diffopts=None):
-        '''returns a list of tuples of (ctx, line) for each line
+    def annotate(self, follow=False, linenumber=False, diffopts=None):
+        '''returns a list of tuples of ((ctx, number), line) for each line
         in the file, where ctx is the filectx of the node where
-        that line was last changed.
-        This returns tuples of ((ctx, linenumber), line) for each line,
-        if "linenumber" parameter is NOT "None".
-        In such tuples, linenumber means one at the first appearance
-        in the managed file.
-        To reduce annotation cost,
-        this returns fixed value(False is used) as linenumber,
-        if "linenumber" parameter is "False".'''
+        that line was last changed; if linenumber parameter is true, number is
+        the line number at the first appearance in the managed file, otherwise,
+        number has a fixed value of False.
+        '''
 
         def lines(text):
             if text.endswith("\n"):
                 return text.count("\n")
             return text.count("\n") + 1
 
-        if linenumber is None:
-            def decorate(text, rev):
-                return ([rev] * lines(text), text)
-        elif linenumber:
+        if linenumber:
             def decorate(text, rev):
                 return ([(rev, i) for i in xrange(1, lines(text) + 1)], text)
         else: