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 database facilities used by cvs2svn."""
20 from cvs2svn_lib
.log
import Log
21 from cvs2svn_lib
.svn_repository_delegate
import SVNRepositoryDelegate
24 class StdoutDelegate(SVNRepositoryDelegate
):
25 """Makes no changes to the disk, but writes out information to
26 STDOUT about what is happening in the SVN output. Of course, our
27 print statements will state that we're doing something, when in
28 reality, we aren't doing anything other than printing out that we're
29 doing something. Kind of zen, really."""
31 def __init__(self
, total_revs
):
32 self
.total_revs
= total_revs
34 def start_commit(self
, revnum
, revprops
):
35 """Prints out the Subversion revision number of the commit that is
38 Log().verbose("=" * 60)
39 Log().normal("Starting Subversion r%d / %d" % (revnum
, self
.total_revs
))
44 def initialize_project(self
, project
):
45 Log().verbose(" Initializing project %s" % (project
,))
47 def initialize_lod(self
, lod
):
48 Log().verbose(" Initializing %s" % (lod
,))
50 def mkdir(self
, lod
, cvs_directory
):
52 " New Directory %s" % (lod
.get_path(cvs_directory
.cvs_path
),)
55 def add_path(self
, s_item
):
56 """Print a line stating what path we are 'adding'."""
58 Log().verbose(" Adding %s" % (s_item
.cvs_rev
.get_svn_path(),))
60 def change_path(self
, s_item
):
61 """Print a line stating what path we are 'changing'."""
63 Log().verbose(" Changing %s" % (s_item
.cvs_rev
.get_svn_path(),))
65 def delete_lod(self
, lod
):
66 """Print a line stating that we are 'deleting' LOD."""
68 Log().verbose(" Deleting %s" % (lod
.get_path(),))
70 def delete_path(self
, lod
, cvs_path
):
71 """Print a line stating that we are 'deleting' PATH."""
73 Log().verbose(" Deleting %s" % (lod
.get_path(cvs_path
.cvs_path
),))
75 def _show_copy(self
, src_path
, dest_path
, src_revnum
):
76 """Print a line stating that we are 'copying' revision SRC_REVNUM
77 of SRC_PATH to DEST_PATH."""
80 " Copying revision %d of %s\n"
82 % (src_revnum
, src_path
, dest_path
,)
85 def copy_lod(self
, src_lod
, dest_lod
, src_revnum
):
86 """Print a line stating that we are 'copying' revision SRC_REVNUM
87 of SRC_PATH to DEST_PATH."""
89 self
._show
_copy
(src_lod
.get_path(), dest_lod
.get_path(), src_revnum
)
91 def copy_path(self
, cvs_path
, src_lod
, dest_lod
, src_revnum
):
92 """Print a line stating that we are 'copying' revision SRC_REVNUM
93 of CVS_PATH from SRC_LOD to DEST_LOD."""
96 src_lod
.get_path(cvs_path
.cvs_path
),
97 dest_lod
.get_path(cvs_path
.cvs_path
),
102 """State that we are done creating our repository."""
104 Log().verbose("Finished creating Subversion repository.")