~vmiklos/bzr-fastimport/darcs

« back to all changes in this revision

Viewing changes to processors/query_processor.py

  • Committer: Ian Clatworthy
  • Date: 2009-08-24 07:18:26 UTC
  • Revision ID: ian.clatworthy@canonical.com-20090824071826-peuxy2m037evbls3
add --commit-mark option to fast-import-query to show just one commit (without file contents)

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)