359
364
# --create-prefix option ?)
360
365
changes = self.tree.changes_from(from_tree)
361
366
with self.tree.lock_read():
362
for change in changes.removed:
363
if self.is_ignored(change.path[0]):
367
for (path, id, kind) in changes.removed:
368
if self.is_ignored(path):
364
369
if not self.quiet:
365
self.outf.write('Ignoring %s\n' % change.path[0])
370
self.outf.write('Ignoring %s\n' % 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])
373
self.delete_remote_file(path)
374
elif kind == 'directory':
375
self.delete_remote_dir_maybe(path)
376
elif kind == 'symlink':
377
self.delete_remote_file(path)
374
379
raise NotImplementedError
376
for change in changes.renamed:
377
if self.is_ignored(change.path[0]) and self.is_ignored(change.path[1]):
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):
378
384
if not self.quiet:
379
self.outf.write('Ignoring %s\n' % change.path[0])
380
self.outf.write('Ignoring %s\n' % change.path[1])
385
self.outf.write('Ignoring %s\n' % old_path)
386
self.outf.write('Ignoring %s\n' % new_path)
382
if change.changed_content:
383
# We update the change.path[0] content because renames and
389
# We update the old_path content because renames and
384
390
# deletions are differed.
385
self.upload_file(change.path[0], change.path[1])
386
self.rename_remote(change.path[0], change.path[1])
391
self.upload_file(old_path, new_path)
392
self.rename_remote(old_path, new_path)
387
393
self.finish_renames()
388
394
self.finish_deletions()
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])
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 == '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)
424
self.upload_symlink(change.path[1], target)
430
self.upload_symlink(path, target)
425
431
except errors.TransportNotPossible:
426
432
if not self.quiet:
427
433
self.outf.write('Not uploading symlink %s -> %s\n'
428
% (change.path[1], target))
430
436
raise NotImplementedError
432
438
# XXX: Add a test for exec_change
433
for change in changes.modified:
434
if self.is_ignored(change.path[1]):
440
content_change, exec_change) in changes.modified:
441
if self.is_ignored(path):
435
442
if not self.quiet:
436
self.outf.write('Ignoring %s\n' % change.path[1])
443
self.outf.write('Ignoring %s\n' % path)
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)
446
self.upload_file(path, path)
447
elif kind == 'symlink':
448
target = self.tree.get_symlink_target(path)
449
self.upload_symlink(path, target)
444
451
raise NotImplementedError
446
453
self.set_uploaded_revid(self.rev_id)
449
class CannotUploadToWorkingTree(errors.CommandError):
456
class CannotUploadToWorkingTree(errors.BzrCommandError):
451
458
_fmt = 'Cannot upload to a bzr managed working tree: %(url)s".'
454
class DivergedUploadedTree(errors.CommandError):
461
class DivergedUploadedTree(errors.BzrCommandError):
456
463
_fmt = ("Your branch (%(revid)s)"
457
464
" and the uploaded tree (%(uploaded_revid)s) have diverged: ")