/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-03-24 17:48:04 UTC
  • mfrom: (6921 work)
  • mto: This revision was merged to the branch mainline in revision 6923.
  • Revision ID: jelmer@jelmer.uk-20180324174804-xf22o05byoj12x1q
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
174
174
                    dir = os.path.dirname(dir)
175
175
        return ignored
176
176
 
177
 
    def upload_file(self, relpath, id, mode=None):
 
177
    def upload_file(self, old_relpath, new_relpath, id, mode=None):
178
178
        if mode is None:
179
 
            if self.tree.is_executable(relpath, id):
 
179
            if self.tree.is_executable(new_relpath, id):
180
180
                mode = 0o775
181
181
            else:
182
182
                mode = 0o664
183
183
        if not self.quiet:
184
 
            self.outf.write('Uploading %s\n' % relpath)
185
 
        self._up_put_bytes(relpath, self.tree.get_file_text(relpath, id), mode)
 
184
            self.outf.write('Uploading %s\n' % old_relpath)
 
185
        self._up_put_bytes(old_relpath, self.tree.get_file_text(new_relpath, id), mode)
186
186
 
187
187
    def upload_file_robustly(self, relpath, id, mode=None):
188
188
        """Upload a file, clearing the way on the remote side.
200
200
                self._up_delete_tree(relpath)
201
201
        except errors.PathError:
202
202
            pass
203
 
        self.upload_file(relpath, id, mode)
 
203
        self.upload_file(relpath, relpath, id, mode)
204
204
 
205
205
    def make_remote_dir(self, relpath, mode=None):
206
206
        if mode is None:
364
364
                if content_change:
365
365
                    # We update the old_path content because renames and
366
366
                    # deletions are differed.
367
 
                    self.upload_file(old_path, id)
 
367
                    self.upload_file(old_path, new_path, id)
368
368
                if kind == 'symlink':
369
369
                    if not self.quiet:
370
370
                        self.outf.write('Not renaming remote symlink %s to %s\n'
387
387
                    raise NotImplementedError
388
388
 
389
389
                if new_kind == 'file':
390
 
                    self.upload_file(path, id)
 
390
                    self.upload_file(path, path, id)
391
391
                elif new_kind is 'directory':
392
392
                    self.make_remote_dir(path)
393
393
                else:
399
399
                        self.outf.write('Ignoring %s\n' % path)
400
400
                    continue
401
401
                if kind == 'file':
402
 
                    self.upload_file(path, id)
 
402
                    self.upload_file(path, path, id)
403
403
                elif kind == 'directory':
404
404
                    self.make_remote_dir(path)
405
405
                elif kind == 'symlink':
417
417
                    if not self.quiet:
418
418
                        self.outf.write('Ignoring %s\n' % path)
419
419
                    continue
420
 
                if kind is 'file':
421
 
                    self.upload_file(path, id)
 
420
                if kind == 'file':
 
421
                    self.upload_file(path, path, id)
422
422
                else:
423
423
                    raise NotImplementedError
424
424