mercurial/commands.py
changeset 2662 2c5d5cf35034
parent 2656 e57df017640d
parent 2661 5c10b7ed3411
child 2673 109a22f5434a
equal deleted inserted replaced
2660:ad329294d808 2662:2c5d5cf35034
  2612     httpd.serve_forever()
  2612     httpd.serve_forever()
  2613 
  2613 
  2614 def status(ui, repo, *pats, **opts):
  2614 def status(ui, repo, *pats, **opts):
  2615     """show changed files in the working directory
  2615     """show changed files in the working directory
  2616 
  2616 
  2617     Show changed files in the repository.  If names are
  2617     Show status of files in the repository.  If names are given, only
  2618     given, only files that match are shown.
  2618     files that match are shown.  Files that are clean or ignored, are
       
  2619     not listed unless -c (clean), -i (ignored) or -A is given.
  2619 
  2620 
  2620     The codes used to show the status of files are:
  2621     The codes used to show the status of files are:
  2621     M = modified
  2622     M = modified
  2622     A = added
  2623     A = added
  2623     R = removed
  2624     R = removed
       
  2625     C = clean
  2624     ! = deleted, but still tracked
  2626     ! = deleted, but still tracked
  2625     ? = not tracked
  2627     ? = not tracked
  2626     I = ignored (not shown by default)
  2628     I = ignored (not shown by default)
  2627       = the previous added file was copied from here
  2629       = the previous added file was copied from here
  2628     """
  2630     """
  2629 
  2631 
  2630     show_ignored = opts['ignored'] and True or False
  2632     all = opts['all']
       
  2633     
  2631     files, matchfn, anypats = matchpats(repo, pats, opts)
  2634     files, matchfn, anypats = matchpats(repo, pats, opts)
  2632     cwd = (pats and repo.getcwd()) or ''
  2635     cwd = (pats and repo.getcwd()) or ''
  2633     modified, added, removed, deleted, unknown, ignored = [
  2636     modified, added, removed, deleted, unknown, ignored, clean = [
  2634         [util.pathto(cwd, x) for x in n]
  2637         [util.pathto(cwd, x) for x in n]
  2635         for n in repo.changes(files=files, match=matchfn,
  2638         for n in repo.status(files=files, match=matchfn,
  2636                               show_ignored=show_ignored)]
  2639                              list_ignored=all or opts['ignored'],
  2637 
  2640                              list_clean=all or opts['clean'])]
  2638     changetypes = [('modified', 'M', modified),
  2641 
       
  2642     changetypes = (('modified', 'M', modified),
  2639                    ('added', 'A', added),
  2643                    ('added', 'A', added),
  2640                    ('removed', 'R', removed),
  2644                    ('removed', 'R', removed),
  2641                    ('deleted', '!', deleted),
  2645                    ('deleted', '!', deleted),
  2642                    ('unknown', '?', unknown),
  2646                    ('unknown', '?', unknown),
  2643                    ('ignored', 'I', ignored)]
  2647                    ('ignored', 'I', ignored))
       
  2648 
       
  2649     explicit_changetypes = changetypes + (('clean', 'C', clean),)
  2644 
  2650 
  2645     end = opts['print0'] and '\0' or '\n'
  2651     end = opts['print0'] and '\0' or '\n'
  2646 
  2652 
  2647     for opt, char, changes in ([ct for ct in changetypes if opts[ct[0]]]
  2653     for opt, char, changes in ([ct for ct in explicit_changetypes
       
  2654                                 if all or opts[ct[0]]]
  2648                                or changetypes):
  2655                                or changetypes):
  2649         if opts['no_status']:
  2656         if opts['no_status']:
  2650             format = "%%s%s" % end
  2657             format = "%%s%s" % end
  2651         else:
  2658         else:
  2652             format = "%s %%s%s" % (char, end)
  2659             format = "%s %%s%s" % (char, end)
  2653 
  2660 
  2654         for f in changes:
  2661         for f in changes:
  2655             ui.write(format % f)
  2662             ui.write(format % f)
  2656             if (opts.get('copies') and not opts.get('no_status')
  2663             if ((all or opts.get('copies')) and not opts.get('no_status')
  2657                 and opt == 'added' and repo.dirstate.copies.has_key(f)):
  2664                 and opt == 'added' and repo.dirstate.copies.has_key(f)):
  2658                 ui.write('  %s%s' % (repo.dirstate.copies[f], end))
  2665                 ui.write('  %s%s' % (repo.dirstate.copies[f], end))
  2659 
  2666 
  2660 def tag(ui, repo, name, rev_=None, **opts):
  2667 def tag(ui, repo, name, rev_=None, **opts):
  2661     """add a tag for the current tip or a given revision
  2668     """add a tag for the current tip or a given revision
  3142           ('', 'style', '', _('template style to use')),
  3149           ('', 'style', '', _('template style to use')),
  3143           ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))],
  3150           ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))],
  3144          _('hg serve [OPTION]...')),
  3151          _('hg serve [OPTION]...')),
  3145     "^status|st":
  3152     "^status|st":
  3146         (status,
  3153         (status,
  3147          [('m', 'modified', None, _('show only modified files')),
  3154          [('A', 'all', None, _('show status of all files')),
       
  3155           ('m', 'modified', None, _('show only modified files')),
  3148           ('a', 'added', None, _('show only added files')),
  3156           ('a', 'added', None, _('show only added files')),
  3149           ('r', 'removed', None, _('show only removed files')),
  3157           ('r', 'removed', None, _('show only removed files')),
  3150           ('d', 'deleted', None, _('show only deleted (but tracked) files')),
  3158           ('d', 'deleted', None, _('show only deleted (but tracked) files')),
       
  3159           ('c', 'clean', None, _('show only files without changes')),
  3151           ('u', 'unknown', None, _('show only unknown (not tracked) files')),
  3160           ('u', 'unknown', None, _('show only unknown (not tracked) files')),
  3152           ('i', 'ignored', None, _('show ignored files')),
  3161           ('i', 'ignored', None, _('show ignored files')),
  3153           ('n', 'no-status', None, _('hide status prefix')),
  3162           ('n', 'no-status', None, _('hide status prefix')),
  3154           ('C', 'copies', None, _('show source of copied files')),
  3163           ('C', 'copies', None, _('show source of copied files')),
  3155           ('0', 'print0', None,
  3164           ('0', 'print0', None,