184
183
# avoid circular imports
185
184
from bzrlib import commit
186
187
possible_master_transports=[]
187
revprops = commit.Commit.update_revprops(
190
kwargs.pop('authors', None),
191
kwargs.pop('author', None),
188
if not 'branch-nick' in revprops:
189
revprops['branch-nick'] = self.branch._get_nick(
192
190
kwargs.get('local', False),
193
191
possible_master_transports)
192
authors = kwargs.pop('authors', None)
193
author = kwargs.pop('author', None)
194
if authors is not None:
195
if author is not None:
196
raise AssertionError('Specifying both author and authors '
197
'is not allowed. Specify just authors instead')
198
if 'author' in revprops or 'authors' in revprops:
199
# XXX: maybe we should just accept one of them?
200
raise AssertionError('author property given twice')
202
for individual in authors:
203
if '\n' in individual:
204
raise AssertionError('\\n is not a valid character '
205
'in an author identity')
206
revprops['authors'] = '\n'.join(authors)
207
if author is not None:
208
symbol_versioning.warn('The parameter author was deprecated'
209
' in version 1.13. Use authors instead',
211
if 'author' in revprops or 'authors' in revprops:
212
# XXX: maybe we should just accept one of them?
213
raise AssertionError('author property given twice')
215
raise AssertionError('\\n is not a valid character '
216
'in an author identity')
217
revprops['authors'] = author
194
218
# args for wt.commit start at message from the Commit.commit method,
195
219
args = (message, ) + args
196
220
for hook in MutableTree.hooks['start_commit']:
237
def check_changed_or_out_of_date(self, strict, opt_name,
238
more_error, more_warning):
261
def warn_if_changed_or_out_of_date(self, strict, opt_name, more_msg):
239
262
"""Check the tree for uncommitted changes and branch synchronization.
241
264
If strict is None and not set in the config files, a warning is issued.
247
270
:param opt_name: strict option name to search in config file.
249
:param more_error: Details about how to avoid the check.
251
:param more_warning: Details about what is happening.
272
:param more_msg: Details about how to avoid the warnings.
253
274
if strict is None:
254
275
strict = self.branch.get_config().get_user_option_as_bool(opt_name)
255
276
if strict is not False:
257
278
if (self.has_changes()):
258
err_class = errors.UncommittedChanges
279
err = errors.UncommittedChanges(self, more=more_msg)
259
280
elif self.last_revision() != self.branch.last_revision():
260
281
# The tree has lost sync with its branch, there is little
261
282
# chance that the user is aware of it but he can still force
262
283
# the action with --no-strict
263
err_class = errors.OutOfDateTree
264
if err_class is not None:
284
err = errors.OutOfDateTree(self, more=more_msg)
265
286
if strict is None:
266
err = err_class(self, more=more_warning)
267
287
# We don't want to interrupt the user if he expressed no
268
288
# preference about strict.
269
trace.warning('%s', err._format())
289
trace.warning('%s', (err._format(),))
271
err = err_class(self, more=more_error)
376
395
This is designed more towards DWIM for humans than API clarity.
377
396
For the specific behaviour see the help for cmd_add().
379
:param file_list: List of zero or more paths. *NB: these are
380
interpreted relative to the process cwd, not relative to the
381
tree.* (Add and most other tree methods use tree-relative
383
398
:param action: A reporter to be called with the inventory, parent_ie,
384
399
path and kind of the path being added. It may return a file_id if
385
400
a specific one should be used.
416
431
for c in self.conflicts():
417
432
conflicts_related.update(c.associated_filenames())
419
# expand any symlinks in the directory part, while leaving the
421
file_list = map(osutils.normalizepath, file_list)
423
434
# validate user file paths and convert all paths to tree
424
435
# relative : it's cheaper to make a tree relative path an abspath
425
436
# than to convert an abspath to tree relative, and it's cheaper to
724
735
file_id or None to generate a new file id
727
# if the parent exists, but isn't a directory, we have to do the
728
# kind change now -- really the inventory shouldn't pretend to know
729
# the kind of wt files, but it does.
730
if parent_ie.kind != 'directory':
731
# nb: this relies on someone else checking that the path we're using
732
# doesn't contain symlinks.
733
new_parent_ie = inventory.make_entry('directory', parent_ie.name,
734
parent_ie.parent_id, parent_ie.file_id)
735
del inv[parent_ie.file_id]
736
inv.add(new_parent_ie)
737
parent_ie = new_parent_ie
738
738
file_id = file_id_callback(inv, parent_ie, path, kind)
739
739
entry = inv.make_entry(kind, path.base_path, parent_ie.file_id,