# HG changeset patch # User Matt Mackall # Date 2010-06-09 21:39:25 # Node ID 997ab9af81df27edefaaf2629baaf305e68a3fb3 # Parent 713ae78bb5834bfb56bafd6669876864051bb104 summary: report copies and renames diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3307,6 +3307,19 @@ def summary(ui, repo, **opts): 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 @@ def summary(ui, repo, **opts): 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 @@ def summary(ui, repo, **opts): 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: diff --git a/tests/test-copy b/tests/test-copy --- a/tests/test-copy +++ b/tests/test-copy @@ -7,6 +7,7 @@ hg commit -m "1" -d "1000000 0" 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 diff --git a/tests/test-copy.out b/tests/test-copy.out --- a/tests/test-copy.out +++ b/tests/test-copy.out @@ -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 diff --git a/tests/test-rename b/tests/test-rename --- a/tests/test-rename +++ b/tests/test-rename @@ -12,6 +12,7 @@ hg commit -m "1" -d "1000000 0" echo "# rename a single file" hg rename d1/d11/a1 d2/c +hg sum hg status -C hg update -C rm d2/c diff --git a/tests/test-rename.out b/tests/test-rename.out --- a/tests/test-rename.out +++ b/tests/test-rename.out @@ -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