From 1d338ff2d81ed43ebf8f1c5215c05aa15a3a1a34 Mon Sep 17 00:00:00 2001 From: Matt Mackall Date: Mon, 3 May 2010 17:05:23 -0500 Subject: [PATCH] summary: add subrepo status --- mercurial/commands.py | 10 ++++++++-- tests/test-subrepo | 3 +++ tests/test-subrepo.out | 15 +++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/mercurial/commands.py b/mercurial/commands.py index d34c7e1dc1..95989f92d2 100644 --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -3109,15 +3109,21 @@ def summary(ui, repo, **opts): ui.status(m, label='log.branch') st = list(repo.status(unknown=True))[:6] + ms = mergemod.mergestate(repo) st.append([f for f in ms if ms[f] == 'u']) + + subs = [s for s in ctx.substate if ctx.sub(s).dirty()] + st.append(subs) + labels = [ui.label(_('%d modified'), 'status.modified'), ui.label(_('%d added'), 'status.added'), ui.label(_('%d removed'), 'status.removed'), ui.label(_('%d deleted'), 'status.deleted'), ui.label(_('%d unknown'), 'status.unknown'), ui.label(_('%d ignored'), 'status.ignored'), - ui.label(_('%d unresolved'), 'resolve.unresolved')] + ui.label(_('%d unresolved'), 'resolve.unresolved'), + ui.label(_('%d subrepos'), 'status.modified')] t = [] for s, l in zip(st, labels): if s: @@ -3130,7 +3136,7 @@ def summary(ui, repo, **opts): t += _(' (merge)') elif branch != parents[0].branch(): t += _(' (new branch)') - elif (not st[0] and not st[1] and not st[2]): + elif (not st[0] and not st[1] and not st[2] and not st[7]): t += _(' (clean)') cleanworkdir = True elif pnode not in bheads: diff --git a/tests/test-subrepo b/tests/test-subrepo index ce55c1ed33..8d75a08850 100755 --- a/tests/test-subrepo +++ b/tests/test-subrepo @@ -16,6 +16,7 @@ hg add .hgsub hg init s echo a > s/a hg -R s ci -Ams0 +hg sum hg ci -m1 echo % add sub sub @@ -24,7 +25,9 @@ hg init s/ss echo a > s/ss/a hg -R s add s/.hgsub hg -R s/ss add s/ss/a +hg sum hg ci -m2 +hg sum echo % bump sub rev echo b > s/a diff --git a/tests/test-subrepo.out b/tests/test-subrepo.out index 9cbd877552..627ddb6601 100644 --- a/tests/test-subrepo.out +++ b/tests/test-subrepo.out @@ -2,10 +2,25 @@ adding a % add first sub adding a +parent: 0:f7b1eb17ad24 tip + 0 +branch: default +commit: 1 added, 1 subrepos +update: (current) committing subrepository s % add sub sub +parent: 1:7cf8cfea66e4 tip + 1 +branch: default +commit: 1 subrepos +update: (current) committing subrepository s committing subrepository ss +parent: 2:df30734270ae tip + 2 +branch: default +commit: (clean) +update: (current) % bump sub rev committing subrepository s % leave sub dirty