changeset 15231:cd6f10dccf16

cmdutil.bailifchanged: abort for dirty subrepos
author Eric Roshan Eisner <ede@alum.mit.edu>
date Tue, 11 Oct 2011 18:18:15 -0700
parents 697289c5d415
children 5d9a5b919863
files mercurial/cmdutil.py tests/test-subrepo.t
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Oct 11 21:10:03 2011 -0400
+++ b/mercurial/cmdutil.py	Tue Oct 11 18:18:15 2011 -0700
@@ -75,6 +75,10 @@
     modified, added, removed, deleted = repo.status()[:4]
     if modified or added or removed or deleted:
         raise util.Abort(_("outstanding uncommitted changes"))
+    ctx = repo[None]
+    for s in ctx.substate:
+        if ctx.sub(s).dirty():
+            raise util.Abort(_("uncommitted changes in subrepo %s") % s)
 
 def logmessage(ui, opts):
     """ get the log message according to -m and -l option """
--- a/tests/test-subrepo.t	Tue Oct 11 21:10:03 2011 -0400
+++ b/tests/test-subrepo.t	Tue Oct 11 18:18:15 2011 -0700
@@ -52,6 +52,14 @@
   commit: (clean)
   update: (current)
 
+commands that require a clean repo should respect subrepos
+
+  $ echo b >> s/a
+  $ hg backout tip
+  abort: uncommitted changes in subrepo s
+  [255]
+  $ hg revert -C -R s s/a
+
 add sub sub
 
   $ echo ss = ss > s/.hgsub