Change RepositoryDelegate into a factory function.
[cvs2svn.git] / cvs2svn_lib / svn_repository_delegate.py
blob041ec06914e9b8b3016e931b659168493f0cddcf
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 contains the SVNRepositoryDelegate class."""
20 class SVNRepositoryDelegate:
21 """Abstract superclass for any delegate to SVNOutputOption.
23 Subclasses must implement all of the methods below.
25 For each method, a subclass implements, in its own way, the
26 Subversion operation implied by the method's name. For example, for
27 the add_path method, the DumpstreamDelegate would write out a
28 'Node-add:' command to a Subversion dumpfile, the StdoutDelegate
29 would merely print that the path is being added to the repository,
30 and the RepositoryDelegate would actually cause the path to be added
31 to the Subversion repository that it is creating."""
33 def start_commit(self, revnum, revprops):
34 """An SVN commit is starting.
36 Perform any actions needed to start an SVN commit with revision
37 number REVNUM and revision properties REVPROPS."""
39 raise NotImplementedError()
41 def end_commit(self):
42 """An SVN commit is ending."""
44 raise NotImplementedError()
46 def initialize_project(self, project):
47 """Initialize PROJECT.
49 For Subversion, this means to create the trunk, branches, and tags
50 directories for PROJECT."""
52 raise NotImplementedError()
54 def initialize_lod(self, lod):
55 """Initialize LOD with no contents.
57 LOD is an instance of LineOfDevelopment. It is also possible for
58 an LOD to be created by copying from another LOD; such events are
59 indicated via the copy_lod() callback."""
61 raise NotImplementedError()
63 def mkdir(self, lod, cvs_directory):
64 """Create CVS_DIRECTORY within LOD.
66 LOD is a LineOfDevelopment; CVS_DIRECTORY is a CVSDirectory."""
68 raise NotImplementedError()
70 def add_path(self, cvs_rev):
71 """Add the path corresponding to CVS_REV to the repository.
73 CVS_REV is a CVSRevisionAdd."""
75 raise NotImplementedError()
77 def change_path(self, cvs_rev):
78 """Change the path corresponding to CVS_REV in the repository.
80 CVS_REV is a CVSRevisionChange."""
82 raise NotImplementedError()
84 def delete_lod(self, lod):
85 """Delete LOD from the repository.
87 LOD is a LineOfDevelopment instance."""
89 raise NotImplementedError()
91 def delete_path(self, lod, cvs_path):
92 """Delete CVS_PATH from LOD.
94 LOD is a LineOfDevelopment; CVS_PATH is a CVSPath."""
96 raise NotImplementedError()
98 def copy_lod(self, src_lod, dest_lod, src_revnum):
99 """Copy SRC_LOD in SRC_REVNUM to DEST_LOD.
101 SRC_LOD and DEST_LOD are both LODs, and SRC_REVNUM is a subversion
102 revision number (int)."""
104 raise NotImplementedError()
106 def copy_path(self, cvs_path, src_lod, dest_lod, src_revnum):
107 """Copy CVS_PATH in SRC_LOD@SRC_REVNUM to DEST_LOD.
109 CVS_PATH is a CVSPath, SRC_LOD and DEST_LOD are LODs, and
110 SRC_REVNUM is a subversion revision number (int)."""
112 raise NotImplementedError()
114 def finish(self):
115 """All SVN revisions have been committed.
117 Perform any necessary cleanup."""
119 raise NotImplementedError()