/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: 2016-02-16 00:26:53 UTC
  • Revision ID: tim@ed.am-20160216002653-oa8dgponknyislg3
added home directory change reporting to CopyOutWalker; added --quiet option to
update, resolve, revert and init commands; replace use of re.match with
re.search for clarity (and fixed related bug in FileMatcher); added BzrVcs.run
command output when verbose >= 2

Show diffs side-by-side

added added

removed removed

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