[PATCH] cmdutil.bailifchanged: abort for dirty subrepos
Eric Roshan Eisner
ede at alum.mit.edu
Wed Oct 12 01:21:53 UTC 2011
# HG changeset patch
# User Eric Roshan Eisner <ede at alum.mit.edu>
# Date 1318382295 25200
# Node ID d9685d40d46893974282db86737e3aab88382f46
# Parent c81dce8a7bb642248b787c3139409d94dbe998ab
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
More information about the Mercurial-devel
mailing list