221
213
if ref_branch is None or ref_branch.name:
222
214
if ref_branch is not None:
223
215
control_dir = ref_branch.controldir
224
for name, branch in viewitems(control_dir.get_branches()):
216
for name, branch in control_dir.get_branches().items():
225
217
yield name, branch
227
219
repo = ref_branch.controldir.find_repository()
1336
1328
help='Create a stacked branch that refers to another branch '
1337
1329
'for the commit history. Only the work not present in the '
1338
1330
'referenced branch is included in the branch created.',
1340
1332
Option('strict',
1341
1333
help='Refuse to push if there are uncommitted changes in'
1342
1334
' the working tree, --no-strict disables the check.'),
1448
1440
takes_options = ['revision',
1450
1442
'hardlink', help='Hard-link working tree files where possible.'),
1451
Option('files-from', type=text_type,
1443
Option('files-from', type=str,
1452
1444
help="Get file contents from this tree."),
1453
1445
Option('no-tree',
1454
1446
help="Create a branch without a working-tree."),
1622
1614
names[name] = active
1623
1615
# Only mention the current branch explicitly if it's not
1624
1616
# one of the colocated branches
1625
if not any(viewvalues(names)) and active_branch is not None:
1617
if not any(names.values()) and active_branch is not None:
1626
1618
self.outf.write("* %s\n" % gettext("(default)"))
1627
1619
for name in sorted(names):
1628
1620
active = names[name]
1633
self.outf.write("%s %s\n" % (
1634
prefix, (name if PY3 else name.encode(self.outf.encoding))))
1625
self.outf.write("%s %s\n" % (prefix, name))
1637
1628
class cmd_checkout(Command):
1665
1656
"common operations like diff and status without "
1666
1657
"such access, and also support local commits."
1668
Option('files-from', type=text_type,
1659
Option('files-from', type=str,
1669
1660
help="Get file contents from this tree."),
1670
1661
Option('hardlink',
1671
1662
help='Hard-link working tree files where possible.'
2341
2332
_see_also = ['status']
2342
2333
takes_args = ['file*']
2343
2334
takes_options = [
2344
Option('diff-options', type=text_type,
2335
Option('diff-options', type=str,
2345
2336
help='Pass these options to the external diff program.'),
2346
Option('prefix', type=text_type,
2337
Option('prefix', type=str,
2347
2338
short_name='p',
2348
2339
help='Set prefixes added to old and new filenames, as '
2349
2340
'two values separated by a colon. (eg "old/:new/").'),
2351
2342
help='Branch/tree to compare from.',
2355
2346
help='Branch/tree to compare to.',
2360
2351
Option('using',
2361
2352
help='Use this command to compare files.',
2364
2355
RegistryOption('format',
2365
2356
short_name='F',
2760
2751
short_name='m',
2761
2752
help='Show revisions whose properties match this '
2764
2755
ListOption('match-message',
2765
2756
help='Show revisions whose message matches this '
2768
2759
ListOption('match-committer',
2769
2760
help='Show revisions whose committer matches this '
2772
2763
ListOption('match-author',
2773
2764
help='Show revisions whose authors match this '
2776
2767
ListOption('match-bugs',
2777
2768
help='Show revisions whose bugs match this '
2781
2772
encoding_type = 'replace'
3042
3033
Option('kind', short_name='k',
3043
3034
help=('List entries of a particular kind: file, '
3044
3035
'directory, symlink, tree-reference.'),
3366
3357
takes_options = ['directory',
3367
3358
Option('format',
3368
3359
help="Type of file to export to.",
3371
3362
Option('filters', help='Apply content filters to export the '
3372
3363
'convenient form.'),
3375
3366
help="Name of the root directory inside the exported file."),
3376
3367
Option('per-file-timestamps',
3377
3368
help='Set modification time of files to that of the last '
3573
3564
takes_args = ['selected*']
3574
3565
takes_options = [
3576
'exclude', type=text_type, short_name='x',
3567
'exclude', type=str, short_name='x',
3577
3568
help="Do not consider changes made to a given path."),
3578
Option('message', type=text_type,
3569
Option('message', type=str,
3579
3570
short_name='m',
3580
3571
help="Description of the new revision."),
3582
3573
Option('unchanged',
3583
3574
help='Commit even if nothing has changed.'),
3584
Option('file', type=text_type,
3575
Option('file', type=str,
3585
3576
short_name='F',
3586
3577
argname='msgfile',
3587
3578
help='Take commit message from this file.'),
3588
3579
Option('strict',
3589
3580
help="Refuse to commit if there are unknown "
3590
3581
"files in the working tree."),
3591
Option('commit-time', type=text_type,
3582
Option('commit-time', type=str,
3592
3583
help="Manually set a commit time using commit date "
3593
3584
"format, e.g. '2009-10-10 08:00:00 +0100'."),
3595
'bugs', type=text_type,
3596
3587
help="Link to a related bug. (see \"brz help bugs\")."),
3598
'fixes', type=text_type,
3599
3590
help="Mark a bug as being fixed by this revision "
3600
3591
"(see \"brz help bugs\")."),
3602
'author', type=text_type,
3603
3594
help="Set the author's name, if it's different "
3604
3595
"from the committer."),
3605
3596
Option('local',
4065
4056
def print_aliases(self):
4066
4057
"""Print out the defined aliases in a similar format to bash."""
4067
4058
aliases = _mod_config.GlobalConfig().get_aliases()
4068
for key, value in sorted(viewitems(aliases)):
4059
for key, value in sorted(aliases.items()):
4069
4060
self.outf.write('brz alias %s="%s"\n' % (key, value))
4071
4062
@display_command
4182
4173
'breezy.tests', 'parallel_registry'),
4183
4174
value_switches=False,
4185
Option('randomize', type=text_type, argname="SEED",
4176
Option('randomize', type=str, argname="SEED",
4186
4177
help='Randomize the order of tests using the given'
4187
4178
' seed or "now" for the current time.'),
4188
ListOption('exclude', type=text_type, argname="PATTERN",
4179
ListOption('exclude', type=str, argname="PATTERN",
4189
4180
short_name='x',
4190
4181
help='Exclude tests that match this regular'
4191
4182
' expression.'),
4195
4186
help='Output test progress via subunit v2.'),
4196
4187
Option('strict', help='Fail on missing dependencies or '
4197
4188
'known failures.'),
4198
Option('load-list', type=text_type, argname='TESTLISTFILE',
4189
Option('load-list', type=str, argname='TESTLISTFILE',
4199
4190
help='Load a test id list from a text file.'),
4200
ListOption('debugflag', type=text_type, short_name='E',
4191
ListOption('debugflag', type=str, short_name='E',
4201
4192
help='Turn on a selftest debug flag.'),
4202
ListOption('starting-with', type=text_type, argname='TESTID',
4193
ListOption('starting-with', type=str, argname='TESTID',
4203
4194
param_name='starting_with', short_name='s',
4204
4195
help='Load only the tests starting with TESTID.'),
5767
5758
diff='Normal unified diff.',
5768
5759
plain='No patch, just directive.'),
5769
5760
Option('sign', help='GPG-sign the directive.'), 'revision',
5770
Option('mail-to', type=text_type,
5761
Option('mail-to', type=str,
5771
5762
help='Instead of printing the directive, email to this '
5773
Option('message', type=text_type, short_name='m',
5764
Option('message', type=str, short_name='m',
5774
5765
help='Message to use when committing this merge.')
5924
5915
help='Branch to generate the submission from, '
5925
5916
'rather than the one containing the working directory.',
5926
5917
short_name='f',
5928
5919
Option('output', short_name='o',
5929
5920
help='Write merge directive to this file or directory; '
5930
5921
'use - for stdout.',
5932
5923
Option('strict',
5933
5924
help='Refuse to send if there are uncommitted changes in'
5934
5925
' the working tree, --no-strict disables the check.'),
5935
5926
Option('mail-to', help='Mail the request to this address.',
5939
Option('body', help='Body for the email.', type=text_type),
5930
Option('body', help='Body for the email.', type=str),
5940
5931
RegistryOption('format',
5941
5932
help='Use the specified output format.',
5942
5933
lazy_registry=('breezy.send', 'format_registry')),
5992
5983
help='Branch to generate the submission from, '
5993
5984
'rather than the one containing the working directory.',
5994
5985
short_name='f',
5996
5987
Option('output', short_name='o', help='Write directive to this file.',
5998
5989
Option('strict',
5999
5990
help='Refuse to bundle revisions if there are uncommitted'
6000
5991
' changes in the working tree, --no-strict disables the check.'),
6124
6115
from .tag import tag_sort_methods
6125
6116
branch, relpath = Branch.open_containing(directory)
6127
tags = list(viewitems(branch.tags.get_tag_dict()))
6118
tags = list(branch.tags.get_tag_dict().items())
6228
6219
with_no_trees='Reconfigure repository to not create '
6229
6220
'working trees on branches by default.'
6231
Option('bind-to', help='Branch to bind checkout to.', type=text_type),
6222
Option('bind-to', help='Branch to bind checkout to.', type=str),
6232
6223
Option('force',
6233
6224
help='Perform reconfiguration even if local changes'
6234
6225
' will be lost.'),
6235
6226
Option('stacked-on',
6236
6227
help='Reconfigure a branch to be stacked on another branch.',
6239
6230
Option('unstacked',
6240
6231
help='Reconfigure a branch to be unstacked. This '
6827
6818
takes_options = [Option('plugin',
6828
6819
help='Export help text from named command '
6829
6820
'(defaults to all built in commands).',
6831
6822
Option('include-duplicates',
6832
6823
help='Output multiple copies of the same msgid '
6833
6824
'string if it appears more than once.'),
6933
6924
takes_options = [
6936
Option('color', type=text_type, argname='when',
6927
Option('color', type=str, argname='when',
6937
6928
help='Show match in color. WHEN is never, always or auto.'),
6938
6929
Option('diff', short_name='p',
6939
6930
help='Grep for pattern in changeset for each revision.'),
6940
ListOption('exclude', type=text_type, argname='glob', short_name='X',
6931
ListOption('exclude', type=str, argname='glob', short_name='X',
6941
6932
help="Skip files whose base name matches GLOB."),
6942
ListOption('include', type=text_type, argname='glob', short_name='I',
6933
ListOption('include', type=str, argname='glob', short_name='I',
6943
6934
help="Search only files whose base name matches GLOB."),
6944
6935
Option('files-with-matches', short_name='l',
6945
6936
help='Print only the name of each input file in '