De-emphasize the iteration over temporary directories.
[cvs2svn.git] / cvs2svn_lib / rcs_revision_manager.py
blob1c2dfcfd220eaa1d3a3b912bb58a3c00f481aed3
1 # (Be in -*- python -*- mode.)
3 # ====================================================================
4 # Copyright (c) 2000-2008 CollabNet. All rights reserved.
6 # This software is licensed as described in the file COPYING, which
7 # you should have received as part of this distribution. The terms
8 # are also available at http://subversion.tigris.org/license-1.html.
9 # If newer versions of this license are posted there, you may use a
10 # newer version instead, at your option.
12 # This software consists of voluntary contributions made by many
13 # individuals. For exact contribution history, see the revision
14 # history and logs, available at http://cvs2svn.tigris.org/.
15 # ====================================================================
17 """Access the CVS repository via RCS's 'co' command."""
20 from cvs2svn_lib.common import FatalError
21 from cvs2svn_lib.process import check_command_runs
22 from cvs2svn_lib.process import PipeStream
23 from cvs2svn_lib.process import CommandFailedException
24 from cvs2svn_lib.revision_manager import RevisionReader
27 class RCSRevisionReader(RevisionReader):
28 """A RevisionReader that reads the contents via RCS."""
30 def __init__(self, co_executable):
31 self.co_executable = co_executable
32 try:
33 check_command_runs([self.co_executable, '-V'], self.co_executable)
34 except CommandFailedException, e:
35 raise FatalError('%s\n'
36 'Please check that co is installed and in your PATH\n'
37 '(it is a part of the RCS software).' % (e,))
39 def get_content_stream(self, cvs_rev, suppress_keyword_substitution=False):
40 pipe_cmd = [
41 self.co_executable,
42 '-q',
43 '-x,v',
44 '-p%s' % (cvs_rev.rev,)
46 if suppress_keyword_substitution:
47 pipe_cmd.append('-kk')
48 pipe_cmd.append(cvs_rev.cvs_file.filename)
49 return PipeStream(pipe_cmd)