summary: add subrepo status
authorMatt Mackall <mpm@selenic.com>
Mon, 03 May 2010 17:05:23 -0500
changeset 11088 c4347e48b0d0
parent 11087 dc2f37864348
child 11091 3ec4c5442910
summary: add subrepo status
mercurial/commands.py
tests/test-subrepo
tests/test-subrepo.out
--- a/mercurial/commands.py	Sat May 01 23:59:39 2010 +0200
+++ b/mercurial/commands.py	Mon May 03 17:05:23 2010 -0500
@@ -3109,15 +3109,21 @@
         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 @@
         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:
--- a/tests/test-subrepo	Sat May 01 23:59:39 2010 +0200
+++ b/tests/test-subrepo	Mon May 03 17:05:23 2010 -0500
@@ -16,6 +16,7 @@
 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 @@
 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
--- a/tests/test-subrepo.out	Sat May 01 23:59:39 2010 +0200
+++ b/tests/test-subrepo.out	Mon May 03 17:05:23 2010 -0500
@@ -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