/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/upload/cmds.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2019-09-21 16:35:59 UTC
  • mfrom: (7358.11.10 delta-no-file-ids)
  • Revision ID: breezy.the.bot@gmail.com-20190921163559-inw7zv0fg2j35h68
TreeDelta holds TreeChange objects rather than tuples of various sizes.

Merged from https://code.launchpad.net/~jelmer/brz/delta-no-file-ids/+merge/369480

Show diffs side-by-side

added added

removed removed

Lines of Context:
364
364
        # --create-prefix option ?)
365
365
        changes = self.tree.changes_from(from_tree)
366
366
        with self.tree.lock_read():
367
 
            for (path, id, kind) in changes.removed:
368
 
                if self.is_ignored(path):
 
367
            for change in changes.removed:
 
368
                if self.is_ignored(change.path[0]):
369
369
                    if not self.quiet:
370
 
                        self.outf.write('Ignoring %s\n' % path)
 
370
                        self.outf.write('Ignoring %s\n' % change.path[0])
371
371
                    continue
372
 
                if kind == 'file':
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)
 
372
                if change.kind[0] == 'file':
 
373
                    self.delete_remote_file(change.path[0])
 
374
                elif change.kind[0] == 'directory':
 
375
                    self.delete_remote_dir_maybe(change.path[0])
 
376
                elif change.kind[0] == 'symlink':
 
377
                    self.delete_remote_file(change.path[0])
378
378
                else:
379
379
                    raise NotImplementedError
380
380
 
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):
 
381
            for change in changes.renamed:
 
382
                if self.is_ignored(change.path[0]) and self.is_ignored(change.path[1]):
384
383
                    if not self.quiet:
385
 
                        self.outf.write('Ignoring %s\n' % old_path)
386
 
                        self.outf.write('Ignoring %s\n' % new_path)
 
384
                        self.outf.write('Ignoring %s\n' % change.path[0])
 
385
                        self.outf.write('Ignoring %s\n' % change.path[1])
387
386
                    continue
388
 
                if content_change:
389
 
                    # We update the old_path content because renames and
 
387
                if change.changed_content:
 
388
                    # We update the change.path[0] content because renames and
390
389
                    # deletions are differed.
391
 
                    self.upload_file(old_path, new_path)
392
 
                self.rename_remote(old_path, new_path)
 
390
                    self.upload_file(change.path[0], change.path[1])
 
391
                self.rename_remote(change.path[0], change.path[1])
393
392
            self.finish_renames()
394
393
            self.finish_deletions()
395
394
 
396
 
            for (path, id, old_kind, new_kind) in changes.kind_changed:
397
 
                if self.is_ignored(path):
398
 
                    if not self.quiet:
399
 
                        self.outf.write('Ignoring %s\n' % path)
400
 
                    continue
401
 
                if old_kind in ('file', 'symlink'):
402
 
                    self.delete_remote_file(path)
403
 
                elif old_kind == 'directory':
404
 
                    self.delete_remote_dir(path)
405
 
                else:
406
 
                    raise NotImplementedError
407
 
 
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)
415
 
                else:
416
 
                    raise NotImplementedError
417
 
 
418
 
            for (path, id, kind) in changes.added:
419
 
                if self.is_ignored(path):
420
 
                    if not self.quiet:
421
 
                        self.outf.write('Ignoring %s\n' % path)
422
 
                    continue
423
 
                if kind == 'file':
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)
 
395
            for change in changes.kind_changed:
 
396
                if self.is_ignored(change.path[1]):
 
397
                    if not self.quiet:
 
398
                        self.outf.write('Ignoring %s\n' % change.path[1])
 
399
                    continue
 
400
                if change.kind[0] in ('file', 'symlink'):
 
401
                    self.delete_remote_file(change.path[0])
 
402
                elif change.kind[0] == 'directory':
 
403
                    self.delete_remote_dir(change.path[0])
 
404
                else:
 
405
                    raise NotImplementedError
 
406
 
 
407
                if change.kind[1] == 'file':
 
408
                    self.upload_file(change.path[1], change.path[1])
 
409
                elif change.kind[1] == 'symlink':
 
410
                    target = self.tree.get_symlink_target(change.path[1])
 
411
                    self.upload_symlink(change.path[1], target)
 
412
                elif change.kind[1] == 'directory':
 
413
                    self.make_remote_dir(change.path[1])
 
414
                else:
 
415
                    raise NotImplementedError
 
416
 
 
417
            for change in changes.added:
 
418
                if self.is_ignored(change.path[1]):
 
419
                    if not self.quiet:
 
420
                        self.outf.write('Ignoring %s\n' % change.path[1])
 
421
                    continue
 
422
                if change.kind[1] == 'file':
 
423
                    self.upload_file(change.path[1], change.path[1])
 
424
                elif change.kind[1] == 'directory':
 
425
                    self.make_remote_dir(change.path[1])
 
426
                elif change.kind[1] == 'symlink':
 
427
                    target = self.tree.get_symlink_target(change.path[1])
429
428
                    try:
430
 
                        self.upload_symlink(path, target)
 
429
                        self.upload_symlink(change.path[1], target)
431
430
                    except errors.TransportNotPossible:
432
431
                        if not self.quiet:
433
432
                            self.outf.write('Not uploading symlink %s -> %s\n'
434
 
                                            % (path, target))
 
433
                                            % (change.path[1], target))
435
434
                else:
436
435
                    raise NotImplementedError
437
436
 
438
437
            # XXX: Add a test for exec_change
439
 
            for (path, id, kind,
440
 
                 content_change, exec_change) in changes.modified:
441
 
                if self.is_ignored(path):
 
438
            for change in changes.modified:
 
439
                if self.is_ignored(change.path[1]):
442
440
                    if not self.quiet:
443
 
                        self.outf.write('Ignoring %s\n' % path)
 
441
                        self.outf.write('Ignoring %s\n' % change.path[1])
444
442
                    continue
445
 
                if kind == 'file':
446
 
                    self.upload_file(path, path)
447
 
                elif kind == 'symlink':
448
 
                    target = self.tree.get_symlink_target(path)
449
 
                    self.upload_symlink(path, target)
 
443
                if change.kind[1] == 'file':
 
444
                    self.upload_file(change.path[1], change.path[1])
 
445
                elif change.kind[1] == 'symlink':
 
446
                    target = self.tree.get_symlink_target(change.path[1])
 
447
                    self.upload_symlink(change.path[1], target)
450
448
                else:
451
449
                    raise NotImplementedError
452
450