~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: John Arbash Meinel
  • Date: 2005-06-20 05:06:06 UTC
  • mto: (0.5.85) (1185.82.1 bzr-w-changeset)
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: john@arbash-meinel.com-20050620050606-75e09678cc5ea0aa
adding apply-changset, plus more meta information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
        else:
60
60
            f = open(filename, 'rb')
61
61
 
62
 
        cset = read_changeset.read_changeset(f)
 
62
        cset_info = read_changeset.read_changeset(f)
 
63
        print cset_info
 
64
        cset = cset_info.get_changeset()
 
65
        print cset.entries
63
66
 
64
67
class cmd_apply_changeset(bzrlib.commands.Command):
65
68
    """Read in the given changeset, and apply it to the
69
72
    takes_args = ['filename?']
70
73
    takes_options = []
71
74
 
72
 
    def run(self, filename=None, reverse=False):
 
75
    def run(self, filename=None, reverse=False, auto_commit=True):
73
76
        from bzrlib import find_branch
74
 
        from bzrlib.changeset import apply_changeset
75
 
        import sys, read_changeset
 
77
        import sys
 
78
        import apply_changeset
76
79
 
77
80
        b = find_branch('.') # Make sure we are in a branch
78
81
        if filename is None or filename == '-':
80
83
        else:
81
84
            f = open(filename, 'rb')
82
85
 
83
 
        cset = read_changeset.read_changeset(f)
84
 
        apply_changeset(cset, branch.inventory, branch.base,
85
 
                reverse=reverse)
 
86
        apply_changeset.apply_changeset(b, f, reverse=reverse,
 
87
                auto_commit=auto_commit)
86
88
 
87
89
 
88
90
if hasattr(bzrlib.commands, 'register_plugin_cmd'):
91
93
    bzrlib.commands.register_plugin_cmd(cmd_apply_changeset)
92
94
 
93
95
    bzrlib.commands.OPTIONS['reverse'] = None
 
96
    bzrlib.commands.OPTIONS['auto-commit'] = None
94
97
    cmd_apply_changeset.takes_options.append('reverse')
 
98
    cmd_apply_changeset.takes_options.append('auto-commit')
95
99