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

  • Committer: Tim Marston
  • Date: 2014-04-18 15:00:34 UTC
  • Revision ID: tim@ed.am-20140418150034-l94wfs6ururhi9t5
fixed error in walker.py (from last checkin)

Show diffs side-by-side

added added

removed removed

30
30
 
31
31
 
32
32
        def print_help( self ):
33
 
                print "Usage: " + the.program.name + " status [--repo=REPO] [FILE]..."
 
33
                print "Usage: " + the.program.name + " status [--repo=REPO]"
34
34
                print
35
35
                #      01234567890123456789012345678901234567890123456789012345678901234567890123456789
36
36
                print "Show the state of files in the local repository (including modifications and"
57
57
                        [ "repo=", "verbose", "help" ] )
58
58
                for opt, optarg in opts:
59
59
                        if opt in [ '--repo', '-r' ]:
60
 
                                if not re.search( '^[-a-zA-z0-9.]+$', optarg ):
 
60
                                if not re.match( '^[-a-zA-z0-9.]+$', optarg ):
61
61
                                        raise the.program.FatalError(
62
62
                                                'invalid repository name: ' + optarg )
63
63
                                the.repo = optarg
 
64
                        elif opt in [ '--verbose', '-v' ]:
 
65
                                the.verbose += 1
64
66
                        elif opt == "--help":
65
67
                                self.print_help()
66
 
 
 
68
                
67
69
                # discard first argument (the command)
68
70
                args.pop( 0 )
69
71
 
70
72
                # remaining arguments
71
 
                self.files = args
 
73
                if len( args ):
 
74
                        raise the.program.UsageError( 'too many arguments' )
72
75
 
73
76
 
74
77
        def run( self ):
76
79
                # set up repo and check it exists
77
80
                the.repo.check_dir_exists()
78
81
 
79
 
                # determine files
80
 
                files = self.expand_files( self.files )
81
 
 
82
82
                message = ''
83
83
 
84
84
                # initialise deployment and check if it's ongoing
101
101
                else:
102
102
 
103
103
                        # check status
104
 
                        walker = StatusWalker( files if files else None )
 
104
                        walker = StatusWalker()
105
105
                        walker.walk()
106
106
                        if walker.modified:
107
107
                                message += 'modified:\n  %s\n' % \