@@ -189,9 +189,11 @@ def status(fp):
189
189
190
190
Returns:
191
191
FILE_NOT_FOUND or a named tuple (fp, type, exists_in_lr, exists_in_wd,
192
- modified, in_conflict, resolved) where fp is a file path type is one of
192
+ modified, in_conflict, resolved) where fp is a file path, type is one of
193
193
TRACKED, UNTRACKED or IGNORED and all the remaining fields are booleans. The
194
- in_conflict and resolved fields are only applicable if the file is TRACKED.
194
+ modified field is True if the working version of the file differs from its
195
+ committed version (If there's no committed version, modified is set to
196
+ True.)
195
197
"""
196
198
return _status (fp )[0 ]
197
199
@@ -201,11 +203,18 @@ def status_all():
201
203
202
204
Returns:
203
205
a list of named tuples (fp, type, exists_in_lr, exists_in_wd, modified,
204
- in_conflict, resolved) where fp is a file path type is one of TRACKED,
206
+ in_conflict, resolved) where fp is a file path, type is one of TRACKED,
205
207
UNTRACKED or IGNORED and all the remaining fields are booleans. The
206
- in_conflict and resolved fields are only applicable if the file is TRACKED.
208
+ modified field is True if the working version of the file differs from its
209
+ committed version. (If there's no committed version, modified is set to
210
+ True.)
207
211
"""
208
- return [_build_f_st (s , fp ) for (s , fp ) in git_status .of_repo ()]
212
+ ret = []
213
+ for (s , fp ) in git_status .of_repo ():
214
+ f_st = _build_f_st (s , fp )
215
+ if f_st :
216
+ ret .append (f_st )
217
+ return ret
209
218
210
219
211
220
def resolve (fp ):
@@ -249,7 +258,10 @@ def _status(fp):
249
258
s = git_status .of_file (fp )
250
259
if s == git_status .FILE_NOT_FOUND :
251
260
return (FILE_NOT_FOUND , s )
252
- return (_build_f_st (s , fp ), s )
261
+ gls = _build_f_st (s , fp )
262
+ if not gls :
263
+ return (FILE_NOT_FOUND , s )
264
+ return (gls , s )
253
265
254
266
255
267
def _build_f_st (s , fp ):
@@ -267,20 +279,22 @@ def _build_f_st(s, fp):
267
279
# Staged file don't exist in the lr for Gitless.
268
280
ret = FileStatus (fp , TRACKED , False , True , True , False , False )
269
281
elif s == git_status .ASSUME_UNCHANGED :
282
+ # TODO(sperezde): detect whether it is modified or not?
270
283
ret = FileStatus (fp , UNTRACKED , True , True , True , False , False )
271
284
elif s == git_status .DELETED :
272
285
ret = FileStatus (fp , TRACKED , True , False , True , False , False )
273
286
elif s == git_status .DELETED_STAGED :
274
287
# This can only happen if the user did a rm of a new file. The file doesn't
275
288
# exist anymore for Gitless.
276
289
git_file .unstage (fp )
290
+ ret = None
277
291
elif s == git_status .DELETED_ASSUME_UNCHANGED :
278
- ret = FileStatus ( fp , UNTRACKED , True , False , True , False , False )
292
+ ret = None
279
293
elif s == git_status .IN_CONFLICT :
280
294
wr = _was_resolved (fp )
281
295
ret = FileStatus (fp , TRACKED , True , True , True , not wr , wr )
282
296
elif s == git_status .IGNORED or s == git_status .IGNORED_STAGED :
283
- ret = FileStatus (fp , IGNORED , True , True , True , True , False )
297
+ ret = FileStatus (fp , IGNORED , False , True , True , True , False )
284
298
elif s == git_status .MODIFIED_MODIFIED :
285
299
# The file was marked as resolved and then modified. To Gitless, this is
286
300
# just a regular tracked file.
0 commit comments