# HG changeset patch # User Thomas Arendsen Hein # Date 1123326309 -3600 # Node ID 8fb4887730637b402513809c332f69c388b74b97 # Parent 03cc2ba291d119823d613084b87ca1dbec358966 Rewritten change type selection for hg status. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1033,24 +1033,23 @@ def status(ui, repo, *pats, **opts): M = modified A = added R = removed - ? = not tracked''' + ? = not tracked + ''' cwd = repo.getcwd() files, matchfn = matchpats(cwd, pats, opts) (c, a, d, u) = [[pathto(cwd, x) for x in n] for n in repo.changes(files=files, match=matchfn)] - filetype = ""; - if opts['modified']: filetype += "M"; - if opts[ 'added']: filetype += "A"; - if opts[ 'removed']: filetype += "R"; - if opts[ 'unknown']: filetype += "?"; - if filetype == "" : filetype = "MAR?" - - for key, value in zip(["M", "A", "R", "?"], (c, a, d, u)): - if value and filetype.find(key) >= 0: - for f in value: - ui.write("%s " % key, f, "\n") + changetypes = [('modified', 'M', c), + ('added', 'A', a), + ('removed', 'R', d), + ('unknown', '?', u)] + + for opt, char, changes in ([ct for ct in changetypes if opts[ct[0]]] + or changetypes): + for f in changes: + ui.write("%s %s\n" % (char, f)) def tag(ui, repo, name, rev=None, **opts): """add a tag for the current tip or a given revision"""