53
53
This changeset contains all of the meta-information of a
54
54
diff, rather than just containing the patch information.
56
It will store it into FILENAME if supplied, otherwise it writes
59
Right now, rollup changesets, or working tree changesets are
60
not supported. This will only generate a changeset that has been
61
committed. You can use "--revision" to specify a certain change
56
BASE - This is the target tree with which you want to merge.
57
It will be used as the base for all patches. Anyone
58
wanting to merge the changeset will be required to have BASE
59
TARGET - This is the final revision which is desired to be in the
60
changeset. It defaults to the last committed revision. './@'
61
STARTING-REV-ID - All revisions between STARTING-REV and TARGET will
62
be bundled up in the changeset. By default this is
63
chosen as the merge root.
67
If --verbose, renames will be given as an 'add + delete' style patch.
64
takes_options = ['revision']
65
takes_args = ['filename?']
69
takes_options = ['verbose']
70
takes_args = ['base', 'target?', 'starting-rev-id?']
68
def run(self, revision=None, filename=None):
73
def run(self, base=None, target=None, starting_rev_id=None, verbose=False):
69
74
from bzrlib import find_branch
75
from bzrlib.commands import parse_spec
76
from bzrlib.errors import BzrCommandError
70
77
import gen_changeset
74
if filename is None or filename == '-':
75
outf = codecs.getwriter(bzrlib.user_encoding)(sys.stdout, errors='replace')
77
f = open(filename, 'wb')
78
outf = codecs.getwriter(bzrlib.user_encoding)(f, errors='replace')
80
if not isinstance(revision, (list, tuple)):
84
gen_changeset.show_changeset(b, revision, to_file=outf)
81
base_path, base_revno = parse_spec(base)
82
b_base = find_branch(base_path)
83
if base_revno is None or base_revno == -1:
84
base_rev_id = base_branch.last_patch()
86
base_rev_id = base_branch.last_patch()
90
b_target_path, target_revno = parse_spec(target)
91
b_target = find_branch(b_target_path)
92
if target_revno is None or target_revno == -1:
93
target_rev_id = b_target.last_patch()
95
target_rev_id = b_target.lookup_revision(target_revno)
97
outf = codecs.getwriter(bzrlib.user_encoding)(sys.stdout,
100
if starting_rev_id is not None:
101
raise BzrCommandError('Specifying the STARTING-REV-ID'
102
' not yet supported')
104
gen_changeset.show_changeset(base_branch, base_rev_id,
105
target_branch, target_rev_id,
107
to_file=outf, include_full_diff=verbose)
86
109
class cmd_verify_changeset(bzrlib.commands.Command):
87
110
"""Read a written changeset, and make sure it is valid.