/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:46:42 UTC
  • Revision ID: tim@ed.am-20140418144642-kr3vmc8fgnxgkbza
implemented symlink substitution and ignore list in status walker (and added
some verbose messages)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
 
22
22
import os
23
 
import stdhome.the as the
24
23
 
25
24
 
26
25
class Walker:
99
98
 
100
99
 
101
100
        @staticmethod
102
 
        def generate_walk_list( rel_file = '', full_dir = None ):
 
101
        def generate_walk_list( full_dir, rel_file = '' ):
103
102
                """Returns a list of files and directories in full_dir, specified as relative
104
103
                files (relative to full_dir), breadth first.
105
104
                """
106
105
 
107
 
                # default place to walk
108
 
                if full_dir is None: full_dir = the.repo.full_dir
109
 
 
110
106
                # ignore some files
111
107
                if rel_file in { '.bzr', '.bzrignore', '.stdhome', '.stdhomerc' }:
112
108
                        return list()
122
118
                        ret = [ rel_file ] if rel_file != '' else []
123
119
                        for file in os.listdir( full_file ):
124
120
                                ret.extend( Walker.generate_walk_list(
125
 
                                        os.path.join( rel_file, file ), full_dir ) )
 
121
                                        full_dir, os.path.join( rel_file, file ) ) )
126
122
                        return sorted( ret )
127
123
 
128
124
                # other kinds are invalid