diff mercurial/localrepo.py @ 11485:b602a95c21ec stable

subrepo: refuse to commit subrepos if .hgsub is excluded (issue2232)
author Matt Mackall <mpm@selenic.com>
date Thu, 01 Jul 2010 11:20:13 -0500
parents ee1ed6afac21
children d3c3e2fdeb0c
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Jul 01 11:20:08 2010 -0500
+++ b/mercurial/localrepo.py	Thu Jul 01 11:20:13 2010 -0500
@@ -826,8 +826,13 @@
                 removedsubs.discard(s)
                 if match(s) and wctx.sub(s).dirty():
                     subs.append(s)
-            if (subs or removedsubs) and '.hgsubstate' not in changes[0]:
-                changes[0].insert(0, '.hgsubstate')
+            if (subs or removedsubs):
+                # is hgsub modified and not included?
+                if (not match('.hgsub') and
+                    '.hgsub' in (wctx.modified() + wctx.added())):
+                    raise util.Abort("can't commit subrepos without .hgsub")
+                if '.hgsubstate' not in changes[0]:
+                    changes[0].insert(0, '.hgsubstate')
 
             # make sure all explicit patterns are matched
             if not force and match.files():