# HG changeset patch # User Brendan Cully # Date 1153320736 25200 # Node ID 001703ec311d7f92f40f39a7b93e71aef0d59560 # Parent 8dadff054acf96806ecd85b264f5e8e2456420cc Add an option '-C|--copies' to hg status to show the source of copied files. Copied files are displayed in the form: A newname oldname diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2609,6 +2609,7 @@ def status(ui, repo, *pats, **opts): ! = deleted, but still tracked ? = not tracked I = ignored (not shown by default) + = the previous added file was copied from here """ show_ignored = opts['ignored'] and True or False @@ -2637,6 +2638,9 @@ def status(ui, repo, *pats, **opts): for f in changes: ui.write(format % f) + if (opts.get('copies') and not opts.get('no_status') + and opt == 'added' and repo.dirstate.copies.has_key(f)): + ui.write(' %s%s' % (repo.dirstate.copies[f], end)) def tag(ui, repo, name, rev_=None, **opts): """add a tag for the current tip or a given revision @@ -3126,6 +3130,7 @@ table = { ('u', 'unknown', None, _('show only unknown (not tracked) files')), ('i', 'ignored', None, _('show ignored files')), ('n', 'no-status', None, _('hide status prefix')), + ('C', 'copies', None, _('show source of copied files')), ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), ('I', 'include', [], _('include names matching the given patterns')), diff --git a/tests/test-status b/tests/test-status --- a/tests/test-status +++ b/tests/test-status @@ -32,3 +32,6 @@ echo "hg status:" hg status echo "hg status modified added removed deleted unknown never-existed ignored:" hg status modified added removed deleted unknown never-existed ignored +hg copy modified copied +echo "hg status -C:" +hg status -C diff --git a/tests/test-status.out b/tests/test-status.out --- a/tests/test-status.out +++ b/tests/test-status.out @@ -101,3 +101,10 @@ R removed ! deleted ? ignored ? unknown +hg status -C: +A added +A copied + modified +R removed +! deleted +? unknown