/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.64.1 by Ian Clatworthy
1st cut: gfi parser + --info processing method
1
# Copyright (C) 2008 Canonical Ltd
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
17
"""Import processor that supports all Bazaar repository formats."""
18
19
20
from bzrlib.trace import (
21
    note,
22
    warning,
23
    )
24
from bzrlib.plugins.fastimport import processor
25
26
27
class GenericProcessor(processor.ImportProcessor):
28
    """An import processor that handles basic imports.
29
30
    Current features supported:
31
32
    * progress reporting works
33
    * checkpoints are ignored
34
    * some basic statistics are dumped on completion.
35
36
    Other commands produce errors.
37
    """
38
39
    def pre_process(self):
40
        # Init statistics
41
        self._revision_count = 0
42
        self._branch_count = 0
43
        self._tag_count = 0
44
        self._file_count = 0
45
        self._dir_count = 0
46
        self._symlink_count = 0
47
48
    def post_process(self):
49
        # Dump statistics
50
        note("Imported %d revisions into %d branches with %d tags.",
51
            self._revision_count, self._branch_count, self._tag_count)
52
        note("%d files, %d directories, %d symlinks.",
53
            self._file_count, self._dir_count, self._symlink_count)
54
55
    def progress_handler(self, cmd):
56
        """Process a ProgressCommand."""
57
        note("progress %s" % (cmd.message,))
58
59
    def checkpoint_handler(self, cmd):
60
        """Process a CheckpointCommand."""
61
        warning("ignoring checkpoint command")