diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2015-11-15 18:14:42 +0000 |
---|---|---|
committer | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2015-11-15 18:19:18 +0000 |
commit | bdd4c34700f0be5f1739e5dba88ff09b2058be03 (patch) | |
tree | 98af3466343a95c278d6941bc1151de03d9215ee | |
parent | 53b5ffa1dfcbb6a0be8e74f5c24ce221f31fcb8d (diff) | |
download | morph-bdd4c34700f0be5f1739e5dba88ff09b2058be03.tar.gz |
Make morph much more faster
Change-Id: Idf4b3182269c7158eb3499446dcfdfc88be08258
-rw-r--r-- | morphlib/buildbranch.py | 59 | ||||
-rw-r--r-- | morphlib/gitindex.py | 3 |
2 files changed, 3 insertions, 59 deletions
diff --git a/morphlib/buildbranch.py b/morphlib/buildbranch.py index c1d15874..d0e7eb8f 100644 --- a/morphlib/buildbranch.py +++ b/morphlib/buildbranch.py @@ -171,55 +171,6 @@ class BuildBranch(object): else: return self._root.load_all_morphologies() - def inject_build_refs(self, use_local_repos, inject_cb=lambda **kwargs: - None): - '''Update system and stratum morphologies to point to our branch. - - For all edited repositories, this alter the temporary GitIndex - of the morphs repositories to point their temporary build branch - versions. - - ''' - root_repo = self._root.remote_url - root_ref = self._root.HEAD - morphs = morphlib.morphset.MorphologySet() - - for morph in self.load_all_morphologies(): - morphs.add_morphology(morph) - - sb_info = {} - for gd, (build_ref, index) in self._to_push.iteritems(): - if gd == self._root: - repo, ref = root_repo, root_ref - else: - # This branch can only run if we are in a Morph system branch - # checkout, because only there will we consider chunk repos. - repo, ref = gd.get_config('morph.repository'), gd.HEAD - sb_info[repo, ref] = (gd, build_ref) - - def filter(m, kind, spec): - return (spec.get('repo'), spec.get('ref')) in sb_info - def process(m, kind, spec): - repo, ref = spec['repo'], spec['ref'] - gd, build_ref = sb_info[repo, ref] - if (repo, ref) == (root_repo, root_ref): - spec['repo'] = None - spec['ref'] = None - return True - if use_local_repos: - spec['repo'] = urlparse.urljoin('file://', gd.dirname) - spec['ref'] = build_ref - return True - - morphs.traverse_specs(process, filter) - - if any(m.dirty for m in morphs.morphologies): - inject_cb(gd=self._root) - - # TODO: Prevent it hashing unchanged morphologies, while still - # hashing uncommitted ones. - self._root_index.add_files_from_index_info( - self._hash_morphologies(self._root, morphs.morphologies)) def update_build_refs(self, name, email, uuid, commit_cb=lambda **kwargs: None): @@ -233,8 +184,7 @@ class BuildBranch(object): the repositories in the SystemBranch with: 1. The tree of anything currently in the temporary GitIndex. This is the same as the current commit on HEAD unless - `add_uncommitted_changes` or `inject_build_refs` have - been called. + `add_uncommitted_changes` have been called. 2. the parent of the previous temporary commit, or the last commit of the working tree if there has been no previous commits @@ -384,13 +334,6 @@ def pushed_build_branch(bb, changes_need_pushing, name, email, yield bb.root_repo_url, bb.root_commit, bb.root_ref return - def report_inject(gd): - status(msg='Injecting temporary build refs '\ - 'into morphologies in %(dirname)s', - dirname=gd.dirname, chatty=True) - bb.inject_build_refs(use_local_repos=not changes_need_pushing, - inject_cb=report_inject) - def report_commit(gd, build_ref): status(msg='Committing changes in %(dirname)s '\ 'to %(ref)s', diff --git a/morphlib/gitindex.py b/morphlib/gitindex.py index 00098fbf..9b3ef0a1 100644 --- a/morphlib/gitindex.py +++ b/morphlib/gitindex.py @@ -82,7 +82,8 @@ class GitIndex(object): # a space, then the path. # If our status code starts with R then it's a rename, hence # has a second path, requiring us to pop an extra token. - status = self._run_git('status', '-z', '--ignored') + status = self._run_git('status', '-z', '--ignored', + '--untracked-files') tokens = collections.deque(status.split('\0')) while True: tok = tokens.popleft() |