~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: John Arbash Meinel
  • Date: 2005-06-28 21:57: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-20050628215706-382b5a30719c6ccf
Added a file to put the changeset into.

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
    This changeset contains all of the meta-information of a
73
73
    diff, rather than just containing the patch information.
74
74
 
 
75
    It will store it into FILENAME if supplied, otherwise it writes
 
76
    to stdout
 
77
 
75
78
    Right now, rollup changesets, or working tree changesets are
76
79
    not supported. This will only generate a changeset that has been
77
80
    committed. You can use "--revision" to specify a certain change
78
81
    to display.
79
82
    """
80
83
    takes_options = ['revision']
81
 
    takes_args = []
 
84
    takes_args = ['filename?']
82
85
    aliases = ['cset']
83
86
 
84
 
    def run(self, revision=None):
 
87
    def run(self, revision=None, filename=None):
85
88
        from bzrlib import find_branch
86
89
        import gen_changeset
87
90
        import sys
 
91
        import codecs
 
92
 
 
93
        if filename is None or filename == '-':
 
94
            outf = codecs.getwriter(bzrlib.user_encoding)(sys.stdout, errors='replace')
 
95
        else:
 
96
            f = open(filename, 'wb')
 
97
            outf = codecs.getwriter(bzrlib.user_encoding)(f, errors='replace')
88
98
 
89
99
        if not isinstance(revision, (list, tuple)):
90
100
            revision = [revision]
91
101
        b = find_branch('.')
92
102
 
93
 
        gen_changeset.show_changeset(b, revision,
94
 
                to_file=sys.stdout)
 
103
        gen_changeset.show_changeset(b, revision, to_file=outf)
95
104
 
96
105
class cmd_verify_changeset(bzrlib.commands.Command):
97
106
    """Read a written changeset, and make sure it is valid.
128
137
        if filename is None or filename == '-':
129
138
            f = sys.stdin
130
139
        else:
131
 
            f = open(filename, 'rb')
 
140
            f = open(filename, 'U') # Universal newlines
132
141
 
133
142
        apply_changeset.apply_changeset(b, f, reverse=reverse,
134
143
                auto_commit=auto_commit)