29
29
class StatusCommand( Command ):
32
36
def print_help( self ):
33
print "Usage: " + the.program.name + " status [--repo=REPO] [FILE]..."
37
print "Usage: " + the.program.name + " status [--repo=REPO]"
35
39
# 01234567890123456789012345678901234567890123456789012345678901234567890123456789
36
40
print "Show the state of files in the local repository (including modifications and"
39
43
print "This lists files in your home directory that have been modified and which differ"
40
44
print "from those in the local repository. During an update that resulted in conflicts"
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."
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."
44
48
print "For help with adding modified files to the repository, type:"
45
49
print " " + the.program.name + " add --help"
57
61
[ "repo=", "verbose", "help" ] )
58
62
for opt, optarg in opts:
59
63
if opt in [ '--repo', '-r' ]:
60
if not re.search( '^[-a-zA-z0-9.]+$', optarg ):
64
if not re.match( '^[-a-zA-z0-9.]+$', optarg ):
61
65
raise the.program.FatalError(
62
66
'invalid repository name: ' + optarg )
64
68
elif opt in [ '--verbose', '-v' ]:
66
70
elif opt == "--help":
69
73
# discard first argument (the command)
72
76
# remaining arguments
78
raise the.program.UsageError( 'too many arguments' )
78
83
# set up repo and check it exists
84
the.set_repo( self.repo )
79
85
the.repo.check_dir_exists()
82
files = self.expand_files( self.files )
86
89
# initialise deployment and check if it's ongoing
87
90
deployment = Deployment()
88
91
if deployment.is_ongoing():
89
print "deployment ongoing"
91
93
# check for conflicts in repo
92
94
files = the.repo.vcs.get_conflicts()
94
message += 'conflicts in %s:\n %s\n' % \
96
message += 'Conflicts in %s:\n %s\n' % \
95
97
( the.repo.name, '\n '.join( files ) )
97
99
# get deployment conflicts
98
100
conflicts = deployment.get_conflicts()
100
message += 'deployment conflicts:\n %s\n' % \
102
message += 'Deployment conflicts:\n %s\n' % \
101
103
'\n '.join( conflicts )
106
walker = StatusWalker( files if files else None )
108
walker = StatusWalker()
108
110
if walker.modified:
109
message += 'modified:\n %s\n' % \
111
message += 'Modified:\n %s\n' % \
110
112
'\n '.join( walker.modified )
111
113
if walker.missing:
112
message += 'missing:\n %s\n' % \
114
message += 'Missing:\n %s\n' % \
113
115
'\n '.join( walker.missing )
114
116
if walker.changed:
115
message += 'kind changed:\n %s\n' % \
117
message += 'Type changed:\n %s\n' % \
116
118
'\n '.join( walker.changed )