diff options
author | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2013-07-03 17:11:49 +0100 |
---|---|---|
committer | Jonathan Maw <jonathan.maw@codethink.co.uk> | 2013-07-03 17:11:49 +0100 |
commit | 4a73748a4f9e11e915388068557c30529a536178 (patch) | |
tree | ac75663fb3ef150a5654bf9187ce926e62bf1c8b | |
parent | 1a844fbe81587e4ac1a4d58544cedbf94a666245 (diff) | |
parent | 7bb378c0d806b122faaefb08877abbda8dc4762d (diff) | |
download | definitions-4a73748a4f9e11e915388068557c30529a536178.tar.gz |
Merge branch 'jonathan/fix-petrify-2'
Reviewed-by: Richard Maw <richard.maw@codethink.co.uk>
-rw-r--r-- | morphlib/plugins/branch_and_merge_plugin.py | 51 | ||||
-rwxr-xr-x | tests.as-root/unimportant-morphology-contents-do-not-change-cache-keys.script | 2 | ||||
-rwxr-xr-x | tests.branching.disabled/workflow-petrify.script (renamed from tests.branching/workflow-petrify.script) | 0 | ||||
-rw-r--r-- | tests.branching.disabled/workflow-petrify.stdout (renamed from tests.branching/workflow-petrify.stdout) | 0 | ||||
-rwxr-xr-x | tests.branching/petrify-no-double-petrify.script | 1 | ||||
-rwxr-xr-x | tests.branching/petrify.script | 2 | ||||
-rw-r--r-- | tests.branching/petrify.stdout | 5 |
7 files changed, 10 insertions, 51 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py index f7109bcf..230367fb 100644 --- a/morphlib/plugins/branch_and_merge_plugin.py +++ b/morphlib/plugins/branch_and_merge_plugin.py @@ -925,60 +925,13 @@ class BranchAndMergePlugin(cliapp.Plugin): if len(args) != 0: raise cliapp.AppException('morph petrify takes no arguments') - workspace = self.deduce_workspace() branch, branch_path = self.deduce_system_branch() root_repo = self.get_branch_config(branch_path, 'branch.root') root_repo_dir = self.find_repository(branch_path, root_repo) self.lrc, self.rrc = morphlib.util.new_repo_caches(self.app) - # We must first get the full set of strata. One same stratum may be - # in multiple systems and each system may use a different ref. - strata = {} - for f in sorted(glob.iglob(os.path.join(root_repo_dir, '*.morph'))): - name = os.path.basename(f)[:-len('.morph')] - morphology = self.load_morphology(root_repo_dir, name) - if morphology['kind'] != 'system': - continue - - for stratum_info in morphology['strata']: - key = (stratum_info['repo'], stratum_info['morph']) - if key in strata: - original_ref = strata[key] - if stratum_info['ref'] == branch: - strata[key] = branch - elif stratum_info['ref'] != original_ref: - if original_ref != branch: - self.app.output.write( - 'WARNING: not merging any differences from ' - 'ref %s into %s of stratum %s\n' % - (stratum_info['ref'], original_ref, - stratum_info['morph'])) - stratum_info['ref'] = branch - else: - strata[key] = stratum_info['ref'] - stratum_info['ref'] = branch - self.update_morphology(root_repo_dir, name, morphology) - - for (repo, morph), ref in strata.iteritems(): - repo_dir = self.make_available( - { 'repo': repo, 'ref': ref, 'morph': morph}, - branch, branch_path, root_repo, root_repo_dir) - - stratum = self.load_morphology(repo_dir, morph) - - for chunk_info in stratum['chunks']: - if (chunk_info['ref'] != branch and - 'unpetrify-ref' not in chunk_info): - commit_sha1, tree_sha1 = self.app.resolve_ref( - self.lrc, self.rrc, chunk_info['repo'], - chunk_info['ref'], - update=not self.app.settings['no-git-update']) - chunk_info['unpetrify-ref'] = chunk_info['ref'] - chunk_info['ref'] = commit_sha1 - self.update_morphology(repo_dir, morph, stratum) - - self.print_changelog('The following changes were made but have not ' - 'been committed') + self.petrify_everything(branch, branch_path, root_repo, root_repo_dir, + branch, os.environ, None, True) def unpetrify(self, args): '''Reverse the process of petrification''' diff --git a/tests.as-root/unimportant-morphology-contents-do-not-change-cache-keys.script b/tests.as-root/unimportant-morphology-contents-do-not-change-cache-keys.script index 44b261d2..f4f33f21 100755 --- a/tests.as-root/unimportant-morphology-contents-do-not-change-cache-keys.script +++ b/tests.as-root/unimportant-morphology-contents-do-not-change-cache-keys.script @@ -31,6 +31,8 @@ cd "$DATADIR/workspace" ARTIFACT_COUNT="$(ls "$DATADIR/cache/artifacts" | wc -l)" # Petrify the refs, so the morphologies will be different +(set -e && cd branch1/test:morphs && git push --quiet origin HEAD) +(set -e && cd branch1/test:kernel-repo && git push --quiet origin HEAD) "$SRCDIR/scripts/test-morph" petrify # Build with the petrified morphologies. diff --git a/tests.branching/workflow-petrify.script b/tests.branching.disabled/workflow-petrify.script index 79279340..79279340 100755 --- a/tests.branching/workflow-petrify.script +++ b/tests.branching.disabled/workflow-petrify.script diff --git a/tests.branching/workflow-petrify.stdout b/tests.branching.disabled/workflow-petrify.stdout index 9f0cfb0c..9f0cfb0c 100644 --- a/tests.branching/workflow-petrify.stdout +++ b/tests.branching.disabled/workflow-petrify.stdout diff --git a/tests.branching/petrify-no-double-petrify.script b/tests.branching/petrify-no-double-petrify.script index c263e590..9484aa58 100755 --- a/tests.branching/petrify-no-double-petrify.script +++ b/tests.branching/petrify-no-double-petrify.script @@ -26,6 +26,7 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch test:morphs test/petrify cd test/petrify/test:morphs +git push --quiet origin HEAD "$SRCDIR/scripts/test-morph" petrify "$SRCDIR/scripts/test-morph" petrify "$SRCDIR/scripts/test-morph" petrify diff --git a/tests.branching/petrify.script b/tests.branching/petrify.script index 76c906c3..fed8e965 100755 --- a/tests.branching/petrify.script +++ b/tests.branching/petrify.script @@ -28,7 +28,9 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch test:morphs test/petrify master cd test/petrify/test:morphs +git push --quiet origin HEAD "$SRCDIR/scripts/test-morph" edit hello-system hello-stratum goodbye +(cd ../test:goodbye && git push --quiet origin HEAD) "$SRCDIR/scripts/test-morph" petrify echo "Petrified:" diff --git a/tests.branching/petrify.stdout b/tests.branching/petrify.stdout index d2126831..acc08f68 100644 --- a/tests.branching/petrify.stdout +++ b/tests.branching/petrify.stdout @@ -13,8 +13,9 @@ Petrified: { "name": "goodbye", "repo": "test:goodbye", - "ref": "test/petrify", - "build-depends": [] + "ref": "f4730636e429149bb923fa16be3aa9802d484b23", + "build-depends": [], + "unpetrify-ref": "test/petrify" } ] } |