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