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.
|
|
|
0.5.7
by John Arbash Meinel
Added a bunch more information about changesets. Can now read back in all of the meta information. |
16 |
|
17 |
Right now, rollup changesets, or working tree changesets are
|
|
18 |
not supported. This will only generate a changeset that has been
|
|
19 |
committed. You can use "--revision" to specify a certain change
|
|
20 |
to display.
|
|
|
0.5.1
by John Arbash Meinel
Just an initial working step. |
21 |
"""
|
|
0.5.3
by John Arbash Meinel
Added a couple more bits |
22 |
takes_options = ['revision', 'diff-options'] |
|
0.5.1
by John Arbash Meinel
Just an initial working step. |
23 |
takes_args = ['file*'] |
24 |
aliases = ['cset'] |
|
25 |
||
26 |
def run(self, revision=None, file_list=None, diff_options=None): |
|
27 |
from bzrlib import find_branch |
|
28 |
import gen_changeset |
|
29 |
import sys |
|
30 |
||
|
0.5.7
by John Arbash Meinel
Added a bunch more information about changesets. Can now read back in all of the meta information. |
31 |
if isinstance(revision, (list, tuple)): |
32 |
if len(revision) > 1: |
|
33 |
raise BzrCommandError('We do not support rollup-changesets yet.') |
|
34 |
revision = revision[0] |
|
|
0.5.1
by John Arbash Meinel
Just an initial working step. |
35 |
if file_list: |
36 |
b = find_branch(file_list[0]) |
|
37 |
file_list = [b.relpath(f) for f in file_list] |
|
38 |
if file_list == ['']: |
|
39 |
# just pointing to top-of-tree
|
|
40 |
file_list = None |
|
41 |
else: |
|
42 |
b = find_branch('.') |
|
43 |
||
44 |
gen_changeset.show_changeset(b, revision, |
|
45 |
specific_files=file_list, |
|
46 |
external_diff_options=diff_options, |
|
47 |
to_file=sys.stdout) |
|
48 |
||
|
0.5.7
by John Arbash Meinel
Added a bunch more information about changesets. Can now read back in all of the meta information. |
49 |
class cmd_verify_changeset(bzrlib.commands.Command): |
50 |
"""Read a written changeset, and make sure it is valid. |
|
51 |
||
52 |
"""
|
|
53 |
takes_args = ['filename?'] |
|
54 |
||
55 |
def run(self, filename=None): |
|
56 |
import sys, read_changeset |
|
57 |
if filename is None or filename == '-': |
|
58 |
f = sys.stdin |
|
59 |
else: |
|
60 |
f = open(filename, 'rb') |
|
61 |
||
62 |
cset = read_changeset.read_changeset(f) |
|
63 |
||
64 |
||
65 |
if hasattr(bzrlib.commands, 'register_plugin_cmd'): |
|
66 |
bzrlib.commands.register_plugin_cmd(cmd_changeset) |
|
67 |
bzrlib.commands.register_plugin_cmd(cmd_verify_changeset) |
|
|
0.5.1
by John Arbash Meinel
Just an initial working step. |
68 |