From cf7d5ea805af02b54144de481c3454512ead78ce Mon Sep 17 00:00:00 2001 From: mhagger Date: Sat, 12 Jun 2010 09:31:25 +0000 Subject: [PATCH] Add methods RCSStream.set_lines() and RCSStream.set_text(). git-svn-id: http://cvs2svn.tigris.org/svn/cvs2svn/trunk@5142 be7e6eca-30d4-0310-a8e5-ac0d63af7087 --- cvs2svn_lib/rcs_stream.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cvs2svn_lib/rcs_stream.py b/cvs2svn_lib/rcs_stream.py index a474f7a2..e7aa57e3 100644 --- a/cvs2svn_lib/rcs_stream.py +++ b/cvs2svn_lib/rcs_stream.py @@ -177,13 +177,28 @@ class RCSStream: def __init__(self, text): """Instantiate and initialize the file content with TEXT.""" - self._lines = msplit(text) + self.set_text(text) def get_text(self): """Return the current file content.""" return "".join(self._lines) + def set_lines(self, lines): + """Set the current contents to the specified LINES. + + LINES is an iterable over well-formed lines; i.e., each line + contains exactly one LF as its last character, except that the + list line can be unterminated. LINES will be consumed + immediately; if it is a sequence, it will be copied.""" + + self._lines = list(lines) + + def set_text(self, text): + """Set the current file content.""" + + self._lines = msplit(text) + def generate_blocks(self, edits): """Generate edit blocks from an iterable of RCS edits. -- 2.11.4.GIT