D5618: bdiff: drop duplicate definition of splitnewlines()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jan 17 01:09:27 UTC 2019


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It was added in https://phab.mercurial-scm.org/rHG29dd37a418aa26194a40ad603e918a7373e8c5e2 (bdiff: write a native version of
  splitnewlines, 2018-01-25).

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5618

AFFECTED FILES
  mercurial/pure/bdiff.py

CHANGE DETAILS

diff --git a/mercurial/pure/bdiff.py b/mercurial/pure/bdiff.py
--- a/mercurial/pure/bdiff.py
+++ b/mercurial/pure/bdiff.py
@@ -90,13 +90,3 @@
         text = re.sub('[ \t\r]+', ' ', text)
         text = text.replace(' \n', '\n')
     return text
-
-def splitnewlines(text):
-    '''like str.splitlines, but only split on newlines.'''
-    lines = [l + '\n' for l in text.split('\n')]
-    if lines:
-        if lines[-1] == '\n':
-            lines.pop()
-        else:
-            lines[-1] = lines[-1][:-1]
-    return lines



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list