From 1ac1877a3fb03daa282526273cbcc845faf8e6c5 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 25 Apr 2012 16:41:46 +0100 Subject: Fix update-gits to update repos of submodules, too --- morph | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) (limited to 'morph') diff --git a/morph b/morph index d9f1866d..777dd75f 100755 --- a/morph +++ b/morph @@ -386,10 +386,40 @@ class Morph(cliapp.Application): cache = morphlib.localrepocache.LocalRepoCache( cachedir, baseurls, bundle_base_url) - def do_print(reponame, ref, filename, absref, morphology): + subs_to_process = set() + + def visit(reponame, ref, filename, absref, morphology): self.msg('Updating %s|%s|%s' % (reponame, ref, filename)) + assert cache.has_repo(reponame) + cached_repo = cache.get_repo(reponame) + try: + submodules = morphlib.git.Submodules(cached_repo.path, ref) + submodules.load() + except morphlib.git.NoModulesFileError: + pass + else: + for submod in submodules: + subs_to_process.add((submod.url, submod.commit)) + self._traverse_morphs(self._itertriplets(args), cache, None, - update=True, visit=do_print) + update=True, visit=visit) + + done = set() + while subs_to_process: + url, ref = subs_to_process.pop() + done.add((url, ref)) + cached_repo = cache.cache_repo(url) + cached_repo.update() + + try: + submodules = morphlib.git.Submodules(cached_repo.path, ref) + submodules.load() + except morphlib.git.NoModulesFileError: + pass + else: + for submod in submodules: + if (submod.url, submod.commit) not in done: + subs_to_process.add((submod.url, submod.commit)) def cmd_build_single(self, args): '''Build a binary from a morphology but do not build its dependencies. -- cgit v1.2.1