221
215
if ref_branch is None or ref_branch.name:
222
216
if ref_branch is not None:
223
217
control_dir = ref_branch.controldir
224
for name, branch in viewitems(control_dir.get_branches()):
218
for name, branch in control_dir.get_branches().items():
225
219
yield name, branch
227
221
repo = ref_branch.controldir.find_repository()
1336
1330
help='Create a stacked branch that refers to another branch '
1337
1331
'for the commit history. Only the work not present in the '
1338
1332
'referenced branch is included in the branch created.',
1340
1334
Option('strict',
1341
1335
help='Refuse to push if there are uncommitted changes in'
1342
1336
' the working tree, --no-strict disables the check.'),
1447
1441
takes_options = ['revision',
1449
1443
'hardlink', help='Hard-link working tree files where possible.'),
1450
Option('files-from', type=text_type,
1444
Option('files-from', type=str,
1451
1445
help="Get file contents from this tree."),
1452
1446
Option('no-tree',
1453
1447
help="Create a branch without a working-tree."),
1619
1613
names[name] = active
1620
1614
# Only mention the current branch explicitly if it's not
1621
1615
# one of the colocated branches
1622
if not any(viewvalues(names)) and active_branch is not None:
1616
if not any(names.values()) and active_branch is not None:
1623
1617
self.outf.write("* %s\n" % gettext("(default)"))
1624
1618
for name in sorted(names):
1625
1619
active = names[name]
1630
self.outf.write("%s %s\n" % (
1631
prefix, (name if PY3 else name.encode(self.outf.encoding))))
1624
self.outf.write("%s %s\n" % (prefix, name))
1634
1627
class cmd_checkout(Command):
1662
1655
"common operations like diff and status without "
1663
1656
"such access, and also support local commits."
1665
Option('files-from', type=text_type,
1658
Option('files-from', type=str,
1666
1659
help="Get file contents from this tree."),
1667
1660
Option('hardlink',
1668
1661
help='Hard-link working tree files where possible.'
2306
2299
_see_also = ['status']
2307
2300
takes_args = ['file*']
2308
2301
takes_options = [
2309
Option('diff-options', type=text_type,
2302
Option('diff-options', type=str,
2310
2303
help='Pass these options to the external diff program.'),
2311
Option('prefix', type=text_type,
2304
Option('prefix', type=str,
2312
2305
short_name='p',
2313
2306
help='Set prefixes added to old and new filenames, as '
2314
2307
'two values separated by a colon. (eg "old/:new/").'),
2316
2309
help='Branch/tree to compare from.',
2320
2313
help='Branch/tree to compare to.',
2325
2318
Option('using',
2326
2319
help='Use this command to compare files.',
2329
2322
RegistryOption('format',
2330
2323
short_name='F',
2725
2718
short_name='m',
2726
2719
help='Show revisions whose properties match this '
2729
2722
ListOption('match-message',
2730
2723
help='Show revisions whose message matches this '
2733
2726
ListOption('match-committer',
2734
2727
help='Show revisions whose committer matches this '
2737
2730
ListOption('match-author',
2738
2731
help='Show revisions whose authors match this '
2741
2734
ListOption('match-bugs',
2742
2735
help='Show revisions whose bugs match this '
2746
2739
encoding_type = 'replace'
3007
3000
Option('kind', short_name='k',
3008
3001
help=('List entries of a particular kind: file, '
3009
3002
'directory, symlink, tree-reference.'),
3331
3324
takes_options = ['directory',
3332
3325
Option('format',
3333
3326
help="Type of file to export to.",
3336
3329
Option('filters', help='Apply content filters to export the '
3337
3330
'convenient form.'),
3340
3333
help="Name of the root directory inside the exported file."),
3341
3334
Option('per-file-timestamps',
3342
3335
help='Set modification time of files to that of the last '
3538
3531
takes_args = ['selected*']
3539
3532
takes_options = [
3541
'exclude', type=text_type, short_name='x',
3534
'exclude', type=str, short_name='x',
3542
3535
help="Do not consider changes made to a given path."),
3543
Option('message', type=text_type,
3536
Option('message', type=str,
3544
3537
short_name='m',
3545
3538
help="Description of the new revision."),
3547
3540
Option('unchanged',
3548
3541
help='Commit even if nothing has changed.'),
3549
Option('file', type=text_type,
3542
Option('file', type=str,
3550
3543
short_name='F',
3551
3544
argname='msgfile',
3552
3545
help='Take commit message from this file.'),
3553
3546
Option('strict',
3554
3547
help="Refuse to commit if there are unknown "
3555
3548
"files in the working tree."),
3556
Option('commit-time', type=text_type,
3549
Option('commit-time', type=str,
3557
3550
help="Manually set a commit time using commit date "
3558
3551
"format, e.g. '2009-10-10 08:00:00 +0100'."),
3560
'bugs', type=text_type,
3561
3554
help="Link to a related bug. (see \"brz help bugs\")."),
3563
'fixes', type=text_type,
3564
3557
help="Mark a bug as being fixed by this revision "
3565
3558
"(see \"brz help bugs\")."),
3567
'author', type=text_type,
3568
3561
help="Set the author's name, if it's different "
3569
3562
"from the committer."),
3570
3563
Option('local',
4030
4023
def print_aliases(self):
4031
4024
"""Print out the defined aliases in a similar format to bash."""
4032
4025
aliases = _mod_config.GlobalConfig().get_aliases()
4033
for key, value in sorted(viewitems(aliases)):
4026
for key, value in sorted(aliases.items()):
4034
4027
self.outf.write('brz alias %s="%s"\n' % (key, value))
4036
4029
@display_command
4147
4140
'breezy.tests', 'parallel_registry'),
4148
4141
value_switches=False,
4150
Option('randomize', type=text_type, argname="SEED",
4143
Option('randomize', type=str, argname="SEED",
4151
4144
help='Randomize the order of tests using the given'
4152
4145
' seed or "now" for the current time.'),
4153
ListOption('exclude', type=text_type, argname="PATTERN",
4146
ListOption('exclude', type=str, argname="PATTERN",
4154
4147
short_name='x',
4155
4148
help='Exclude tests that match this regular'
4156
4149
' expression.'),
4160
4153
help='Output test progress via subunit v2.'),
4161
4154
Option('strict', help='Fail on missing dependencies or '
4162
4155
'known failures.'),
4163
Option('load-list', type=text_type, argname='TESTLISTFILE',
4156
Option('load-list', type=str, argname='TESTLISTFILE',
4164
4157
help='Load a test id list from a text file.'),
4165
ListOption('debugflag', type=text_type, short_name='E',
4158
ListOption('debugflag', type=str, short_name='E',
4166
4159
help='Turn on a selftest debug flag.'),
4167
ListOption('starting-with', type=text_type, argname='TESTID',
4160
ListOption('starting-with', type=str, argname='TESTID',
4168
4161
param_name='starting_with', short_name='s',
4169
4162
help='Load only the tests starting with TESTID.'),
5732
5725
diff='Normal unified diff.',
5733
5726
plain='No patch, just directive.'),
5734
5727
Option('sign', help='GPG-sign the directive.'), 'revision',
5735
Option('mail-to', type=text_type,
5728
Option('mail-to', type=str,
5736
5729
help='Instead of printing the directive, email to this '
5738
Option('message', type=text_type, short_name='m',
5731
Option('message', type=str, short_name='m',
5739
5732
help='Message to use when committing this merge.')
5889
5882
help='Branch to generate the submission from, '
5890
5883
'rather than the one containing the working directory.',
5891
5884
short_name='f',
5893
5886
Option('output', short_name='o',
5894
5887
help='Write merge directive to this file or directory; '
5895
5888
'use - for stdout.',
5897
5890
Option('strict',
5898
5891
help='Refuse to send if there are uncommitted changes in'
5899
5892
' the working tree, --no-strict disables the check.'),
5900
5893
Option('mail-to', help='Mail the request to this address.',
5904
Option('body', help='Body for the email.', type=text_type),
5897
Option('body', help='Body for the email.', type=str),
5905
5898
RegistryOption('format',
5906
5899
help='Use the specified output format.',
5907
5900
lazy_registry=('breezy.send', 'format_registry')),
5957
5950
help='Branch to generate the submission from, '
5958
5951
'rather than the one containing the working directory.',
5959
5952
short_name='f',
5961
5954
Option('output', short_name='o', help='Write directive to this file.',
5963
5956
Option('strict',
5964
5957
help='Refuse to bundle revisions if there are uncommitted'
5965
5958
' changes in the working tree, --no-strict disables the check.'),
6089
6082
from .tag import tag_sort_methods
6090
6083
branch, relpath = Branch.open_containing(directory)
6092
tags = list(viewitems(branch.tags.get_tag_dict()))
6085
tags = list(branch.tags.get_tag_dict().items())
6193
6186
with_no_trees='Reconfigure repository to not create '
6194
6187
'working trees on branches by default.'
6196
Option('bind-to', help='Branch to bind checkout to.', type=text_type),
6189
Option('bind-to', help='Branch to bind checkout to.', type=str),
6197
6190
Option('force',
6198
6191
help='Perform reconfiguration even if local changes'
6199
6192
' will be lost.'),
6200
6193
Option('stacked-on',
6201
6194
help='Reconfigure a branch to be stacked on another branch.',
6204
6197
Option('unstacked',
6205
6198
help='Reconfigure a branch to be unstacked. This '
6792
6785
takes_options = [Option('plugin',
6793
6786
help='Export help text from named command '
6794
6787
'(defaults to all built in commands).',
6796
6789
Option('include-duplicates',
6797
6790
help='Output multiple copies of the same msgid '
6798
6791
'string if it appears more than once.'),
6898
6891
takes_options = [
6901
Option('color', type=text_type, argname='when',
6894
Option('color', type=str, argname='when',
6902
6895
help='Show match in color. WHEN is never, always or auto.'),
6903
6896
Option('diff', short_name='p',
6904
6897
help='Grep for pattern in changeset for each revision.'),
6905
ListOption('exclude', type=text_type, argname='glob', short_name='X',
6898
ListOption('exclude', type=str, argname='glob', short_name='X',
6906
6899
help="Skip files whose base name matches GLOB."),
6907
ListOption('include', type=text_type, argname='glob', short_name='I',
6900
ListOption('include', type=str, argname='glob', short_name='I',
6908
6901
help="Search only files whose base name matches GLOB."),
6909
6902
Option('files-with-matches', short_name='l',
6910
6903
help='Print only the name of each input file in '