/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/command/command.py

  • Committer: Tim Marston
  • Date: 2016-05-22 17:12:03 UTC
  • Revision ID: tim@ed.am-20160522171203-y2qa4rnz0233jyul
typo in comment

Show diffs side-by-side

added added

removed removed

29
29
        """
30
30
 
31
31
        @staticmethod
32
 
        def expand_files( files ):
 
32
        def expand_files( files, recurse = True ):
33
33
                """Returns a unique, sorted list of relative files, calculated from the list
34
34
                provided, which is made up from individual files and directories
35
35
                relative to the CWD (and which must be contained within the home
36
36
                directory, although the files need not actually exist in the home
37
 
                directory).  All files must exist in the repository.  Any directories
38
 
                are recursed in to so that their content is also returned.
 
37
                directory).  All files must exist in the repository.  Directories are
 
38
                recursed in to as required.
 
39
 
39
40
                """
40
41
 
41
 
                ret = list()
 
42
                ret = set()
42
43
                home_dir_prefix = os.path.realpath( the.full_home_dir ) + os.sep
43
44
 
44
45
                # iterate through file list
62
63
                                        'not managed by stdhome: %s' % rel_file )
63
64
 
64
65
                        # append the file or directory tree
65
 
                        ret.extend( Walker.generate_walk_list( rel_file ) )
 
66
                        ret.update( Walker.generate_walk_list(
 
67
                                the.repo.full_dir, rel_file, recurse ) )
66
68
 
67
69
                return sorted( set ( ret ) )