74
75
from bzrlib.trace import mutter, note, warning, is_quiet, get_verbosity_level
77
@symbol_versioning.deprecated_function(symbol_versioning.deprecated_in((2, 3, 0)))
78
78
def tree_files(file_list, default_branch=u'.', canonicalize=True,
80
return internal_tree_files(file_list, default_branch, canonicalize,
81
return internal_tree_files(file_list, default_branch, canonicalize,
83
except errors.FileInWrongBranch, e:
84
raise errors.BzrCommandError("%s is not in the same branch as %s" %
85
(e.path, file_list[0]))
84
88
def tree_files_for_add(file_list):
149
153
# XXX: Bad function name; should possibly also be a class method of
150
154
# WorkingTree rather than a function.
151
@symbol_versioning.deprecated_function(symbol_versioning.deprecated_in((2, 3, 0)))
152
155
def internal_tree_files(file_list, default_branch=u'.', canonicalize=True,
153
156
apply_view=True):
154
157
"""Convert command-line paths to a WorkingTree and relative paths.
156
Deprecated: use WorkingTree.open_containing_paths instead.
158
159
This is typically used for command-line processors that take one or
159
160
more filenames, and infer the workingtree that contains them.
171
172
:return: workingtree, [relative_paths]
173
return WorkingTree.open_containing_paths(
174
file_list, default_directory='.',
174
if file_list is None or len(file_list) == 0:
175
tree = WorkingTree.open_containing(default_branch)[0]
176
if tree.supports_views() and apply_view:
177
view_files = tree.views.lookup_view()
179
file_list = view_files
180
view_str = views.view_display_str(view_files)
181
note("Ignoring files outside view. View is %s" % view_str)
182
return tree, file_list
183
tree = WorkingTree.open_containing(osutils.realpath(file_list[0]))[0]
184
return tree, safe_relpath_files(tree, file_list, canonicalize,
185
apply_view=apply_view)
188
def safe_relpath_files(tree, file_list, canonicalize=True, apply_view=True):
189
"""Convert file_list into a list of relpaths in tree.
191
:param tree: A tree to operate on.
192
:param file_list: A list of user provided paths or None.
193
:param apply_view: if True and a view is set, apply it or check that
194
specified files are within it
195
:return: A list of relative paths.
196
:raises errors.PathNotChild: When a provided path is in a different tree
199
if file_list is None:
201
if tree.supports_views() and apply_view:
202
view_files = tree.views.lookup_view()
206
# tree.relpath exists as a "thunk" to osutils, but canonical_relpath
207
# doesn't - fix that up here before we enter the loop.
209
fixer = lambda p: osutils.canonical_relpath(tree.basedir, p)
212
for filename in file_list:
214
relpath = fixer(osutils.dereference_path(filename))
215
if view_files and not osutils.is_inside_any(view_files, relpath):
216
raise errors.FileOutsideView(filename, view_files)
217
new_list.append(relpath)
218
except errors.PathNotChild:
219
raise errors.FileInWrongBranch(tree.branch, filename)
179
223
def _get_view_info_for_change_reporter(tree):
279
323
raise errors.BzrCommandError('bzr status --revision takes exactly'
280
324
' one or two revision specifiers')
282
tree, relfile_list = WorkingTree.open_containing_paths(file_list)
326
tree, relfile_list = tree_files(file_list)
283
327
# Avoid asking for specific files when that is not needed.
284
328
if relfile_list == ['']:
285
329
relfile_list = None
468
512
if (working.has_changes()):
469
513
raise errors.UncommittedChanges(working)
470
if working.get_shelf_manager().last_shelf() is not None:
471
raise errors.ShelvedChanges(working)
473
515
if working.user_url != working.branch.user_url:
474
516
raise errors.BzrCommandError("You cannot remove the working tree"
717
759
raise errors.BzrCommandError('invalid kind %r specified' % (kind,))
719
761
revision = _get_one_revision('inventory', revision)
720
work_tree, file_list = WorkingTree.open_containing_paths(file_list)
762
work_tree, file_list = tree_files(file_list)
721
763
self.add_cleanup(work_tree.lock_read().unlock)
722
764
if revision is not None:
723
765
tree = revision.as_tree(work_tree.branch)
789
831
if len(names_list) < 2:
790
832
raise errors.BzrCommandError("missing file argument")
791
tree, rel_names = WorkingTree.open_containing_paths(names_list, canonicalize=False)
833
tree, rel_names = tree_files(names_list, canonicalize=False)
792
834
self.add_cleanup(tree.lock_tree_write().unlock)
793
835
self._run(tree, names_list, rel_names, after)
800
842
raise errors.BzrCommandError('--after cannot be specified with'
802
work_tree, file_list = WorkingTree.open_containing_paths(
803
names_list, default_directory='.')
844
work_tree, file_list = tree_files(names_list, default_branch='.')
804
845
self.add_cleanup(work_tree.lock_tree_write().unlock)
805
846
rename_map.RenameMap.guess_renames(work_tree, dry_run)
1135
1176
_see_also = ['checkout']
1136
1177
takes_args = ['from_location', 'to_location?']
1137
takes_options = ['revision',
1138
Option('hardlink', help='Hard-link working tree files where possible.'),
1139
Option('files-from', type=str,
1140
help="Get file contents from this tree."),
1178
takes_options = ['revision', Option('hardlink',
1179
help='Hard-link working tree files where possible.'),
1141
1180
Option('no-tree',
1142
1181
help="Create a branch without a working-tree."),
1143
1182
Option('switch',
1162
1201
def run(self, from_location, to_location=None, revision=None,
1163
1202
hardlink=False, stacked=False, standalone=False, no_tree=False,
1164
use_existing_dir=False, switch=False, bind=False,
1203
use_existing_dir=False, switch=False, bind=False):
1166
1204
from bzrlib import switch as _mod_switch
1167
1205
from bzrlib.tag import _merge_tags_if_possible
1168
1206
accelerator_tree, br_from = bzrdir.BzrDir.open_tree_or_branch(
1170
if not (hardlink or files_from):
1171
# accelerator_tree is usually slower because you have to read N
1172
# files (no readahead, lots of seeks, etc), but allow the user to
1173
# explicitly request it
1174
accelerator_tree = None
1175
if files_from is not None and files_from != from_location:
1176
accelerator_tree = WorkingTree.open(files_from)
1177
1208
revision = _get_one_revision('branch', revision)
1178
1209
self.add_cleanup(br_from.lock_read().unlock)
1179
1210
if revision is not None:
1286
1317
to_location = branch_location
1287
1318
accelerator_tree, source = bzrdir.BzrDir.open_tree_or_branch(
1288
1319
branch_location)
1289
if not (hardlink or files_from):
1290
# accelerator_tree is usually slower because you have to read N
1291
# files (no readahead, lots of seeks, etc), but allow the user to
1292
# explicitly request it
1293
accelerator_tree = None
1294
1320
revision = _get_one_revision('checkout', revision)
1295
if files_from is not None and files_from != branch_location:
1321
if files_from is not None:
1296
1322
accelerator_tree = WorkingTree.open(files_from)
1297
1323
if revision is not None:
1298
1324
revision_id = revision.as_revision_id(source)
1354
1380
If you want to discard your local changes, you can just do a
1355
1381
'bzr revert' instead of 'bzr commit' after the update.
1357
If you want to restore a file that has been removed locally, use
1358
'bzr revert' instead of 'bzr update'.
1360
1383
If the tree's branch is bound to a master branch, it will also update
1361
1384
the branch from the master.
1480
1503
class cmd_remove(Command):
1481
1504
__doc__ = """Remove files or directories.
1483
This makes Bazaar stop tracking changes to the specified files. Bazaar will
1484
delete them if they can easily be recovered using revert otherwise they
1485
will be backed up (adding an extention of the form .~#~). If no options or
1486
parameters are given Bazaar will scan for files that are being tracked by
1487
Bazaar but missing in your tree and stop tracking them for you.
1506
This makes bzr stop tracking changes to the specified files. bzr will delete
1507
them if they can easily be recovered using revert. If no options or
1508
parameters are given bzr will scan for files that are being tracked by bzr
1509
but missing in your tree and stop tracking them for you.
1489
1511
takes_args = ['file*']
1490
1512
takes_options = ['verbose',
1492
1514
RegistryOption.from_kwargs('file-deletion-strategy',
1493
1515
'The file deletion mode to be used.',
1494
1516
title='Deletion Strategy', value_switches=True, enum_switch=False,
1495
safe='Backup changed files (default).',
1517
safe='Only delete files if they can be'
1518
' safely recovered (default).',
1496
1519
keep='Delete from bzr but leave the working copy.',
1497
1520
force='Delete all the specified files, even if they can not be '
1498
1521
'recovered and even if they are non-empty directories.')]
1502
1525
def run(self, file_list, verbose=False, new=False,
1503
1526
file_deletion_strategy='safe'):
1504
tree, file_list = WorkingTree.open_containing_paths(file_list)
1527
tree, file_list = tree_files(file_list)
1506
1529
if file_list is not None:
1507
1530
file_list = [f for f in file_list]
1596
1619
_see_also = ['check']
1597
1620
takes_args = ['branch?']
1599
Option('canonicalize-chks',
1600
help='Make sure CHKs are in canonical form (repairs '
1605
def run(self, branch=".", canonicalize_chks=False):
1622
def run(self, branch="."):
1606
1623
from bzrlib.reconcile import reconcile
1607
1624
dir = bzrdir.BzrDir.open(branch)
1608
reconcile(dir, canonicalize_chks=canonicalize_chks)
1611
1628
class cmd_revision_history(Command):
1955
1968
old_branch, new_branch,
1956
1969
specific_files, extra_trees) = get_trees_and_branches_to_diff_locked(
1957
1970
file_list, revision, old, new, self.add_cleanup, apply_view=True)
1958
# GNU diff on Windows uses ANSI encoding for filenames
1959
path_encoding = osutils.get_diff_header_encoding()
1960
1971
return show_diff_trees(old_tree, new_tree, sys.stdout,
1961
1972
specific_files=specific_files,
1962
1973
external_diff_options=diff_options,
1963
1974
old_label=old_label, new_label=new_label,
1964
extra_trees=extra_trees,
1965
path_encoding=path_encoding,
1975
extra_trees=extra_trees, using=using,
1967
1976
format_cls=format)
2697
2706
"NAME_PATTERN or --default-rules.")
2698
2707
name_pattern_list = [globbing.normalize_pattern(p)
2699
2708
for p in name_pattern_list]
2701
for p in name_pattern_list:
2702
if not globbing.Globster.is_pattern_valid(p):
2703
bad_patterns += ('\n %s' % p)
2705
msg = ('Invalid ignore pattern(s) found. %s' % bad_patterns)
2706
ui.ui_factory.show_error(msg)
2707
raise errors.InvalidPattern('')
2708
2709
for name_pattern in name_pattern_list:
2709
2710
if (name_pattern[0] == '/' or
2710
2711
(len(name_pattern) > 1 and name_pattern[1] == ':')):
2714
2715
ignores.tree_ignores_add_patterns(tree, name_pattern_list)
2715
2716
ignored = globbing.Globster(name_pattern_list)
2717
self.add_cleanup(tree.lock_read().unlock)
2718
2719
for entry in tree.list_files():
2720
2721
if id is not None:
2721
2722
filename = entry[0]
2722
2723
if ignored.match(filename):
2723
2724
matches.append(filename)
2724
2726
if len(matches) > 0:
2725
2727
self.outf.write("Warning: the following files are version controlled and"
2726
2728
" match your ignore pattern:\n%s"
3103
3105
properties = {}
3105
tree, selected_list = WorkingTree.open_containing_paths(selected_list)
3107
tree, selected_list = tree_files(selected_list)
3106
3108
if selected_list == ['']:
3107
3109
# workaround - commit of root of tree should be exactly the same
3108
3110
# as just default commit in that tree, and succeed even though
3143
3145
def get_message(commit_obj):
3144
3146
"""Callback to get commit message"""
3148
f = codecs.open(file, 'rt', osutils.get_user_encoding())
3148
my_message = f.read().decode(osutils.get_user_encoding())
3150
my_message = f.read()
3151
3153
elif message is not None:
3182
3184
reporter=None, verbose=verbose, revprops=properties,
3183
3185
authors=author, timestamp=commit_stamp,
3184
3186
timezone=offset,
3185
exclude=tree.safe_relpath_files(exclude))
3187
exclude=safe_relpath_files(tree, exclude))
3186
3188
except PointlessCommit:
3187
3189
raise errors.BzrCommandError("No changes to commit."
3188
3190
" Use --unchanged to commit anyhow.")
3308
3310
bzr whoami "Frank Chu <fchu@example.com>"
3310
takes_options = [ 'directory',
3312
takes_options = [ Option('email',
3312
3313
help='Display email address only.'),
3313
3314
Option('branch',
3314
3315
help='Set identity for the current branch instead of '
3318
3319
encoding_type = 'replace'
3320
3321
@display_command
3321
def run(self, email=False, branch=False, name=None, directory=None):
3322
def run(self, email=False, branch=False, name=None):
3322
3323
if name is None:
3323
if directory is None:
3324
# use branch if we're inside one; otherwise global config
3326
c = Branch.open_containing(u'.')[0].get_config()
3327
except errors.NotBranchError:
3328
c = _mod_config.GlobalConfig()
3330
c = Branch.open(directory).get_config()
3324
# use branch if we're inside one; otherwise global config
3326
c = Branch.open_containing('.')[0].get_config()
3327
except errors.NotBranchError:
3328
c = config.GlobalConfig()
3332
3330
self.outf.write(c.user_email() + '\n')
3337
3335
# display a warning if an email address isn't included in the given name.
3339
_mod_config.extract_email_address(name)
3337
config.extract_email_address(name)
3340
3338
except errors.NoEmailInUsername, e:
3341
3339
warning('"%s" does not seem to contain an email address. '
3342
3340
'This is allowed, but not recommended.', name)
3344
3342
# use global config unless --branch given
3346
if directory is None:
3347
c = Branch.open_containing(u'.')[0].get_config()
3349
c = Branch.open(directory).get_config()
3344
c = Branch.open_containing('.')[0].get_config()
3351
c = _mod_config.GlobalConfig()
3346
c = config.GlobalConfig()
3352
3347
c.set_user_option('email', name)
3421
3416
'bzr alias --remove expects an alias to remove.')
3422
3417
# If alias is not found, print something like:
3423
3418
# unalias: foo: not found
3424
c = _mod_config.GlobalConfig()
3419
c = config.GlobalConfig()
3425
3420
c.unset_alias(alias_name)
3427
3422
@display_command
3428
3423
def print_aliases(self):
3429
3424
"""Print out the defined aliases in a similar format to bash."""
3430
aliases = _mod_config.GlobalConfig().get_aliases()
3425
aliases = config.GlobalConfig().get_aliases()
3431
3426
for key, value in sorted(aliases.iteritems()):
3432
3427
self.outf.write('bzr alias %s="%s"\n' % (key, value))
3444
3439
def set_alias(self, alias_name, alias_command):
3445
3440
"""Save the alias in the global config."""
3446
c = _mod_config.GlobalConfig()
3441
c = config.GlobalConfig()
3447
3442
c.set_alias(alias_name, alias_command)
3484
3479
If you set BZR_TEST_PDB=1 when running selftest, failing tests will drop
3485
3480
into a pdb postmortem session.
3487
The --coverage=DIRNAME global option produces a report with covered code
3491
3483
Run only tests relating to 'ignore'::
3525
3517
'throughout the test suite.',
3526
3518
type=get_transport_type),
3527
3519
Option('benchmark',
3528
help='Run the benchmarks rather than selftests.',
3520
help='Run the benchmarks rather than selftests.'),
3530
3521
Option('lsprof-timed',
3531
3522
help='Generate lsprof output for benchmarked'
3532
3523
' sections of code.'),
3533
3524
Option('lsprof-tests',
3534
3525
help='Generate lsprof output for each test.'),
3526
Option('cache-dir', type=str,
3527
help='Cache intermediate benchmark output in this '
3535
3529
Option('first',
3536
3530
help='Run all tests, but run specified tests first.',
3537
3531
short_name='f',
3572
3566
def run(self, testspecs_list=None, verbose=False, one=False,
3573
3567
transport=None, benchmark=None,
3568
lsprof_timed=None, cache_dir=None,
3575
3569
first=False, list_only=False,
3576
3570
randomize=None, exclude=None, strict=False,
3577
3571
load_list=None, debugflag=None, starting_with=None, subunit=False,
3578
3572
parallel=None, lsprof_tests=False):
3579
from bzrlib import tests
3573
from bzrlib.tests import selftest
3574
import bzrlib.benchmarks as benchmarks
3575
from bzrlib.benchmarks import tree_creator
3577
# Make deprecation warnings visible, unless -Werror is set
3578
symbol_versioning.activate_deprecation_warnings(override=False)
3580
if cache_dir is not None:
3581
tree_creator.TreeCreator.CACHE_ROOT = osutils.abspath(cache_dir)
3581
3582
if testspecs_list is not None:
3582
3583
pattern = '|'.join(testspecs_list)
3602
3603
self.additional_selftest_args.setdefault(
3603
3604
'suite_decorators', []).append(parallel)
3605
raise errors.BzrCommandError(
3606
"--benchmark is no longer supported from bzr 2.2; "
3607
"use bzr-usertest instead")
3608
test_suite_factory = None
3606
test_suite_factory = benchmarks.test_suite
3607
# Unless user explicitly asks for quiet, be verbose in benchmarks
3608
verbose = not is_quiet()
3609
# TODO: should possibly lock the history file...
3610
benchfile = open(".perf_history", "at", buffering=1)
3611
self.add_cleanup(benchfile.close)
3613
test_suite_factory = None
3609
3615
selftest_kwargs = {"verbose": verbose,
3610
3616
"pattern": pattern,
3611
3617
"stop_on_failure": one,
3613
3619
"test_suite_factory": test_suite_factory,
3614
3620
"lsprof_timed": lsprof_timed,
3615
3621
"lsprof_tests": lsprof_tests,
3622
"bench_history": benchfile,
3616
3623
"matching_tests_first": first,
3617
3624
"list_only": list_only,
3618
3625
"random_seed": randomize,
3623
3630
"starting_with": starting_with
3625
3632
selftest_kwargs.update(self.additional_selftest_args)
3627
# Make deprecation warnings visible, unless -Werror is set
3628
cleanup = symbol_versioning.activate_deprecation_warnings(
3631
result = tests.selftest(**selftest_kwargs)
3633
result = selftest(**selftest_kwargs)
3634
3634
return int(not result)
3883
3883
def _do_preview(self, merger):
3884
3884
from bzrlib.diff import show_diff_trees
3885
3885
result_tree = self._get_preview(merger)
3886
path_encoding = osutils.get_diff_header_encoding()
3887
3886
show_diff_trees(merger.this_tree, result_tree, self.outf,
3888
old_label='', new_label='',
3889
path_encoding=path_encoding)
3887
old_label='', new_label='')
3891
3889
def _do_merge(self, merger, change_reporter, allow_pending, verified):
3892
3890
merger.change_reporter = change_reporter
4079
4077
from bzrlib.conflicts import restore
4080
4078
if merge_type is None:
4081
4079
merge_type = _mod_merge.Merge3Merger
4082
tree, file_list = WorkingTree.open_containing_paths(file_list)
4080
tree, file_list = tree_files(file_list)
4083
4081
self.add_cleanup(tree.lock_write().unlock)
4084
4082
parents = tree.get_parent_ids()
4085
4083
if len(parents) != 2:
4196
4194
def run(self, revision=None, no_backup=False, file_list=None,
4197
4195
forget_merges=None):
4198
tree, file_list = WorkingTree.open_containing_paths(file_list)
4196
tree, file_list = tree_files(file_list)
4199
4197
self.add_cleanup(tree.lock_tree_write().unlock)
4200
4198
if forget_merges:
4201
4199
tree.set_parent_ids(tree.get_parent_ids()[:1])
4291
4289
_see_also = ['merge', 'pull']
4292
4290
takes_args = ['other_branch?']
4293
4291
takes_options = [
4295
4292
Option('reverse', 'Reverse the order of revisions.'),
4296
4293
Option('mine-only',
4297
4294
'Display changes in the local branch only.'),
4319
4316
theirs_only=False,
4320
4317
log_format=None, long=False, short=False, line=False,
4321
4318
show_ids=False, verbose=False, this=False, other=False,
4322
include_merges=False, revision=None, my_revision=None,
4319
include_merges=False, revision=None, my_revision=None):
4324
4320
from bzrlib.missing import find_unmerged, iter_log_revisions
4325
4321
def message(s):
4326
4322
if not is_quiet():
4804
4800
self.outf.write('The above revision(s) will be removed.\n')
4807
if not ui.ui_factory.confirm_action(
4808
'Uncommit these revisions',
4809
'bzrlib.builtins.uncommit',
4811
self.outf.write('Canceled\n')
4803
if not ui.ui_factory.get_boolean('Are you sure'):
4804
self.outf.write('Canceled')
4814
4807
mutter('Uncommitting from {%s} to {%s}',
4822
4815
class cmd_break_lock(Command):
4823
__doc__ = """Break a dead lock.
4825
This command breaks a lock on a repository, branch, working directory or
4816
__doc__ = """Break a dead lock on a repository, branch or working directory.
4828
4818
CAUTION: Locks should only be broken when you are sure that the process
4829
4819
holding the lock has been stopped.
4836
4826
bzr break-lock bzr+ssh://example.com/bzr/foo
4837
bzr break-lock --conf ~/.bazaar
4840
4828
takes_args = ['location?']
4843
help='LOCATION is the directory where the config lock is.'),
4845
help='Do not ask for confirmation before breaking the lock.'),
4848
def run(self, location=None, config=False, force=False):
4830
def run(self, location=None, show=False):
4849
4831
if location is None:
4850
4832
location = u'.'
4852
ui.ui_factory = ui.ConfirmationUserInterfacePolicy(ui.ui_factory,
4854
{'bzrlib.lockdir.break': True})
4856
conf = _mod_config.LockableConfig(file_name=location)
4859
control, relpath = bzrdir.BzrDir.open_containing(location)
4861
control.break_lock()
4862
except NotImplementedError:
4833
control, relpath = bzrdir.BzrDir.open_containing(location)
4835
control.break_lock()
4836
except NotImplementedError:
4866
4840
class cmd_wait_until_signalled(Command):
4930
4904
def run(self, port=None, inet=False, directory=None, allow_writes=False,
4931
4905
protocol=None):
4932
from bzrlib import transport
4906
from bzrlib.transport import get_transport, transport_server_registry
4933
4907
if directory is None:
4934
4908
directory = os.getcwd()
4935
4909
if protocol is None:
4936
protocol = transport.transport_server_registry.get()
4910
protocol = transport_server_registry.get()
4937
4911
host, port = self.get_host_and_port(port)
4938
4912
url = urlutils.local_path_to_url(directory)
4939
4913
if not allow_writes:
4940
4914
url = 'readonly+' + url
4941
t = transport.get_transport(url)
4942
protocol(t, host, port, inet)
4915
transport = get_transport(url)
4916
protocol(transport, host, port, inet)
4945
4919
class cmd_join(Command):
4951
4925
not part of it. (Such trees can be produced by "bzr split", but also by
4952
4926
running "bzr branch" with the target inside a tree.)
4954
The result is a combined tree, with the subtree no longer an independent
4928
The result is a combined tree, with the subtree no longer an independant
4955
4929
part. This is marked as a merge of the subtree into the containing tree,
4956
4930
and all history is preserved.
5057
5030
encoding_type = 'exact'
5059
5032
def run(self, submit_branch=None, public_branch=None, patch_type='bundle',
5060
sign=False, revision=None, mail_to=None, message=None,
5033
sign=False, revision=None, mail_to=None, message=None):
5062
5034
from bzrlib.revision import ensure_null, NULL_REVISION
5063
5035
include_patch, include_bundle = {
5064
5036
'plain': (False, False),
5065
5037
'diff': (True, False),
5066
5038
'bundle': (True, True),
5068
branch = Branch.open(directory)
5040
branch = Branch.open('.')
5069
5041
stored_submit_branch = branch.get_submit_branch()
5070
5042
if submit_branch is None:
5071
5043
submit_branch = stored_submit_branch
5561
5533
takes_args = ['to_location?']
5562
takes_options = ['directory',
5534
takes_options = [Option('force',
5564
5535
help='Switch even if local commits will be lost.'),
5566
5537
Option('create-branch', short_name='b',
5571
5542
def run(self, to_location=None, force=False, create_branch=False,
5572
revision=None, directory=u'.'):
5573
5544
from bzrlib import switch
5574
tree_location = directory
5575
5546
revision = _get_one_revision('switch', revision)
5576
5547
control_dir = bzrdir.BzrDir.open_containing(tree_location)[0]
5577
5548
if to_location is None:
5578
5549
if revision is None:
5579
5550
raise errors.BzrCommandError('You must supply either a'
5580
5551
' revision or a location')
5581
to_location = tree_location
5583
5554
branch = control_dir.open_branch()
5584
5555
had_explicit_nick = branch.get_config().has_explicit_nickname()
5722
tree, file_list = WorkingTree.open_containing_paths(file_list,
5693
tree, file_list = tree_files(file_list, apply_view=False)
5724
5694
current_view, view_dict = tree.views.get_view_info()
5725
5695
if name is None:
5726
5696
name = current_view
5875
5844
_see_also = ['unshelve']
5877
5846
def run(self, revision=None, all=False, file_list=None, message=None,
5878
writer=None, list=False, destroy=False, directory=u'.'):
5847
writer=None, list=False, destroy=False):
5880
5849
return self.run_for_list()
5881
5850
from bzrlib.shelf_ui import Shelver
5883
5852
writer = bzrlib.option.diff_writer_registry.get()
5885
5854
shelver = Shelver.from_args(writer(sys.stdout), revision, all,
5886
file_list, message, destroy=destroy, directory=directory)
5855
file_list, message, destroy=destroy)
5918
5887
takes_args = ['shelf_id?']
5919
5888
takes_options = [
5921
5889
RegistryOption.from_kwargs(
5922
5890
'action', help="The action to perform.",
5923
5891
enum_switch=False, value_switches=True,
5932
5900
_see_also = ['shelve']
5934
def run(self, shelf_id=None, action='apply', directory=u'.'):
5902
def run(self, shelf_id=None, action='apply'):
5935
5903
from bzrlib.shelf_ui import Unshelver
5936
unshelver = Unshelver.from_args(shelf_id, action, directory=directory)
5904
unshelver = Unshelver.from_args(shelf_id, action)
5938
5906
unshelver.run()