/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-07-17 18:19:47 UTC
  • Revision ID: tim@ed.am-20140717181947-pe060idibfu0kfsk
fixed diff command out-of-order output issue

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
class StatusCommand( Command ):
30
30
 
31
31
 
32
 
        def __init__( self ):
33
 
                self.repo = None
34
 
 
35
 
 
36
32
        def print_help( self ):
37
 
                print "Usage: " + the.program.name + " status [--repo=REPO]"
 
33
                print "Usage: " + the.program.name + " status [--repo=REPO] [FILE]..."
38
34
                print
39
35
                #      01234567890123456789012345678901234567890123456789012345678901234567890123456789
40
36
                print "Show the state of files in the local repository (including modifications and"
42
38
                print
43
39
                print "This lists files in your home directory that have been modified and which differ"
44
40
                print "from those in the local repository.  During an update that resulted in conflicts"
45
 
                print "this also lists files which have conflicts in the local local respository, or"
46
 
                print "which can not be deployed due to conflicts with your home directory."
 
41
                print "this also lists files which have conflicts in the local respository, or which"
 
42
                print "can not be deployed due to conflicts with your home directory."
47
43
                print
48
44
                print "For help with adding modified files to the repository, type:"
49
45
                print "    " + the.program.name + " add --help"
64
60
                                if not re.match( '^[-a-zA-z0-9.]+$', optarg ):
65
61
                                        raise the.program.FatalError(
66
62
                                                'invalid repository name: ' + optarg )
67
 
                                self.repo = optarg
 
63
                                the.repo = optarg
68
64
                        elif opt in [ '--verbose', '-v' ]:
69
65
                                the.verbose += 1
70
66
                        elif opt == "--help":
74
70
                args.pop( 0 )
75
71
 
76
72
                # remaining arguments
77
 
                if len( args ):
78
 
                        raise the.program.UsageError( 'too many arguments' )
 
73
                self.files = args
79
74
 
80
75
 
81
76
        def run( self ):
82
77
 
83
78
                # set up repo and check it exists
84
 
                the.set_repo( self.repo )
85
79
                the.repo.check_dir_exists()
86
80
 
 
81
                # determine files
 
82
                files = self.expand_files( self.files )
 
83
 
87
84
                message = ''
88
85
 
89
86
                # initialise deployment and check if it's ongoing
90
87
                deployment = Deployment()
91
88
                if deployment.is_ongoing():
 
89
                        print "deployment ongoing"
92
90
 
93
91
                        # check for conflicts in repo
94
92
                        files = the.repo.vcs.get_conflicts()
105
103
                else:
106
104
 
107
105
                        # check status
108
 
                        walker = StatusWalker()
 
106
                        walker = StatusWalker( files if files else None )
109
107
                        walker.walk()
110
108
                        if walker.modified:
111
109
                                message += 'modified:\n  %s\n' % \