~ubuntu-branches/ubuntu/lucid/bzr-fastimport/lucid

« back to all changes in this revision

Viewing changes to processors/query_processor.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2009-09-26 00:21:27 UTC
  • mfrom: (1.1.3 upstream) (0.1.5 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090926002127-naki02grwmkapav6
Tags: 0.9.0~bzr243-1
* New upstream snapshot.
* Bump standards version to 3.8.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    No changes to the current repository are made.
30
30
    """
31
31
 
32
 
    known_params = commands.COMMAND_NAMES + commands.FILE_COMMAND_NAMES
 
32
    known_params = commands.COMMAND_NAMES + commands.FILE_COMMAND_NAMES + \
 
33
        ['commit-mark']
33
34
 
34
35
    def __init__(self, target=None, params=None, verbose=False):
35
36
        # Allow creation without a target
36
37
        processor.ImportProcessor.__init__(self, target, params, verbose)
37
38
        self.parsed_params = {}
 
39
        self.interesting_commit = None
 
40
        self._finished = False
38
41
        if params:
 
42
            if 'commit-mark' in params:
 
43
                self.interesting_commit = params['commit-mark']
 
44
                del params['commit-mark']
39
45
            for name, value in params.iteritems():
40
46
                if value == 1:
41
47
                    # All fields
46
52
 
47
53
    def pre_handler(self, cmd):
48
54
        """Hook for logic before each handler starts."""
 
55
        if self._finished:
 
56
            return
 
57
        if self.interesting_commit and cmd.name == 'commit':
 
58
            if cmd.mark == self.interesting_commit:
 
59
                print cmd.to_string()
 
60
                self._finished = True
 
61
            return
49
62
        if self.parsed_params.has_key(cmd.name):
50
63
            fields = self.parsed_params[cmd.name]
51
64
            str = cmd.dump_str(fields, self.parsed_params, self.verbose)
75
88
    def tag_handler(self, cmd):
76
89
        """Process a TagCommand."""
77
90
        pass
 
91
 
 
92
    def feature_handler(self, cmd):
 
93
        """Process a FeatureCommand."""
 
94
        feature = cmd.feature_name
 
95
        if feature not in commands.FEATURE_NAMES:
 
96
            self.warning("feature %s is not supported - parsing may fail"
 
97
                % (feature,))