~treaves/trac-bzr/trac-bzr

« back to all changes in this revision

Viewing changes to tracbzr/backend.py

  • Committer: Martin von Gagern
  • Date: 2012-01-08 09:15:35 UTC
  • mfrom: (123.1.4 bug883191)
  • Revision ID: martin.vgagern@gmx.net-20120108091535-quw5p170uqprqioo
Handle symlinks in unversioned directories.

Show diffs side-by-side

added added

removed removed

Lines of Context:
864
864
    def get_properties(self):
865
865
        return {}
866
866
 
 
867
    MAX_SYMLINK_STEPS = 10
 
868
 
867
869
    def get_entries(self):
868
870
        result = []
869
871
        for name in self.transport.list_dir(''):
870
872
            if name == '.bzr':
871
873
                continue
872
 
            stat_mode = self.transport.stat(name).st_mode
873
 
            kind = osutils.file_kind_from_stat_mode(stat_mode)
 
874
            child_path = name
 
875
            try:
 
876
                for step in xrange(self.MAX_SYMLINK_STEPS + 1):
 
877
                    stat_mode = self.transport.stat(child_path).st_mode
 
878
                    kind = osutils.file_kind_from_stat_mode(stat_mode)
 
879
                    if kind != 'symlink':
 
880
                        break
 
881
                    child_path = osutils.pathjoin(osutils.dirname(child_path),
 
882
                                                  self.transport.readlink(name))
 
883
            except errors.NoSuchFile:
 
884
                continue
874
885
            if not kind == 'directory':
875
886
                continue
876
887
            child_path = osutils.pathjoin(self.path, name)