/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.5.1 by John Arbash Meinel
Just an initial working step.
1
#!/usr/bin/env python
2
"""\
3
This is an attempt to take the internal delta object, and represent
4
it as a single-file text-only changeset.
5
This should have commands for both generating a changeset,
6
and for applying a changeset.
7
"""
8
9
import bzrlib, bzrlib.commands
10
11
class cmd_changeset(bzrlib.commands.Command):
12
    """Generate a bundled up changeset.
13
14
    This changeset contains all of the meta-information of a
15
    diff, rather than just containing the patch information.
16
    """
17
    takes_opts = ['revision', 'diff-options']
18
    takes_args = ['file*']
19
    aliases = ['cset']
20
21
    def run(self, revision=None, file_list=None, diff_options=None):
22
        from bzrlib import find_branch
23
        import gen_changeset
24
        import sys
25
26
        if file_list:
27
            b = find_branch(file_list[0])
28
            file_list = [b.relpath(f) for f in file_list]
29
            if file_list == ['']:
30
                # just pointing to top-of-tree
31
                file_list = None
32
        else:
33
            b = find_branch('.')
34
35
        gen_changeset.show_changeset(b, revision,
36
                specific_files=file_list,
37
                external_diff_options=diff_options,
38
                to_file=sys.stdout)
39
40
        
41
42