364
359
# --create-prefix option ?)
365
360
changes = self.tree.changes_from(from_tree)
366
361
with self.tree.lock_read():
367
for (path, id, kind) in changes.removed:
368
if self.is_ignored(path):
362
for change in changes.removed:
363
if self.is_ignored(change.path[0]):
369
364
if not self.quiet:
370
self.outf.write('Ignoring %s\n' % path)
365
self.outf.write('Ignoring %s\n' % change.path[0])
373
self.delete_remote_file(path)
374
elif kind is 'directory':
375
self.delete_remote_dir_maybe(path)
376
elif kind == 'symlink':
377
self.delete_remote_file(path)
367
if change.kind[0] == 'file':
368
self.delete_remote_file(change.path[0])
369
elif change.kind[0] == 'directory':
370
self.delete_remote_dir_maybe(change.path[0])
371
elif change.kind[0] == 'symlink':
372
self.delete_remote_file(change.path[0])
379
374
raise NotImplementedError
381
for (old_path, new_path, id, kind,
382
content_change, exec_change) in changes.renamed:
383
if self.is_ignored(old_path) and self.is_ignored(new_path):
376
for change in changes.renamed:
377
if self.is_ignored(change.path[0]) and self.is_ignored(change.path[1]):
384
378
if not self.quiet:
385
self.outf.write('Ignoring %s\n' % old_path)
386
self.outf.write('Ignoring %s\n' % new_path)
379
self.outf.write('Ignoring %s\n' % change.path[0])
380
self.outf.write('Ignoring %s\n' % change.path[1])
389
# We update the old_path content because renames and
382
if change.changed_content:
383
# We update the change.path[0] content because renames and
390
384
# deletions are differed.
391
self.upload_file(old_path, new_path)
392
self.rename_remote(old_path, new_path)
385
self.upload_file(change.path[0], change.path[1])
386
self.rename_remote(change.path[0], change.path[1])
393
387
self.finish_renames()
394
388
self.finish_deletions()
396
for (path, id, old_kind, new_kind) in changes.kind_changed:
397
if self.is_ignored(path):
399
self.outf.write('Ignoring %s\n' % path)
401
if old_kind in ('file', 'symlink'):
402
self.delete_remote_file(path)
403
elif old_kind == 'directory':
404
self.delete_remote_dir(path)
406
raise NotImplementedError
408
if new_kind == 'file':
409
self.upload_file(path, path)
410
elif new_kind == 'symlink':
411
target = self.tree.get_symlink_target(path)
412
self.upload_symlink(path, target)
413
elif new_kind is 'directory':
414
self.make_remote_dir(path)
416
raise NotImplementedError
418
for (path, id, kind) in changes.added:
419
if self.is_ignored(path):
421
self.outf.write('Ignoring %s\n' % path)
424
self.upload_file(path, path)
425
elif kind == 'directory':
426
self.make_remote_dir(path)
427
elif kind == 'symlink':
428
target = self.tree.get_symlink_target(path)
390
for change in changes.kind_changed:
391
if self.is_ignored(change.path[1]):
393
self.outf.write('Ignoring %s\n' % change.path[1])
395
if change.kind[0] in ('file', 'symlink'):
396
self.delete_remote_file(change.path[0])
397
elif change.kind[0] == 'directory':
398
self.delete_remote_dir(change.path[0])
400
raise NotImplementedError
402
if change.kind[1] == 'file':
403
self.upload_file(change.path[1], change.path[1])
404
elif change.kind[1] == 'symlink':
405
target = self.tree.get_symlink_target(change.path[1])
406
self.upload_symlink(change.path[1], target)
407
elif change.kind[1] == 'directory':
408
self.make_remote_dir(change.path[1])
410
raise NotImplementedError
412
for change in changes.added + changes.copied:
413
if self.is_ignored(change.path[1]):
415
self.outf.write('Ignoring %s\n' % change.path[1])
417
if change.kind[1] == 'file':
418
self.upload_file(change.path[1], change.path[1])
419
elif change.kind[1] == 'directory':
420
self.make_remote_dir(change.path[1])
421
elif change.kind[1] == 'symlink':
422
target = self.tree.get_symlink_target(change.path[1])
430
self.upload_symlink(path, target)
424
self.upload_symlink(change.path[1], target)
431
425
except errors.TransportNotPossible:
432
426
if not self.quiet:
433
427
self.outf.write('Not uploading symlink %s -> %s\n'
428
% (change.path[1], target))
436
430
raise NotImplementedError
438
432
# XXX: Add a test for exec_change
440
content_change, exec_change) in changes.modified:
441
if self.is_ignored(path):
433
for change in changes.modified:
434
if self.is_ignored(change.path[1]):
442
435
if not self.quiet:
443
self.outf.write('Ignoring %s\n' % path)
436
self.outf.write('Ignoring %s\n' % change.path[1])
446
self.upload_file(path, path)
447
elif kind == 'symlink':
448
target = self.tree.get_symlink_target(path)
449
self.upload_symlink(path, target)
438
if change.kind[1] == 'file':
439
self.upload_file(change.path[1], change.path[1])
440
elif change.kind[1] == 'symlink':
441
target = self.tree.get_symlink_target(change.path[1])
442
self.upload_symlink(change.path[1], target)
451
444
raise NotImplementedError
453
446
self.set_uploaded_revid(self.rev_id)
456
class CannotUploadToWorkingTree(errors.BzrCommandError):
449
class CannotUploadToWorkingTree(errors.CommandError):
458
451
_fmt = 'Cannot upload to a bzr managed working tree: %(url)s".'
461
class DivergedUploadedTree(errors.BzrCommandError):
454
class DivergedUploadedTree(errors.CommandError):
463
456
_fmt = ("Your branch (%(revid)s)"
464
457
" and the uploaded tree (%(uploaded_revid)s) have diverged: ")