275
275
--dry-run will show which files would be added, but not actually
278
--file-ids-from will try to use the file ids from the supplied path.
279
It looks up ids trying to find a matching parent directory with the
280
same filename, and then by pure path.
278
282
takes_args = ['file*']
279
takes_options = ['no-recurse', 'dry-run', 'verbose']
283
takes_options = ['no-recurse', 'dry-run', 'verbose',
284
Option('file-ids-from', type=unicode,
285
help='Lookup file ids from here')]
280
286
encoding_type = 'replace'
282
def run(self, file_list, no_recurse=False, dry_run=False, verbose=False):
288
def run(self, file_list, no_recurse=False, dry_run=False, verbose=False,
283
290
import bzrlib.add
285
action = bzrlib.add.AddAction(to_file=self.outf,
286
should_print=(not is_quiet()))
288
added, ignored = bzrlib.add.smart_add(file_list, not no_recurse,
292
if file_ids_from is not None:
294
base_tree, base_path = WorkingTree.open_containing(
296
except errors.NoWorkingTree:
297
base_branch, base_path = branch.Branch.open_containing(
299
base_tree = base_branch.basis_tree()
301
action = bzrlib.add.AddFromBaseAction(base_tree, base_path,
302
to_file=self.outf, should_print=(not is_quiet()))
304
action = bzrlib.add.AddAction(to_file=self.outf,
305
should_print=(not is_quiet()))
307
added, ignored = bzrlib.add.smart_add(file_list, not no_recurse,
289
308
action=action, save=not dry_run)
290
309
if len(ignored) > 0: