~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/dirstate.py

  • Committer: Martin Pool
  • Date: 2009-03-12 05:44:43 UTC
  • mfrom: (4124 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4144.
  • Revision ID: mbp@sourcefrog.net-20090312054443-rz5kodxh1cjjx2id
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1588
1588
        #       already in memory. However, this really needs to be done at a
1589
1589
        #       higher level, because there either won't be anything on disk,
1590
1590
        #       or the thing on disk will be a file.
1591
 
        return os.readlink(abspath.encode(osutils._fs_enc))
 
1591
        fs_encoding = osutils._fs_enc
 
1592
        if isinstance(abspath, unicode):
 
1593
            # abspath is defined as the path to pass to lstat. readlink is
 
1594
            # buggy in python < 2.6 (it doesn't encode unicode path into FS
 
1595
            # encoding), so we need to encode ourselves knowing that unicode
 
1596
            # paths are produced by UnicodeDirReader on purpose.
 
1597
            abspath = abspath.encode(fs_encoding)
 
1598
        target = os.readlink(abspath)
 
1599
        if fs_encoding not in ('UTF-8', 'US-ASCII', 'ANSI_X3.4-1968'):
 
1600
            # Change encoding if needed
 
1601
            target = target.decode(fs_encoding).encode('UTF-8')
 
1602
        return target
1592
1603
 
1593
1604
    def get_ghosts(self):
1594
1605
        """Return a list of the parent tree revision ids that are ghosts."""
1866
1877
            size = 0
1867
1878
            executable = False
1868
1879
        elif kind == 'symlink':
1869
 
            # We don't support non-ascii targets for symlinks yet.
1870
 
            fingerprint = str(inv_entry.symlink_target or '')
 
1880
            if inv_entry.symlink_target is None:
 
1881
                fingerprint = ''
 
1882
            else:
 
1883
                fingerprint = inv_entry.symlink_target.encode('utf8')
1871
1884
            size = 0
1872
1885
            executable = False
1873
1886
        elif kind == 'file':
2807
2820
    (saved_minikind, saved_link_or_sha1, saved_file_size,
2808
2821
     saved_executable, saved_packed_stat) = entry[1][0]
2809
2822
 
 
2823
    if minikind == 'd' and saved_minikind == 't':
 
2824
        minikind = 't'
2810
2825
    if (minikind == saved_minikind
2811
2826
        and packed_stat == saved_packed_stat):
2812
2827
        # The stat hasn't changed since we saved, so we can re-use the
3405
3420
                while (current_entry is not None or
3406
3421
                    current_path_info is not None):
3407
3422
                    if current_entry is None:
3408
 
                        # the check for path_handled when the path is adnvaced
 
3423
                        # the check for path_handled when the path is advanced
3409
3424
                        # will yield this path if needed.
3410
3425
                        pass
3411
3426
                    elif current_path_info is None: