/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: 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

30
30
 
31
31
 
32
32
        def print_help( self ):
33
 
                print "Usage: " + the.program.name + " status [--repo=REPO]"
 
33
                print "Usage: " + the.program.name + " status [--repo=REPO] [FILE]..."
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.match( '^[-a-zA-z0-9.]+$', optarg ):
 
60
                                if not re.search( '^[-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
66
64
                        elif opt == "--help":
67
65
                                self.print_help()
68
 
                
 
66
 
69
67
                # discard first argument (the command)
70
68
                args.pop( 0 )
71
69
 
72
70
                # remaining arguments
73
 
                if len( args ):
74
 
                        raise the.program.UsageError( 'too many arguments' )
 
71
                self.files = args
75
72
 
76
73
 
77
74
        def run( self ):
79
76
                # set up repo and check it exists
80
77
                the.repo.check_dir_exists()
81
78
 
 
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
85
85
                deployment = Deployment()
86
86
                if deployment.is_ongoing():
 
87
                        print "deployment ongoing"
87
88
 
88
89
                        # check for conflicts in repo
89
90
                        files = the.repo.vcs.get_conflicts()
100
101
                else:
101
102
 
102
103
                        # check status
103
 
                        walker = StatusWalker()
 
104
                        walker = StatusWalker( files if files else None )
104
105
                        walker.walk()
105
106
                        if walker.modified:
106
107
                                message += 'modified:\n  %s\n' % \