/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-04 22:33:09 UTC
  • Revision ID: tim@ed.am-20140404223309-macifjzkiryg982n
read ~/.stdhomerc; commands set repo before run(); program performs late
initialisation of some variables; updated help

Show diffs side-by-side

added added

removed removed

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
33
                print "Usage: " + the.program.name + " status [--repo=REPO]"
38
34
                print
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":
81
77
        def run( self ):
82
78
 
83
79
                # set up repo and check it exists
84
 
                the.set_repo( self.repo )
85
80
                the.repo.check_dir_exists()
86
81
 
87
82
                message = ''
93
88
                        # check for conflicts in repo
94
89
                        files = the.repo.vcs.get_conflicts()
95
90
                        if files:
96
 
                                message += 'Conflicts in %s:\n  %s\n' % \
 
91
                                message += 'conflicts in %s:\n  %s\n' % \
97
92
                                                   ( the.repo.name, '\n  '.join( files ) )
98
93
 
99
94
                        # get deployment conflicts
100
95
                        conflicts = deployment.get_conflicts()
101
96
                        if conflicts:
102
 
                                message += 'Deployment conflicts:\n  %s\n' % \
 
97
                                message += 'deployment conflicts:\n  %s\n' % \
103
98
                                                   '\n  '.join( conflicts )
104
99
 
105
100
                else:
108
103
                        walker = StatusWalker()
109
104
                        walker.walk()
110
105
                        if walker.modified:
111
 
                                message += 'Modified:\n  %s\n' % \
 
106
                                message += 'modified:\n  %s\n' % \
112
107
                                                   '\n  '.join( walker.modified )
113
108
                        if walker.missing:
114
 
                                message += 'Missing:\n  %s\n' % \
 
109
                                message += 'missing:\n  %s\n' % \
115
110
                                                   '\n  '.join( walker.missing )
116
111
                        if walker.changed:
117
 
                                message += 'Type changed:\n  %s\n' % \
 
112
                                message += 'kind changed:\n  %s\n' % \
118
113
                                                   '\n  '.join( walker.changed )
119
114
 
120
115
                # show status