Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 8813:db3c1ab0e632
commit: recurse into subrepositories
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 15 Jun 2009 02:45:38 -0500 |
parents | 87d1fd40f57e |
children | 9db1c8e1cf17 105343f9f744 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Mon Jun 15 02:45:38 2009 -0500 +++ b/mercurial/localrepo.py Mon Jun 15 02:45:38 2009 -0500 @@ -7,7 +7,7 @@ from node import bin, hex, nullid, nullrev, short from i18n import _ -import repo, changegroup +import repo, changegroup, subrepo import changelog, dirstate, filelog, manifest, context import lock, transaction, store, encoding import util, extensions, hook, error @@ -807,6 +807,7 @@ wlock = self.wlock() try: p1, p2 = self.dirstate.parents() + wctx = self[None] if (not force and p2 != nullid and match and (match.files() or match.anypats())): @@ -817,12 +818,20 @@ if force: changes[0].extend(changes[6]) # mq may commit unchanged files + # check subrepos + subs = [] + for s in wctx.substate: + if match(s) and wctx.sub(s).dirty(): + subs.append(s) + if subs and '.hgsubstate' not in changes[0]: + changes[0].insert(0, '.hgsubstate') + # make sure all explicit patterns are matched if not force and match.files(): matched = set(changes[0] + changes[1] + changes[2]) for f in match.files(): - if f == '.' or f in matched: # matched + if f == '.' or f in matched or f in wctx.substate: continue if f in changes[3]: # missing fail(f, _('file not found!')) @@ -852,6 +861,16 @@ extra, changes) if editor: cctx._text = editor(self, cctx) + + # commit subs + if subs: + state = wctx.substate.copy() + for s in subs: + self.ui.status(_('committing subrepository %s\n') % s) + sr = wctx.sub(s).commit(cctx._text, user, date) + state[s] = (state[s][0], sr) + subrepo.writestate(self, state) + ret = self.commitctx(cctx, True) # update dirstate and mergestate