/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: Jelmer Vernooij
  • Date: 2018-11-11 04:08:32 UTC
  • mto: (7143.16.20 even-more-cleanups)
  • mto: This revision was merged to the branch mainline in revision 7175.
  • Revision ID: jelmer@jelmer.uk-20181111040832-nsljjynzzwmznf3h
Run autopep8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
181
181
                mode = 0o664
182
182
        if not self.quiet:
183
183
            self.outf.write('Uploading %s\n' % old_relpath)
184
 
        self._up_put_bytes(old_relpath, self.tree.get_file_text(new_relpath, id), mode)
 
184
        self._up_put_bytes(
 
185
            old_relpath, self.tree.get_file_text(new_relpath, id), mode)
185
186
 
186
187
    def _force_clear(self, relpath):
187
188
        try:
190
191
                # A simple rmdir may not be enough
191
192
                if not self.quiet:
192
193
                    self.outf.write('Clearing %s/%s\n' % (
193
 
                            self.to_transport.external_url(), relpath))
 
194
                        self.to_transport.external_url(), relpath))
194
195
                self._up_delete_tree(relpath)
195
196
            elif stat.S_ISLNK(st.st_mode):
196
197
                if not self.quiet:
240
241
            if not stat.S_ISDIR(st.st_mode):
241
242
                if not self.quiet:
242
243
                    self.outf.write('Deleting %s/%s\n' % (
243
 
                            self.to_transport.external_url(), relpath))
 
244
                        self.to_transport.external_url(), relpath))
244
245
                self._up_delete(relpath)
245
246
            else:
246
247
                # Ok the remote dir already exists, nothing to do
310
311
        self._pending_renames = []
311
312
 
312
313
    def upload_full_tree(self):
313
 
        self.to_transport.ensure_base() # XXX: Handle errors (add
314
 
                                        # --create-prefix option ?)
 
314
        self.to_transport.ensure_base()  # XXX: Handle errors (add
 
315
        # --create-prefix option ?)
315
316
        with self.tree.lock_read():
316
317
            for relpath, ie in self.tree.iter_entries_by_dir():
317
318
                if relpath in ('', '.bzrignore', '.bzrignore-upload'):
327
328
                    self.upload_file_robustly(relpath, ie.file_id)
328
329
                elif ie.kind == 'symlink':
329
330
                    try:
330
 
                        self.upload_symlink_robustly(relpath, ie.symlink_target)
 
331
                        self.upload_symlink_robustly(
 
332
                            relpath, ie.symlink_target)
331
333
                    except errors.TransportNotPossible:
332
334
                        if not self.quiet:
333
335
                            target = self.tree.path_content_summary(relpath)[3]
358
360
                self.outf.write('Remote location already up to date\n')
359
361
 
360
362
        from_tree = self.branch.repository.revision_tree(rev_id)
361
 
        self.to_transport.ensure_base() # XXX: Handle errors (add
362
 
                                        # --create-prefix option ?)
 
363
        self.to_transport.ensure_base()  # XXX: Handle errors (add
 
364
        # --create-prefix option ?)
363
365
        changes = self.tree.changes_from(from_tree)
364
366
        with self.tree.lock_read():
365
367
            for (path, id, kind) in changes.removed:
369
371
                    continue
370
372
                if kind is 'file':
371
373
                    self.delete_remote_file(path)
372
 
                elif kind is  'directory':
 
374
                elif kind is 'directory':
373
375
                    self.delete_remote_dir_maybe(path)
374
376
                elif kind == 'symlink':
375
377
                    self.delete_remote_file(path)
478
480
        'overwrite',
479
481
        option.Option('full', 'Upload the full working tree.'),
480
482
        option.Option('quiet', 'Do not output what is being done.',
481
 
                       short_name='q'),
 
483
                      short_name='q'),
482
484
        option.Option('directory',
483
485
                      help='Branch to upload from, '
484
486
                      'rather than the one containing the working directory.',
488
490
        option.Option('auto',
489
491
                      'Trigger an upload from this branch whenever the tip '
490
492
                      'revision changes.')
491
 
       ]
 
493
        ]
492
494
 
493
495
    def run(self, location=None, full=False, revision=None, remember=None,
494
496
            directory=None, quiet=False, auto=None, overwrite=False
510
512
            if wt:
511
513
                changes = wt.changes_from(wt.basis_tree())
512
514
 
513
 
                if revision is None and  changes.has_changed():
 
515
                if revision is None and changes.has_changed():
514
516
                    raise errors.UncommittedChanges(wt)
515
517
 
516
518
            conf = branch.get_config_stack()
522
524
                else:
523
525
                    # FIXME: Not currently tested
524
526
                    display_url = urlutils.unescape_for_display(stored_loc,
525
 
                            self.outf.encoding)
 
527
                                                                self.outf.encoding)
526
528
                    self.outf.write("Using saved location: %s\n" % display_url)
527
529
                    location = stored_loc
528
530
 
531
533
            # Check that we are not uploading to a existing working tree.
532
534
            try:
533
535
                to_bzr_dir = controldir.ControlDir.open_from_transport(
534
 
                        to_transport)
 
536
                    to_transport)
535
537
                has_wt = to_bzr_dir.has_workingtree()
536
538
            except errors.NotBranchError:
537
539
                has_wt = False
575
577
                         urlutils.unescape(to_transport.base))
576
578
            if auto is not None:
577
579
                conf.set('upload_auto', auto)
578