[issue2232] committing without .hgsub shouldn't process subrepos

Dirkjan Ochtman bugs at mercurial.selenic.com
Fri Jun 11 08:21:09 UTC 2010


New submission from Dirkjan Ochtman <dirkjan at ochtman.nl>:

This shouldn't happen:

watt at darwin kepler $ hg add .hgsub
watt at darwin kepler $ hg st
M blah.py
A .hgsub
? foo.py
watt at darwin kepler $ hg ci -m "Remove web/assets from repository." web/assets/
committing subrepository web/assets

Attempt at a patch:

diff -r 0bb14798cd07 mercurial/localrepo.py
--- a/mercurial/localrepo.py    Wed Jun 09 17:27:47 2010 +0200
+++ b/mercurial/localrepo.py    Fri Jun 11 10:18:14 2010 +0200
@@ -820,14 +820,15 @@
             # check subrepos
             subs = []
             removedsubs = set()
-            for p in wctx.parents():
-                removedsubs.update(s for s in p.substate if match(s))
-            for s in wctx.substate:
-                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 match('.hgsub'):
+                for p in wctx.parents():
+                    removedsubs.update(s for s in p.substate if match(s))
+                for s in wctx.substate:
+                    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')

             # make sure all explicit patterns are matched
             if not force and match.files():

This does not seem good enough, and I don't know enough about subrepos.

----------
messages: 12807
nosy: djc
priority: bug
status: unread
title: committing without .hgsub shouldn't process subrepos

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue2232>
____________________________________________________


More information about the Mercurial-devel mailing list