/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-02-26 19:15:30 UTC
  • Revision ID: tim@ed.am-20140226191530-6x21vlwto2xx80cd
renamed updated_files to affected_files

Show diffs side-by-side

added added

removed removed

1
 
# status.py
 
1
# command_status.py
2
2
#
3
3
# Copyright (C) 2014 Tim Marston <tim@edm.am>
4
4
#
20
20
 
21
21
 
22
22
import sys, re, getopt
23
 
from command import Command
24
 
import stdhome.the as the
25
 
from stdhome.deployment import Deployment
26
 
from stdhome.walker.status import StatusWalker
27
 
 
28
 
 
29
 
class StatusCommand( Command ):
 
23
import the
 
24
from deployment import Deployment
 
25
from walker.status_walker import StatusWalker
 
26
 
 
27
 
 
28
class CommandStatus:
30
29
 
31
30
 
32
31
        def __init__( self ):
66
65
                                                'invalid repository name: ' + optarg )
67
66
                                self.repo = optarg
68
67
                        elif opt in [ '--verbose', '-v' ]:
69
 
                                the.verbose += 1
 
68
                                the.verbose = True
70
69
                        elif opt == "--help":
71
70
                                self.print_help()
72
71
                
93
92
                        # check for conflicts in repo
94
93
                        files = the.repo.vcs.get_conflicts()
95
94
                        if files:
96
 
                                message += 'conflicts in %s:\n  %s\n' % \
 
95
                                message += 'Conflicts in %s:\n  %s\n' % \
97
96
                                                   ( the.repo.name, '\n  '.join( files ) )
98
97
 
99
98
                        # get deployment conflicts
100
99
                        conflicts = deployment.get_conflicts()
101
100
                        if conflicts:
102
 
                                message += 'deployment conflicts:\n  %s\n' % \
 
101
                                message += 'Deployment conflicts:\n  %s\n' % \
103
102
                                                   '\n  '.join( conflicts )
104
103
 
105
104
                else:
108
107
                        walker = StatusWalker()
109
108
                        walker.walk()
110
109
                        if walker.modified:
111
 
                                message += 'modified:\n  %s\n' % \
 
110
                                message += 'Modified:\n  %s\n' % \
112
111
                                                   '\n  '.join( walker.modified )
113
112
                        if walker.missing:
114
 
                                message += 'missing:\n  %s\n' % \
 
113
                                message += 'Missing:\n  %s\n' % \
115
114
                                                   '\n  '.join( walker.missing )
116
115
                        if walker.changed:
117
 
                                message += 'kind changed:\n  %s\n' % \
 
116
                                message += 'Type changed:\n  %s\n' % \
118
117
                                                   '\n  '.join( walker.changed )
119
118
 
120
119
                # show status