/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:28:49 UTC
  • Revision ID: tim@ed.am-20140404222849-32apy1i949qaq2na
walker now passes Walker.File objects to process(), which includes file name,
type and the type of file it points to when it's a symlink

Show diffs side-by-side

added added

removed removed

1
 
# command_status.py
 
1
# 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
 
import the
24
 
from deployment import Deployment
25
 
from walker.status_walker import StatusWalker
26
 
 
27
 
 
28
 
class CommandStatus:
 
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 ):
29
30
 
30
31
 
31
32
        def __init__( self ):
65
66
                                                'invalid repository name: ' + optarg )
66
67
                                self.repo = optarg
67
68
                        elif opt in [ '--verbose', '-v' ]:
68
 
                                the.verbose = True
 
69
                                the.verbose += 1
69
70
                        elif opt == "--help":
70
71
                                self.print_help()
71
72
                
92
93
                        # check for conflicts in repo
93
94
                        files = the.repo.vcs.get_conflicts()
94
95
                        if files:
95
 
                                message += 'Conflicts in %s:\n  %s\n' % \
 
96
                                message += 'conflicts in %s:\n  %s\n' % \
96
97
                                                   ( the.repo.name, '\n  '.join( files ) )
97
98
 
98
99
                        # get deployment conflicts
99
100
                        conflicts = deployment.get_conflicts()
100
101
                        if conflicts:
101
 
                                message += 'Deployment conflicts:\n  %s\n' % \
 
102
                                message += 'deployment conflicts:\n  %s\n' % \
102
103
                                                   '\n  '.join( conflicts )
103
104
 
104
105
                else:
107
108
                        walker = StatusWalker()
108
109
                        walker.walk()
109
110
                        if walker.modified:
110
 
                                message += 'Modified:\n  %s\n' % \
 
111
                                message += 'modified:\n  %s\n' % \
111
112
                                                   '\n  '.join( walker.modified )
112
113
                        if walker.missing:
113
 
                                message += 'Missing:\n  %s\n' % \
 
114
                                message += 'missing:\n  %s\n' % \
114
115
                                                   '\n  '.join( walker.missing )
115
116
                        if walker.changed:
116
 
                                message += 'Type changed:\n  %s\n' % \
 
117
                                message += 'kind changed:\n  %s\n' % \
117
118
                                                   '\n  '.join( walker.changed )
118
119
 
119
120
                # show status