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

  • Committer: Tim Marston
  • Date: 2016-02-13 13:20:44 UTC
  • Revision ID: tim@ed.am-20160213132044-t5zaxhdlhjyn4t1v
moved handling of --verbose to main program; manuall parse config file (because
ConfigFileParse does not support allow_no_value in python 2.6)

Show diffs side-by-side

added added

removed removed

53
53
                        [ "repo=", "verbose", "help" ] )
54
54
                for opt, optarg in opts:
55
55
                        if opt in [ '--repo', '-r' ]:
56
 
                                if not re.search( '^[-a-zA-z0-9.]+$', optarg ):
 
56
                                if not re.match( '^[-a-zA-z0-9.]+$', optarg ):
57
57
                                        raise the.program.FatalError(
58
58
                                                'invalid repository name: ' + optarg )
59
59
                                the.repo = optarg
60
 
                        elif opt in [ '--verbose', '-v' ]:
61
 
                                the.verbose += 1
62
60
                        elif opt == "--help":
63
61
                                self.print_help()
64
62
 
109
107
        def expand_home_dir_files( files ):
110
108
                """Returns a unique, sorted list of relative filenames, calculated from the list
111
109
                provided, which is made up from individual files and directories
112
 
                relative to the CWD.  Directories are not recursed in to, and leading
113
 
                path components are not returned.  Specified filenames must exist in the
114
 
                home directory (although they may not exist in the repo).
 
110
                relative to the CWD.  Directories and are not recursed in to, but
 
111
                leading path components are also returned.  Specified filenames must
 
112
                exist in the home directory (although they may not exist in the repo).
115
113
 
116
114
                """
117
115
 
137
135
                                raise the.program.FatalError(
138
136
                                        'not found in home directory: %s' % rel_file )
139
137
 
140
 
                        # # append path parts
141
 
                        # path = rel_file
142
 
                        # while True:
143
 
                        #       path, dummy = os.path.split( path )
144
 
                        #       if len( path ): ret.add( path )
145
 
                        #       else: break
 
138
                        # append path parts
 
139
                        path = rel_file
 
140
                        while True:
 
141
                                path, dummy = os.path.split( path )
 
142
                                if len( path ): ret.add( path )
 
143
                                else: break
146
144
 
147
145
                        # append the file or directory
148
146
                        ret.add( rel_file )