##// END OF EJS Templates
keyword: access status fields by name rather than index
Martin von Zweigbergk -
r22918:31f34a21 default
parent child Browse files
Show More
@@ -171,9 +171,8 b' def _preselect(wstatus, changed):'
171 '''Retrieves modified and added files from a working directory state
171 '''Retrieves modified and added files from a working directory state
172 and returns the subset of each contained in given changed files
172 and returns the subset of each contained in given changed files
173 retrieved from a change context.'''
173 retrieved from a change context.'''
174 modified, added = wstatus[:2]
174 modified = [f for f in wstatus.modified if f in changed]
175 modified = [f for f in modified if f in changed]
175 added = [f for f in wstatus.added if f in changed]
176 added = [f for f in added if f in changed]
177 return modified, added
176 return modified, added
178
177
179
178
@@ -349,10 +348,9 b' def _kwfwrite(ui, repo, expand, *pats, *'
349 wlock = repo.wlock()
348 wlock = repo.wlock()
350 try:
349 try:
351 status = _status(ui, repo, wctx, kwt, *pats, **opts)
350 status = _status(ui, repo, wctx, kwt, *pats, **opts)
352 modified, added, removed, deleted, unknown, ignored, clean = status
351 if status.modified or status.added or status.removed or status.deleted:
353 if modified or added or removed or deleted:
354 raise util.Abort(_('outstanding uncommitted changes'))
352 raise util.Abort(_('outstanding uncommitted changes'))
355 kwt.overwrite(wctx, clean, True, expand)
353 kwt.overwrite(wctx, status.clean, True, expand)
356 finally:
354 finally:
357 wlock.release()
355 wlock.release()
358
356
@@ -503,20 +501,19 b' def files(ui, repo, *pats, **opts):'
503 wctx = repo[None]
501 wctx = repo[None]
504 status = _status(ui, repo, wctx, kwt, *pats, **opts)
502 status = _status(ui, repo, wctx, kwt, *pats, **opts)
505 cwd = pats and repo.getcwd() or ''
503 cwd = pats and repo.getcwd() or ''
506 modified, added, removed, deleted, unknown, ignored, clean = status
507 files = []
504 files = []
508 if not opts.get('unknown') or opts.get('all'):
505 if not opts.get('unknown') or opts.get('all'):
509 files = sorted(modified + added + clean)
506 files = sorted(status.modified + status.added + status.clean)
510 kwfiles = kwt.iskwfile(files, wctx)
507 kwfiles = kwt.iskwfile(files, wctx)
511 kwdeleted = kwt.iskwfile(deleted, wctx)
508 kwdeleted = kwt.iskwfile(status.deleted, wctx)
512 kwunknown = kwt.iskwfile(unknown, wctx)
509 kwunknown = kwt.iskwfile(status.unknown, wctx)
513 if not opts.get('ignore') or opts.get('all'):
510 if not opts.get('ignore') or opts.get('all'):
514 showfiles = kwfiles, kwdeleted, kwunknown
511 showfiles = kwfiles, kwdeleted, kwunknown
515 else:
512 else:
516 showfiles = [], [], []
513 showfiles = [], [], []
517 if opts.get('all') or opts.get('ignore'):
514 if opts.get('all') or opts.get('ignore'):
518 showfiles += ([f for f in files if f not in kwfiles],
515 showfiles += ([f for f in files if f not in kwfiles],
519 [f for f in unknown if f not in kwunknown])
516 [f for f in status.unknown if f not in kwunknown])
520 kwlabels = 'enabled deleted enabledunknown ignored ignoredunknown'.split()
517 kwlabels = 'enabled deleted enabledunknown ignored ignoredunknown'.split()
521 kwstates = zip(kwlabels, 'K!kIi', showfiles)
518 kwstates = zip(kwlabels, 'K!kIi', showfiles)
522 fm = ui.formatter('kwfiles', opts)
519 fm = ui.formatter('kwfiles', opts)
General Comments 0
You need to be logged in to leave comments. Login now