3533
3537
_see_also = ['add', 'bugs', 'hooks', 'uncommit']
3534
3538
takes_args = ['selected*']
3535
3539
takes_options = [
3536
ListOption('exclude', type=text_type, short_name='x',
3537
help="Do not consider changes made to a given path."),
3538
Option('message', type=text_type,
3540
help="Description of the new revision."),
3543
help='Commit even if nothing has changed.'),
3544
Option('file', type=text_type,
3547
help='Take commit message from this file.'),
3549
help="Refuse to commit if there are unknown "
3550
"files in the working tree."),
3551
Option('commit-time', type=text_type,
3552
help="Manually set a commit time using commit date "
3553
"format, e.g. '2009-10-10 08:00:00 +0100'."),
3554
ListOption('fixes', type=text_type,
3555
help="Mark a bug as being fixed by this revision "
3556
"(see \"brz help bugs\")."),
3557
ListOption('author', type=text_type,
3558
help="Set the author's name, if it's different "
3559
"from the committer."),
3561
help="Perform a local commit in a bound "
3562
"branch. Local commits are not pushed to "
3563
"the master branch until a normal commit "
3566
Option('show-diff', short_name='p',
3567
help='When no message is supplied, show the diff along'
3568
' with the status summary in the message editor.'),
3570
help='When committing to a foreign version control '
3571
'system do not push data that can not be natively '
3540
ListOption('exclude', type=text_type, short_name='x',
3541
help="Do not consider changes made to a given path."),
3542
Option('message', type=text_type,
3544
help="Description of the new revision."),
3547
help='Commit even if nothing has changed.'),
3548
Option('file', type=text_type,
3551
help='Take commit message from this file.'),
3553
help="Refuse to commit if there are unknown "
3554
"files in the working tree."),
3555
Option('commit-time', type=text_type,
3556
help="Manually set a commit time using commit date "
3557
"format, e.g. '2009-10-10 08:00:00 +0100'."),
3558
ListOption('bugs', type=text_type,
3559
help="Link to a related bug. (see \"brz help bugs\")."),
3560
ListOption('fixes', type=text_type,
3561
help="Mark a bug as being fixed by this revision "
3562
"(see \"brz help bugs\")."),
3563
ListOption('author', type=text_type,
3564
help="Set the author's name, if it's different "
3565
"from the committer."),
3567
help="Perform a local commit in a bound "
3568
"branch. Local commits are not pushed to "
3569
"the master branch until a normal commit "
3572
Option('show-diff', short_name='p',
3573
help='When no message is supplied, show the diff along'
3574
' with the status summary in the message editor.'),
3576
help='When committing to a foreign version control '
3577
'system do not push data that can not be natively '
3572
3578
'represented.'),
3574
3580
aliases = ['ci', 'checkin']
3576
def _iter_bug_fix_urls(self, fixes, branch):
3582
def _iter_bug_urls(self, bugs, branch, status):
3577
3583
default_bugtracker = None
3578
3584
# Configure the properties for bug fixing attributes.
3579
for fixed_bug in fixes:
3580
tokens = fixed_bug.split(':')
3586
tokens = bug.split(':')
3581
3587
if len(tokens) == 1:
3582
3588
if default_bugtracker is None:
3583
3589
branch_config = branch.get_config_stack()
3589
3595
"'tracker:id' or specify a default bug tracker "
3590
3596
"using the `bugtracker` option.\nSee "
3591
3597
"\"brz help bugs\" for more information on this "
3592
"feature. Commit refused.") % fixed_bug)
3598
"feature. Commit refused.") % bug)
3593
3599
tag = default_bugtracker
3594
3600
bug_id = tokens[0]
3595
3601
elif len(tokens) != 2:
3596
3602
raise errors.BzrCommandError(gettext(
3597
3603
"Invalid bug %s. Must be in the form of 'tracker:id'. "
3598
3604
"See \"brz help bugs\" for more information on this "
3599
"feature.\nCommit refused.") % fixed_bug)
3605
"feature.\nCommit refused.") % bug)
3601
3607
tag, bug_id = tokens
3603
yield bugtracker.get_bug_url(tag, branch, bug_id)
3609
yield bugtracker.get_bug_url(tag, branch, bug_id), status
3604
3610
except bugtracker.UnknownBugTrackerAbbreviation:
3605
3611
raise errors.BzrCommandError(gettext(
3606
'Unrecognized bug %s. Commit refused.') % fixed_bug)
3612
'Unrecognized bug %s. Commit refused.') % bug)
3607
3613
except bugtracker.MalformedBugIdentifier as e:
3608
3614
raise errors.BzrCommandError(gettext(
3609
3615
u"%s\nCommit refused.") % (e,))
3611
3617
def run(self, message=None, file=None, verbose=False, selected_list=None,
3612
unchanged=False, strict=False, local=False, fixes=None,
3618
unchanged=False, strict=False, local=False, fixes=None, bugs=None,
3613
3619
author=None, show_diff=False, exclude=None, commit_time=None,
3615
3622
from .commit import (
3616
3623
PointlessCommit,
5854
5865
If the preferred client can't be found (or used), your editor will be used.
5856
5867
To use a specific mail program, set the mail_client configuration option.
5857
(For Thunderbird 1.5, this works around some bugs.) Supported values for
5858
specific clients are "claws", "evolution", "kmail", "mail.app" (MacOS X's
5859
Mail.app), "mutt", and "thunderbird"; generic options are "default",
5860
"editor", "emacsclient", "mapi", and "xdg-email". Plugins may also add
5868
Supported values for specific clients are "claws", "evolution", "kmail",
5869
"mail.app" (MacOS X's Mail.app), "mutt", and "thunderbird"; generic options
5870
are "default", "editor", "emacsclient", "mapi", and "xdg-email". Plugins
5871
may also add supported clients.
5863
5873
If mail is being sent, a to address is required. This can be supplied
5864
5874
either on the commandline, by setting the submit_to configuration
5865
5875
option in the branch itself or the child_submit_to configuration option
5866
5876
in the submit branch.
5868
Two formats are currently supported: "4" uses revision bundle format 4 and
5869
merge directive format 2. It is significantly faster and smaller than
5870
older formats. It is compatible with Bazaar 0.19 and later. It is the
5871
default. "0.9" uses revision bundle format 0.9 and merge directive
5872
format 1. It is compatible with Bazaar 0.12 - 0.18.
5874
5878
The merge directives created by brz send may be applied using brz merge or
5875
5879
brz pull by specifying a file containing a merge directive as the location.
6334
6332
if branch is None:
6335
6333
raise errors.BzrCommandError(
6336
6334
gettext('cannot create branch without source branch'))
6337
to_location = lookup_new_sibling_branch(control_dir, to_location,
6338
possible_transports=possible_transports)
6339
to_branch = branch.controldir.sprout(to_location,
6340
possible_transports=possible_transports,
6341
source_branch=branch).open_branch()
6335
to_location = lookup_new_sibling_branch(
6336
control_dir, to_location,
6337
possible_transports=possible_transports)
6338
if revision is not None:
6339
revision = revision.as_revision_id(branch)
6340
to_branch = branch.controldir.sprout(
6342
possible_transports=possible_transports,
6343
revision_id=revision,
6344
source_branch=branch).open_branch()
6344
6347
to_branch = Branch.open(to_location,
6345
6348
possible_transports=possible_transports)
6346
6349
except errors.NotBranchError:
6347
to_branch = open_sibling_branch(control_dir, to_location,
6348
possible_transports=possible_transports)
6349
if revision is not None:
6350
revision = revision.as_revision_id(to_branch)
6350
to_branch = open_sibling_branch(
6351
control_dir, to_location,
6352
possible_transports=possible_transports)
6353
if revision is not None:
6354
revision = revision.as_revision_id(to_branch)
6352
6356
switch.switch(control_dir, to_branch, force, revision_id=revision,
6353
6357
store_uncommitted=store)