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