Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 2661:5c10b7ed3411
status: add -c (clean) and -A (all files) options
also add new localrepo.status what is more uniform than localrepo.changes.
localrepo.changes is deprecated and will go away soon.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Thu, 20 Jul 2006 16:21:07 -0700 |
parents | 001703ec311d |
children | 2c5d5cf35034 |
comparison
equal
deleted
inserted
replaced
2640:02b6fa7bbfbf | 2661:5c10b7ed3411 |
---|---|
2597 httpd.serve_forever() | 2597 httpd.serve_forever() |
2598 | 2598 |
2599 def status(ui, repo, *pats, **opts): | 2599 def status(ui, repo, *pats, **opts): |
2600 """show changed files in the working directory | 2600 """show changed files in the working directory |
2601 | 2601 |
2602 Show changed files in the repository. If names are | 2602 Show status of files in the repository. If names are given, only |
2603 given, only files that match are shown. | 2603 files that match are shown. Files that are clean or ignored, are |
2604 not listed unless -c (clean), -i (ignored) or -A is given. | |
2604 | 2605 |
2605 The codes used to show the status of files are: | 2606 The codes used to show the status of files are: |
2606 M = modified | 2607 M = modified |
2607 A = added | 2608 A = added |
2608 R = removed | 2609 R = removed |
2610 C = clean | |
2609 ! = deleted, but still tracked | 2611 ! = deleted, but still tracked |
2610 ? = not tracked | 2612 ? = not tracked |
2611 I = ignored (not shown by default) | 2613 I = ignored (not shown by default) |
2612 = the previous added file was copied from here | 2614 = the previous added file was copied from here |
2613 """ | 2615 """ |
2614 | 2616 |
2615 show_ignored = opts['ignored'] and True or False | 2617 all = opts['all'] |
2618 | |
2616 files, matchfn, anypats = matchpats(repo, pats, opts) | 2619 files, matchfn, anypats = matchpats(repo, pats, opts) |
2617 cwd = (pats and repo.getcwd()) or '' | 2620 cwd = (pats and repo.getcwd()) or '' |
2618 modified, added, removed, deleted, unknown, ignored = [ | 2621 modified, added, removed, deleted, unknown, ignored, clean = [ |
2619 [util.pathto(cwd, x) for x in n] | 2622 [util.pathto(cwd, x) for x in n] |
2620 for n in repo.changes(files=files, match=matchfn, | 2623 for n in repo.status(files=files, match=matchfn, |
2621 show_ignored=show_ignored)] | 2624 list_ignored=all or opts['ignored'], |
2622 | 2625 list_clean=all or opts['clean'])] |
2623 changetypes = [('modified', 'M', modified), | 2626 |
2627 changetypes = (('modified', 'M', modified), | |
2624 ('added', 'A', added), | 2628 ('added', 'A', added), |
2625 ('removed', 'R', removed), | 2629 ('removed', 'R', removed), |
2626 ('deleted', '!', deleted), | 2630 ('deleted', '!', deleted), |
2627 ('unknown', '?', unknown), | 2631 ('unknown', '?', unknown), |
2628 ('ignored', 'I', ignored)] | 2632 ('ignored', 'I', ignored)) |
2633 | |
2634 explicit_changetypes = changetypes + (('clean', 'C', clean),) | |
2629 | 2635 |
2630 end = opts['print0'] and '\0' or '\n' | 2636 end = opts['print0'] and '\0' or '\n' |
2631 | 2637 |
2632 for opt, char, changes in ([ct for ct in changetypes if opts[ct[0]]] | 2638 for opt, char, changes in ([ct for ct in explicit_changetypes |
2639 if all or opts[ct[0]]] | |
2633 or changetypes): | 2640 or changetypes): |
2634 if opts['no_status']: | 2641 if opts['no_status']: |
2635 format = "%%s%s" % end | 2642 format = "%%s%s" % end |
2636 else: | 2643 else: |
2637 format = "%s %%s%s" % (char, end) | 2644 format = "%s %%s%s" % (char, end) |
2638 | 2645 |
2639 for f in changes: | 2646 for f in changes: |
2640 ui.write(format % f) | 2647 ui.write(format % f) |
2641 if (opts.get('copies') and not opts.get('no_status') | 2648 if ((all or opts.get('copies')) and not opts.get('no_status') |
2642 and opt == 'added' and repo.dirstate.copies.has_key(f)): | 2649 and opt == 'added' and repo.dirstate.copies.has_key(f)): |
2643 ui.write(' %s%s' % (repo.dirstate.copies[f], end)) | 2650 ui.write(' %s%s' % (repo.dirstate.copies[f], end)) |
2644 | 2651 |
2645 def tag(ui, repo, name, rev_=None, **opts): | 2652 def tag(ui, repo, name, rev_=None, **opts): |
2646 """add a tag for the current tip or a given revision | 2653 """add a tag for the current tip or a given revision |
3121 ('', 'style', '', _('template style to use')), | 3128 ('', 'style', '', _('template style to use')), |
3122 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))], | 3129 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))], |
3123 _('hg serve [OPTION]...')), | 3130 _('hg serve [OPTION]...')), |
3124 "^status|st": | 3131 "^status|st": |
3125 (status, | 3132 (status, |
3126 [('m', 'modified', None, _('show only modified files')), | 3133 [('A', 'all', None, _('show status of all files')), |
3134 ('m', 'modified', None, _('show only modified files')), | |
3127 ('a', 'added', None, _('show only added files')), | 3135 ('a', 'added', None, _('show only added files')), |
3128 ('r', 'removed', None, _('show only removed files')), | 3136 ('r', 'removed', None, _('show only removed files')), |
3129 ('d', 'deleted', None, _('show only deleted (but tracked) files')), | 3137 ('d', 'deleted', None, _('show only deleted (but tracked) files')), |
3138 ('c', 'clean', None, _('show only files without changes')), | |
3130 ('u', 'unknown', None, _('show only unknown (not tracked) files')), | 3139 ('u', 'unknown', None, _('show only unknown (not tracked) files')), |
3131 ('i', 'ignored', None, _('show ignored files')), | 3140 ('i', 'ignored', None, _('show ignored files')), |
3132 ('n', 'no-status', None, _('hide status prefix')), | 3141 ('n', 'no-status', None, _('hide status prefix')), |
3133 ('C', 'copies', None, _('show source of copied files')), | 3142 ('C', 'copies', None, _('show source of copied files')), |
3134 ('0', 'print0', None, | 3143 ('0', 'print0', None, |