changeset 11331:997ab9af81df

summary: report copies and renames
author Matt Mackall <mpm@selenic.com>
date Wed, 09 Jun 2010 16:39:25 -0500
parents 713ae78bb583
children 716e176a4e01
files mercurial/commands.py tests/test-copy tests/test-copy.out tests/test-rename tests/test-rename.out
diffstat 5 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Jun 10 09:32:19 2010 -0700
+++ b/mercurial/commands.py	Wed Jun 09 16:39:25 2010 -0500
@@ -3307,6 +3307,19 @@
 
     st = list(repo.status(unknown=True))[:6]
 
+    c = repo.dirstate.copies()
+    copied, renamed = [], []
+    for d, s in c.iteritems():
+        if s in st[2]:
+            st[2].remove(s)
+            renamed.append(d)
+        else:
+            copied.append(d)
+        if d in st[1]:
+            st[1].remove(d)
+    st.insert(3, renamed)
+    st.insert(4, copied)
+
     ms = mergemod.mergestate(repo)
     st.append([f for f in ms if ms[f] == 'u'])
 
@@ -3316,6 +3329,8 @@
     labels = [ui.label(_('%d modified'), 'status.modified'),
               ui.label(_('%d added'), 'status.added'),
               ui.label(_('%d removed'), 'status.removed'),
+              ui.label(_('%d renamed'), 'status.copied'),
+              ui.label(_('%d copied'), 'status.copied'),
               ui.label(_('%d deleted'), 'status.deleted'),
               ui.label(_('%d unknown'), 'status.unknown'),
               ui.label(_('%d ignored'), 'status.ignored'),
@@ -3336,7 +3351,7 @@
     elif (parents[0].extra().get('close') and
           pnode in repo.branchheads(branch, closed=True)):
         t += _(' (head closed)')
-    elif (not st[0] and not st[1] and not st[2] and not st[7]):
+    elif not (st[0] or st[1] or st[2] or st[3] or st[4] or st[9]):
         t += _(' (clean)')
         cleanworkdir = True
     elif pnode not in bheads:
--- a/tests/test-copy	Thu Jun 10 09:32:19 2010 -0700
+++ b/tests/test-copy	Wed Jun 09 16:39:25 2010 -0500
@@ -7,6 +7,7 @@
 hg status
 hg copy a b
 hg status
+hg sum
 hg --debug commit -m "2" -d "1000000 0"
 echo "we should see two history entries"
 hg history -v
--- a/tests/test-copy.out	Thu Jun 10 09:32:19 2010 -0700
+++ b/tests/test-copy.out	Wed Jun 09 16:39:25 2010 -0500
@@ -1,4 +1,9 @@
 A b
+parent: 0:33aaa84a386b tip
+ 1
+branch: default
+commit: 1 copied
+update: (current)
 b
  b: copy a:b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3
 committed changeset 1:76973b01f66a012648546c979ea4c41de9e7d8cd
--- a/tests/test-rename	Thu Jun 10 09:32:19 2010 -0700
+++ b/tests/test-rename	Wed Jun 09 16:39:25 2010 -0500
@@ -12,6 +12,7 @@
 
 echo "# rename a single file"
 hg rename d1/d11/a1 d2/c
+hg sum
 hg status -C
 hg update -C
 rm d2/c
--- a/tests/test-rename.out	Thu Jun 10 09:32:19 2010 -0700
+++ b/tests/test-rename.out	Wed Jun 09 16:39:25 2010 -0500
@@ -1,4 +1,9 @@
 # rename a single file
+parent: 0:6f9914c7a010 tip
+ 1
+branch: default
+commit: 1 renamed
+update: (current)
 A d2/c
   d1/d11/a1
 R d1/d11/a1