~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-09-06 22:55:29 UTC
  • mfrom: (1946.2.16 reduce-knit-churn)
  • Revision ID: pqm@pqm.ubuntu.com-20060906225529-7b367edabbb1ffc2
(jam) delay creating knit contents for significantly better new commit and push performance

Show diffs side-by-side

added added

removed removed

Lines of Context:
526
526
        return self.put_file(relpath, StringIO(bytes), mode=mode)
527
527
 
528
528
    def put_bytes_non_atomic(self, relpath, bytes, mode=None,
529
 
                             create_parent_dir=False):
 
529
                             create_parent_dir=False,
 
530
                             dir_mode=None):
530
531
        """Copy the string into the target location.
531
532
 
532
533
        This function is not strictly safe to use. See 
540
541
        :param create_parent_dir: If we cannot create the target file because
541
542
                        the parent directory does not exist, go ahead and
542
543
                        create it, and then try again.
 
544
        :param dir_mode: Possible access permissions for new directories.
543
545
        """
544
546
        assert isinstance(bytes, str), \
545
547
            'bytes must be a plain string, not %s' % type(bytes)
546
548
        self.put_file_non_atomic(relpath, StringIO(bytes), mode=mode,
547
 
                                 create_parent_dir=create_parent_dir)
 
549
                                 create_parent_dir=create_parent_dir,
 
550
                                 dir_mode=dir_mode)
548
551
 
549
552
    def put_file(self, relpath, f, mode=None):
550
553
        """Copy the file-like object into the location.
565
568
        #raise NotImplementedError(self.put_file)
566
569
 
567
570
    def put_file_non_atomic(self, relpath, f, mode=None,
568
 
                            create_parent_dir=False):
 
571
                            create_parent_dir=False,
 
572
                            dir_mode=None):
569
573
        """Copy the file-like object into the target location.
570
574
 
571
575
        This function is not strictly safe to use. It is only meant to
580
584
        :param create_parent_dir: If we cannot create the target file because
581
585
                        the parent directory does not exist, go ahead and
582
586
                        create it, and then try again.
 
587
        :param dir_mode: Possible access permissions for new directories.
583
588
        """
584
589
        # Default implementation just does an atomic put.
585
590
        try:
589
594
                raise
590
595
            parent_dir = osutils.dirname(relpath)
591
596
            if parent_dir:
592
 
                self.mkdir(parent_dir)
 
597
                self.mkdir(parent_dir, mode=dir_mode)
593
598
                return self.put_file(relpath, f, mode=mode)
594
599
 
595
600
    @deprecated_method(zero_eleven)