[PATCH] add copy information to hg status -v

Brendan Cully brendan at kublai.com
Mon Jun 26 21:26:48 UTC 2006


This version uses -C|--copies to enable copy information, instead of
piggybacking on -v.

On Monday, 26 June 2006 at 13:23, Brendan Cully wrote:
> This patch adds copy information to hg status -v. To keep it easy to
> parse, copies are displayed in the form:
> 
> A newfile<delim>oldfile<delim>
> 
> where <delim> is '\n' or '\0' depending on whether --print0 is
> specified.
-------------- next part --------------
# HG changeset patch
# User Brendan Cully <brendan at kublai.com>
# Node ID a7d7dac89a1d0711ec89729d8aaf1017155c9cb2
# Parent  b73552a00b209c8fcd71fd23fb990c5d05910010
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 -r b73552a00b20 -r a7d7dac89a1d mercurial/commands.py
--- a/mercurial/commands.py	Mon Jun 26 16:47:24 2006 +0200
+++ b/mercurial/commands.py	Mon Jun 26 14:25:28 2006 -0700
@@ -2606,6 +2606,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
@@ -2634,6 +2635,9 @@ def status(ui, repo, *pats, **opts):
 
         for f in changes:
             ui.write(format % f)
+            if (opts['copies'] and not opts['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
@@ -3135,6 +3139,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')),


More information about the Mercurial mailing list