/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/workingtree.py

  • Committer: Jelmer Vernooij
  • Date: 2019-05-29 03:28:14 UTC
  • mfrom: (7303 work)
  • mto: This revision was merged to the branch mainline in revision 7305.
  • Revision ID: jelmer@jelmer.uk-20190529032814-fzqbrgf9647u9ptq
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    controldir,
47
47
    errors,
48
48
    filters as _mod_filters,
49
 
    generate_ids,
50
49
    merge,
51
50
    revision as _mod_revision,
52
51
    transform,
53
52
    transport,
54
53
    views,
55
54
    )
 
55
from breezy.bzr import (
 
56
    generate_ids,
 
57
    )
56
58
""")
57
59
 
58
60
from . import (
362
364
    def has_filename(self, filename):
363
365
        return osutils.lexists(self.abspath(filename))
364
366
 
365
 
    def get_file(self, path, file_id=None, filtered=True):
366
 
        return self.get_file_with_stat(path, file_id, filtered=filtered)[0]
 
367
    def get_file(self, path, filtered=True):
 
368
        return self.get_file_with_stat(path, filtered=filtered)[0]
367
369
 
368
 
    def get_file_with_stat(self, path, file_id=None, filtered=True,
 
370
    def get_file_with_stat(self, path, filtered=True,
369
371
                           _fstat=osutils.fstat):
370
372
        """See Tree.get_file_with_stat."""
371
373
        abspath = self.abspath(path)
381
383
            file_obj = _mod_filters.filtered_input_file(file_obj, filters)
382
384
        return (file_obj, stat_value)
383
385
 
384
 
    def get_file_text(self, path, file_id=None, filtered=True):
385
 
        with self.get_file(path, file_id, filtered=filtered) as my_file:
 
386
    def get_file_text(self, path, filtered=True):
 
387
        with self.get_file(path, filtered=filtered) as my_file:
386
388
            return my_file.read()
387
389
 
388
 
    def get_file_lines(self, path, file_id=None, filtered=True):
 
390
    def get_file_lines(self, path, filtered=True):
389
391
        """See Tree.get_file_lines()"""
390
 
        with self.get_file(path, file_id, filtered=filtered) as file:
 
392
        with self.get_file(path, filtered=filtered) as file:
391
393
            return file.readlines()
392
394
 
393
395
    def get_parent_ids(self):
456
458
                    new_parents = [revision_id]
457
459
                tree.set_parent_ids(new_parents)
458
460
 
459
 
    def get_file_size(self, path, file_id=None):
 
461
    def get_file_size(self, path):
460
462
        """See Tree.get_file_size"""
461
463
        # XXX: this returns the on-disk size; it should probably return the
462
464
        # canonical size
719
721
            self.add(path, file_id, 'directory')
720
722
            return file_id
721
723
 
722
 
    def get_symlink_target(self, path, file_id=None):
 
724
    def get_symlink_target(self, path):
723
725
        abspath = self.abspath(path)
724
726
        target = osutils.readlink(abspath)
725
727
        return target
753
755
        # checkout in a subdirectory.  This can be avoided by not adding
754
756
        # it.  mbp 20070306
755
757
 
756
 
    def extract(self, path, file_id=None, format=None):
 
758
    def extract(self, path, format=None):
757
759
        """Extract a subtree from this tree.
758
760
 
759
761
        A new branch will be created, relative to the path for this tree.
764
766
        """Write the in memory meta data to disk."""
765
767
        raise NotImplementedError(self.flush)
766
768
 
767
 
    def kind(self, relpath, file_id=None):
 
769
    def kind(self, relpath):
768
770
        return osutils.file_kind(self.abspath(relpath))
769
771
 
770
772
    def list_files(self, include_root=False, from_dir=None, recursive=True):
900
902
                self.set_parent_trees(parent_trees)
901
903
            return count
902
904
 
903
 
    def put_file_bytes_non_atomic(self, path, bytes, file_id=None):
 
905
    def put_file_bytes_non_atomic(self, path, bytes):
904
906
        """See MutableTree.put_file_bytes_non_atomic."""
905
907
        with self.lock_write(), open(self.abspath(path), 'wb') as stream:
906
908
            stream.write(bytes)
908
910
    def extras(self):
909
911
        """Yield all unversioned files in this WorkingTree.
910
912
 
911
 
        If there are any unversioned directories then only the directory is
912
 
        returned, not all its children.  But if there are unversioned files
913
 
        under a versioned subdirectory, they are returned.
 
913
        If there are any unversioned directories and the file format
 
914
        supports versioning directories, then only the directory is returned,
 
915
        not all its children. But if there are unversioned files under a
 
916
        versioned subdirectory, they are returned.
914
917
 
915
918
        Currently returned depth-first, sorted by name within directories.
916
919
        This is the same order used by 'osutils.walkdirs'.
929
932
        """
930
933
        raise NotImplementedError(self.is_ignored)
931
934
 
932
 
    def stored_kind(self, path, file_id=None):
 
935
    def stored_kind(self, path):
933
936
        """See Tree.stored_kind"""
934
937
        raise NotImplementedError(self.stored_kind)
935
938
 
1081
1084
        if not self.supports_setting_file_ids():
1082
1085
            raise SettingFileIdUnsupported()
1083
1086
        with self.lock_tree_write():
1084
 
            # for compatability
 
1087
            # for compatibility
1085
1088
            if file_id is None:
1086
1089
                raise ValueError(
1087
1090
                    'WorkingTree.set_root_id with fileid=None')