Add option for excluding paths from conversion
[cvs2svn.git] / cvs2svn_lib / artifact.py
blob27a351a404bc7094c212df754b68cac64efaa2fc
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 """This module defines Artifact types to be used with an ArtifactManager."""
20 import os
22 from cvs2svn_lib.context import Ctx
23 from cvs2svn_lib.log import logger
26 class Artifact(object):
27 """An object that is created, used across passes, then cleaned up."""
29 def __init__(self):
30 # The set of passes that need this artifact. This field is
31 # maintained by ArtifactManager.
32 self._passes_needed = set()
34 def cleanup(self):
35 """This artifact is no longer needed; clean it up."""
37 pass
40 class TempFile(Artifact):
41 """A temporary file that can be used across cvs2svn passes."""
43 def __init__(self, basename):
44 Artifact.__init__(self)
45 self.basename = basename
47 def _get_filename(self):
48 return Ctx().get_temp_filename(self.basename)
50 filename = property(_get_filename)
52 def cleanup(self):
53 logger.verbose("Deleting", self.filename)
54 os.unlink(self.filename)
56 def __str__(self):
57 return 'Temporary file %r' % (self.filename,)