87
87
if file_list is None or len(file_list) == 0:
88
88
return WorkingTree.open_containing(default_branch)[0], file_list
89
89
tree = WorkingTree.open_containing(osutils.realpath(file_list[0]))[0]
90
return tree, safe_relpath_files(tree, file_list)
93
def safe_relpath_files(tree, file_list):
94
"""Convert file_list into a list of relpaths in tree.
96
:param tree: A tree to operate on.
97
:param file_list: A list of user provided paths or None.
98
:return: A list of relative paths.
99
:raises errors.PathNotChild: When a provided path is in a different tree
102
if file_list is None:
91
105
for filename in file_list:
93
107
new_list.append(tree.relpath(osutils.dereference_path(filename)))
94
108
except errors.PathNotChild:
95
109
raise errors.FileInWrongBranch(tree.branch, filename)
99
113
# TODO: Make sure no commands unconditionally use the working directory as a
2106
2120
committed. If a directory is specified then the directory and everything
2107
2121
within it is committed.
2123
When excludes are given, they take precedence over selected files.
2124
For example, too commit only changes within foo, but not changes within
2127
bzr commit foo -x foo/bar
2109
2129
If author of the change is not the same person as the committer, you can
2110
2130
specify the author's name using the --author option. The name should be
2111
2131
in the same format as a committer-id, e.g. "John Doe <jdoe@example.com>".
2141
2161
_see_also = ['bugs', 'uncommit']
2142
2162
takes_args = ['selected*']
2143
2163
takes_options = [
2164
ListOption('exclude', type=str, short_name='x',
2165
help="Do not consider changes made to a given path."),
2144
2166
Option('message', type=unicode,
2145
2167
short_name='m',
2146
2168
help="Description of the new revision."),
2196
2218
def run(self, message=None, file=None, verbose=False, selected_list=None,
2197
2219
unchanged=False, strict=False, local=False, fixes=None,
2198
author=None, show_diff=False):
2220
author=None, show_diff=False, exclude=None):
2199
2221
from bzrlib.errors import (
2200
2222
PointlessCommit,
2201
2223
ConflictsInTree,
2245
2267
raise errors.BzrCommandError(
2246
2268
"please specify either --message or --file")
2248
my_message = codecs.open(file, 'rt',
2270
my_message = codecs.open(file, 'rt',
2249
2271
bzrlib.user_encoding).read()
2250
2272
if my_message == "":
2251
2273
raise errors.BzrCommandError("empty commit message specified")
2256
2278
specific_files=selected_list,
2257
2279
allow_pointless=unchanged, strict=strict, local=local,
2258
2280
reporter=None, verbose=verbose, revprops=properties,
2282
exclude=safe_relpath_files(tree, exclude))
2260
2283
except PointlessCommit:
2261
2284
# FIXME: This should really happen before the file is read in;
2262
2285
# perhaps prepare the commit; get the message; then actually commit
2279
2302
class cmd_check(Command):
2280
"""Validate working tree structure, branch consistency and repository
2303
"""Validate working tree structure, branch consistency and repository history.
2283
2305
This command checks various invariants about branch and repository storage
2284
2306
to detect data corruption or bzr bugs.
2299
2321
in the checked revisions. Texts can be repeated when their file
2300
2322
entries are modified, but the file contents are not. It does not
2301
2323
indicate a problem.
2325
If no restrictions are specified, all Bazaar data that is found at the given
2326
location will be checked.
2330
Check the tree and branch at 'foo'::
2332
bzr check --tree --branch foo
2334
Check only the repository at 'bar'::
2336
bzr check --repo bar
2338
Check everything at 'baz'::
2304
2343
_see_also = ['reconcile']
2305
2344
takes_args = ['path?']
2306
takes_options = ['verbose']
2345
takes_options = ['verbose',
2346
Option('branch', help="Check the branch related to the"
2347
" current directory."),
2348
Option('repo', help="Check the repository related to the"
2349
" current directory."),
2350
Option('tree', help="Check the working tree related to"
2351
" the current directory.")]
2308
def run(self, path=None, verbose=False):
2353
def run(self, path=None, verbose=False, branch=False, repo=False,
2309
2355
from bzrlib.check import check_dwim
2310
2356
if path is None:
2312
check_dwim(path, verbose)
2358
if not branch and not repo and not tree:
2359
branch = repo = tree = True
2360
check_dwim(path, verbose, do_branch=branch, do_repo=repo, do_tree=tree)
2315
2363
class cmd_upgrade(Command):
4116
4164
raise errors.BzrCommandError('No submit branch known or'
4118
4166
if remembered_submit_branch:
4119
note('Using saved location: %s', submit_branch)
4167
note('Using saved location "%s" to determine what changes to submit.', submit_branch)
4121
4169
if mail_to is None:
4122
4170
submit_config = Branch.open(submit_branch).get_config()
4268
4316
It is an error to give a tag name that already exists unless you pass
4269
4317
--force, in which case the tag is moved to point to the new revision.
4319
To rename a tag (change the name but keep it on the same revsion), run ``bzr
4320
tag new-name -r tag:old-name`` and then ``bzr tag --delete oldname``.
4272
4323
_see_also = ['commit', 'tags']