/stdhome

To get this branch, use:
bzr branch http://bzr.ed.am/stdhome

« back to all changes in this revision

Viewing changes to lib/stdhome/walker/walker.py

  • Committer: Tim Marston
  • Date: 2014-04-18 14:52:41 UTC
  • Revision ID: tim@ed.am-20140418145241-gldwc2ey6d2gjv96
defaulted Walker.generate_walk_list() to act on the.repo.full_dir

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
                        # it shouldn't matter.  We adding an os.pathset to the end of the
64
64
                        # filename, so it wuill only match files that are descendents of a
65
65
                        # directory with the name of this file.
66
 
                        if not recurse: skip = rel_file + os.pathsep
 
66
                        if not recurse: skip = rel_file + os.sep
67
67
 
68
68
 
69
69
        class File:
79
79
                        else:
80
80
                                self.type = '?'
81
81
                        if os.path.islink( self.file ):
82
 
                                self.link_type = type
 
82
                                self.link_type = self.type
83
83
                                self.type = 'l'
84
84
                        else:
85
85
                                self.link_type = False
91
91
                        elif self.type == '_': return 'missing'
92
92
                        else: return 'unknown'
93
93
 
 
94
                def __str__( self ):
 
95
                        type = self.type
 
96
                        if( self.link_type ): type += '/' + self.link_type
 
97
                        return 'File( %s (%s) )' % ( self.file, type )
 
98
 
94
99
 
95
100
        @staticmethod
96
 
        def generate_walk_list( full_dir, rel_file = '' ):
 
101
        def generate_walk_list( rel_file = '', full_dir = the.repo.full_dir ):
97
102
                """Returns a list of files and directories in full_dir, specified as relative
98
103
                files (relative to full_dir), breadth first.
99
104
                """
113
118
                        ret = [ rel_file ] if rel_file != '' else []
114
119
                        for file in os.listdir( full_file ):
115
120
                                ret.extend( Walker.generate_walk_list(
116
 
                                        full_dir, os.path.join( rel_file, file ) ) )
 
121
                                        os.path.join( rel_file, file ), full_dir ) )
117
122
                        return sorted( ret )
118
123
 
119
124
                # other kinds are invalid