# HG changeset patch # User Eric Roshan Eisner # Date 2011-10-12 01:18:15 # Node ID cd6f10dccf1618481e1c2c76cc97d065a4c69e37 # Parent 697289c5d41569ee9a4f5f18a8e8303a95eca97b cmdutil.bailifchanged: abort for dirty subrepos diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -75,6 +75,10 @@ def bailifchanged(repo): 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 """ diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t --- a/tests/test-subrepo.t +++ b/tests/test-subrepo.t @@ -52,6 +52,14 @@ Issue2022: update -C 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