/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: 2014-04-05 22:30:23 UTC
  • Revision ID: tim@ed.am-20140405223023-3co87mbvnxwk1l65
added revert command

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
        @staticmethod
32
32
        def expand_files( files ):
33
 
                """Returns a unique, sorted list of relative files, calculated from the list
34
 
                provided, which is made up from individual files and directories
35
 
                relative to the CWD (and which must be contained within the home
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.
 
33
                """Returns a unique, sorted list of relative files, calculated from the list of
 
34
                files provided, which is made up from individual files and directories
 
35
                to scan that are all relative to the CWD and must be contained within
 
36
                the home directory.
39
37
                """
40
38
 
41
39
                ret = list()
43
41
 
44
42
                # iterate through file list
45
43
                for file in files:
46
 
                        parts = os.path.split( file )
47
 
                        abs_file = os.path.join(
48
 
                                os.path.realpath( parts[ 0 ] ), parts[ 1 ] )
 
44
                        abs_file = os.path.realpath( file )
49
45
 
50
46
                        # check the file is in the home directory
51
47
                        if abs_file[ : len( home_dir_prefix ) ] != home_dir_prefix:
65
61
                        ret.extend( Walker.generate_walk_list(
66
62
                                the.repo.full_dir, rel_file ) )
67
63
 
68
 
                return sorted( set ( ret ) )
 
64
                return ret