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