~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/workingtree.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-13 00:05:14 UTC
  • mfrom: (1861 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1871.
  • Revision ID: john@arbash-meinel.com-20060713000514-aa62627aa0d4deb6
[merge] bzr.dev 1861

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
import warnings
53
53
 
54
54
import bzrlib
55
 
from bzrlib import bzrdir, config, errors, ignores, urlutils
 
55
from bzrlib import bzrdir, errors, ignores, osutils, urlutils
56
56
from bzrlib.atomicfile import AtomicFile
57
57
from bzrlib.conflicts import Conflict, ConflictList, CONFLICT_SUFFIXES
58
58
from bzrlib.decorators import needs_read_lock, needs_write_lock
355
355
        :return: The WorkingTree that contains 'path', and the rest of path
356
356
        """
357
357
        if path is None:
358
 
            path = os.getcwdu()
 
358
            path = osutils.getcwd()
359
359
        control, relpath = bzrdir.BzrDir.open_containing(path)
360
360
 
361
361
        return control.open_workingtree(), relpath
376
376
        """
377
377
        inv = self._inventory
378
378
        for path, ie in inv.iter_entries():
379
 
            if bzrlib.osutils.lexists(self.abspath(path)):
 
379
            if osutils.lexists(self.abspath(path)):
380
380
                yield ie.file_id
381
381
 
382
382
    def __repr__(self):
448
448
        return relpath(self.basedir, path)
449
449
 
450
450
    def has_filename(self, filename):
451
 
        return bzrlib.osutils.lexists(self.abspath(filename))
 
451
        return osutils.lexists(self.abspath(filename))
452
452
 
453
453
    def get_file(self, file_id):
454
454
        return self.get_file_byname(self.id2path(file_id))
538
538
        if not inv.has_id(file_id):
539
539
            return False
540
540
        path = inv.id2path(file_id)
541
 
        return bzrlib.osutils.lexists(self.abspath(path))
 
541
        return osutils.lexists(self.abspath(path))
542
542
 
543
543
    def has_or_had_id(self, file_id):
544
544
        if file_id == self.inventory.root.file_id:
722
722
        """
723
723
        inv = self._inventory
724
724
        # Convert these into local objects to save lookup times
725
 
        pathjoin = bzrlib.osutils.pathjoin
726
 
        file_kind = bzrlib.osutils.file_kind
 
725
        pathjoin = osutils.pathjoin
 
726
        file_kind = osutils.file_kind
727
727
 
728
728
        # transport.base ends in a slash, we want the piece
729
729
        # between the last two slashes
767
767
                elif self.is_ignored(fp[1:]):
768
768
                    c = 'I'
769
769
                else:
770
 
                    c = '?'
 
770
                    # we may not have found this file, because of a unicode issue
 
771
                    f_norm, can_access = osutils.normalized_filename(f)
 
772
                    if f == f_norm or not can_access:
 
773
                        # No change, so treat this file normally
 
774
                        c = '?'
 
775
                    else:
 
776
                        # this file can be accessed by a normalized path
 
777
                        # check again if it is versioned
 
778
                        # these lines are repeated here for performance
 
779
                        f = f_norm
 
780
                        fp = from_dir_relpath + '/' + f
 
781
                        fap = from_dir_abspath + '/' + f
 
782
                        f_ie = inv.get_child(from_dir_id, f)
 
783
                        if f_ie:
 
784
                            c = 'V'
 
785
                        elif self.is_ignored(fp[1:]):
 
786
                            c = 'I'
 
787
                        else:
 
788
                            c = '?'
771
789
 
772
790
                fk = file_kind(fap)
773
791
 
999
1017
 
1000
1018
            fl = []
1001
1019
            for subf in os.listdir(dirabs):
1002
 
                if (subf != '.bzr'
1003
 
                    and (subf not in dir_entry.children)):
1004
 
                    fl.append(subf)
 
1020
                if subf == '.bzr':
 
1021
                    continue
 
1022
                if subf not in dir_entry.children:
 
1023
                    subf_norm, can_access = osutils.normalized_filename(subf)
 
1024
                    if subf_norm != subf and can_access:
 
1025
                        if subf_norm not in dir_entry.children:
 
1026
                            fl.append(subf_norm)
 
1027
                    else:
 
1028
                        fl.append(subf)
1005
1029
            
1006
1030
            fl.sort()
1007
1031
            for subf in fl: