diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-06-09 14:00:26 +0000 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-06-09 14:00:26 +0000 |
commit | b6f37209fc277883c983b1602d3a98b4045f6dee (patch) | |
tree | 7e502b0a9abe2c736b9f8260a8e984fc91e20539 | |
parent | e88455c62914ed70b439b37c2ba64a446cb295c3 (diff) | |
parent | 051ed7f0753ac292964019bb00929380f98b2191 (diff) | |
download | morph-b6f37209fc277883c983b1602d3a98b4045f6dee.tar.gz |
Merge branch 'baserock/ps/simple-edit-syntax'
Reviewed-By: Adam Coldrick <adam.coldrick@codethink.co.uk>
Reviewed-By: Richard Ipsum <richard.ipsum@codethink.co.uk>
Reviewed-By: Richard Maw <richard.maw@codethink.co.uk>
Reviewed-By: Sam Thursfield <sam.thursfield@codethink.co.uk>
25 files changed, 82 insertions, 179 deletions
diff --git a/morphlib/plugins/branch_and_merge_new_plugin.py b/morphlib/plugins/branch_and_merge_new_plugin.py index 51cba401..5ac8353a 100644 --- a/morphlib/plugins/branch_and_merge_new_plugin.py +++ b/morphlib/plugins/branch_and_merge_new_plugin.py @@ -363,124 +363,32 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): Command line arguments: - * `SYSTEM` is the name of a system morphology in the root repository - of the current system branch. - * `STRATUM` is the name of a stratum inside the system. - * `CHUNK` is the name of a chunk inside the stratum. + * `CHUNK` is the name of a chunk - This marks the specified stratum or chunk (if given) as being - changed within the system branch, by creating the git branches in - the affected repositories, and changing the relevant morphologies - to point at those branches. It also creates a local clone of - the git repository of the stratum or chunk. - - For example: - - morph edit devel-system-x86-64-generic devel - - The above command will mark the `devel` stratum as being - modified in the current system branch. In this case, the stratum's - morphology is in the same git repository as the system morphology, - so there is no need to create a new git branch. However, the - system morphology is modified to point at the stratum morphology - in the same git branch, rather than the original branch. - - In other words, where the system morphology used to say this: - - morph: devel - repo: baserock:baserock/morphs - ref: master - - The updated system morphology will now say this instead: - - morph: devel - repo: baserock:baserock/morphs - ref: jrandom/new-feature - - (Assuming the system branch is called `jrandom/new-feature`.) - - Another example: - - morph edit devel-system-x86_64-generic devel gcc - - The above command will mark the `gcc` chunk as being edited in - the current system branch. Morph will clone the `gcc` repository - locally, into the current workspace, and create a new (local) - branch named after the system branch. It will also change the - stratum morphology to refer to the new git branch, instead of - whatever branch it was referring to originally. - - If the `gcc` repository already had a git branch named after - the system branch, that is reused. Similarly, if the stratum - morphology was already pointing that that branch, it doesn't - need to be changed again. In that case, the only action Morph - does is to clone the chunk repository locally, and if that was - also done already, Morph does nothing. + This makes a local checkout of CHUNK in the current system branch + and edits any stratum morphology file(s) containing the chunk ''' - if len(args) not in (2, 3): - raise cliapp.AppException('morph edit needs the names of a system,' - ' a stratum and optionally a chunk' - ' as parameters') - - system_name = morphlib.util.strip_morph_extension(args[0]) - stratum_name = morphlib.util.strip_morph_extension(args[1]) - chunk_name = None - if len(args) == 3: - chunk_name = morphlib.util.strip_morph_extension(args[2]) + if len(args) != 1: + raise cliapp.AppException('morph edit needs a chunk ' + 'as parameter') ws = morphlib.workspace.open('.') sb = morphlib.sysbranchdir.open_from_within('.') loader = morphlib.morphloader.MorphologyLoader() + morphs = self._load_all_sysbranch_morphologies(sb, loader) - # Load the system morphology, and all stratum morphologies, including - # all the strata that are being build-depended on. - - logging.debug('Loading system morphology') - system_morph = loader.load_from_file( - sb.get_filename(sb.root_repository_url, system_name + '.morph')) - if system_morph['kind'] != 'system': - raise cliapp.AppException("%s is not a system" % system_name) - system_morph.repo_url = sb.root_repository_url - system_morph.ref = sb.system_branch_name - system_morph.filename = system_name + '.morph' - - logging.debug('Loading stratum morphologies') - morphs = self._load_stratum_morphologies(loader, sb, system_morph) - morphs.add_morphology(system_morph) - logging.debug('morphs: %s' % repr(morphs.morphologies)) - - # Change refs to the stratum to be to the system branch. - # Note: this currently only supports strata in root repository. - - logging.debug('Changing refs to stratum %s' % stratum_name) - stratum_morph = morphs.get_stratum_in_system( - system_morph, stratum_name) - morphs.change_ref( - stratum_morph.repo_url, stratum_morph.ref, stratum_morph.filename, - sb.system_branch_name) - logging.debug('morphs: %s' % repr(morphs.morphologies)) - - # If we're editing a chunk, make it available locally, with the - # relevant git branch checked out. This also invents the new branch - # name. - - if chunk_name: - logging.debug('Editing chunk %s' % chunk_name) - - chunk_url, chunk_ref, chunk_morph = morphs.get_chunk_triplet( - stratum_morph, chunk_name) + def edit_chunk(morph, chunk_name): + chunk_url, chunk_ref, chunk_morph = ( + morphs.get_chunk_triplet(morph, chunk_name)) chunk_dirname = sb.get_git_directory_name(chunk_url) + if not os.path.exists(chunk_dirname): lrc, rrc = morphlib.util.new_repo_caches(self.app) cached_repo = lrc.get_updated_repo(chunk_url) - # FIXME: This makes the simplifying assumption that - # a chunk branch must have the same name as the system - # branch. - gd = sb.clone_cached_repo(cached_repo, chunk_ref) if chunk_ref != sb.system_branch_name: gd.branch(sb.system_branch_name, chunk_ref) @@ -491,16 +399,48 @@ class SimpleBranchAndMergePlugin(cliapp.Plugin): gd.fat_init() gd.fat_pull() - # Change the refs to the chunk. - if chunk_ref != sb.system_branch_name: - morphs.change_ref( - chunk_url, chunk_ref, chunk_morph + '.morph', - sb.system_branch_name) + # Change the refs to the chunk. + if chunk_ref != sb.system_branch_name: + morphs.change_ref( + chunk_url, chunk_ref, chunk_morph + '.morph', + sb.system_branch_name) + + return chunk_dirname + + chunk_name = morphlib.util.strip_morph_extension(args[0]) + dirs = set() + found = 0 + + for morph in morphs.morphologies: + if morph['kind'] == 'stratum': + for chunk in morph['chunks']: + if chunk['name'] == chunk_name: + self.app.status( + msg='Editing %(chunk)s in %(stratum)s stratum', + chunk=chunk_name, stratum=morph['name']) + chunk_dirname = edit_chunk(morph, chunk_name) + dirs.add(chunk_dirname) + found = found + 1 # Save any modified strata. self._save_dirty_morphologies(loader, sb, morphs.morphologies) + if found == 0: + self.app.status( + msg="No chunk %(chunk)s found. If you want to create one, add " + "an entry to a stratum morph file.", chunk=chunk_name) + + if found >= 1: + dirs_list = ', '.join(sorted(dirs)) + self.app.status( + msg="Chunk %(chunk)s source is available at %(dirs)s", + chunk=chunk_name, dirs=dirs_list) + + if found > 1: + self.app.status( + msg="Notice that this chunk appears in more than one stratum") + def show_system_branch(self, args): '''Show the name of the current system branch.''' diff --git a/tests.as-root/build-with-external-strata.script b/tests.as-root/build-with-external-strata.script index e43d0262..be870053 100755 --- a/tests.as-root/build-with-external-strata.script +++ b/tests.as-root/build-with-external-strata.script @@ -34,7 +34,6 @@ cd "$DATADIR/workspace" # don't commit it, in one of the external strata, as a challenge for # 'morph build'. cd "branch1" -"$SRCDIR/scripts/test-morph" edit hello-system stratum2 cd "test/external-strata" awk ' diff --git a/tests.branching.disabled/workflow-petrify.script b/tests.branching.disabled/workflow-petrify.script index 79279340..3c561d5b 100755 --- a/tests.branching.disabled/workflow-petrify.script +++ b/tests.branching.disabled/workflow-petrify.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ cat test:morphs/hello-system.morph cat test:external-strata/stratum2.morph cat test:external-strata/stratum3.morph -"$SRCDIR/scripts/test-morph" edit hello-system stratum2 hello +"$SRCDIR/scripts/test-morph" edit hello echo echo "test/petrify after editing a chunk:" diff --git a/tests.branching/add-then-edit.script b/tests.branching/add-then-edit.script index 2dd62254..be3315d9 100755 --- a/tests.branching/add-then-edit.script +++ b/tests.branching/add-then-edit.script @@ -29,9 +29,6 @@ cd "me/add-then-edit" # add a chunk cd test/morphs -## Sub-optimally, to alter the stratum, you have to `morph edit` it first -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum - python -c 'import yaml with open("hello-stratum.morph", "r") as f: stratum = yaml.load(f) @@ -45,7 +42,7 @@ with open("hello-stratum.morph", "w") as f: yaml.dump(stratum, f) ' -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum goodbye +"$SRCDIR/scripts/test-morph" edit goodbye # check whether the stratum still contains the goodbye chunk grep -qFe goodbye hello-stratum.morph diff --git a/tests.branching/edit-checkouts-existing-chunk.script b/tests.branching/edit-checkouts-existing-chunk.script index c8fb9312..df2a7d85 100755 --- a/tests.branching/edit-checkouts-existing-chunk.script +++ b/tests.branching/edit-checkouts-existing-chunk.script @@ -27,7 +27,7 @@ cd "$DATADIR/workspace" # Edit the hello chunk in alfred. cd "alfred" -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello echo "Current branches:" "$SRCDIR/scripts/test-morph" foreach git branch diff --git a/tests.branching/edit-clones-chunk.script b/tests.branching/edit-clones-chunk.script index d3324078..a6313ca6 100755 --- a/tests.branching/edit-clones-chunk.script +++ b/tests.branching/edit-clones-chunk.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch test:morphs newbranch # Edit chunk. -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello echo "Current branches:" "$SRCDIR/scripts/test-morph" foreach git branch diff --git a/tests.branching/edit-handles-submodules.script b/tests.branching/edit-handles-submodules.script index 2ab39420..09592f74 100755 --- a/tests.branching/edit-handles-submodules.script +++ b/tests.branching/edit-handles-submodules.script @@ -26,7 +26,7 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch test:morphs newbranch # Submodules should be set up automatically -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello cd "$DATADIR/workspace/newbranch/test/hello" [ -e foolib/README ] diff --git a/tests.branching/edit-updates-stratum.script b/tests.branching/edit-updates-stratum.script index cf5fc26d..b60c46e7 100755 --- a/tests.branching/edit-updates-stratum.script +++ b/tests.branching/edit-updates-stratum.script @@ -26,7 +26,7 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch test:morphs newbranch # Edit chunk. -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello # See what effect the editing had. "$SRCDIR/scripts/run-git-in" "newbranch/test/morphs" diff diff --git a/tests.branching/edit-works-after-branch-root-was-renamed.script b/tests.branching/edit-works-after-branch-root-was-renamed.script index c7043e27..e28ab7df 100755 --- a/tests.branching/edit-works-after-branch-root-was-renamed.script +++ b/tests.branching/edit-works-after-branch-root-was-renamed.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ cd "$DATADIR/workspace" cd "$DATADIR/workspace/master" mv test:morphs my-renamed-morphs -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello "$SRCDIR/scripts/list-tree" "$DATADIR/workspace" | grep -v '/\.git/' | sed 's,/cache/gits/file_[^/]*_,/cache/gits/file_,' | diff --git a/tests.branching/foreach-handles-command-failure.script b/tests.branching/foreach-handles-command-failure.script index eea381c8..4bc71c78 100755 --- a/tests.branching/foreach-handles-command-failure.script +++ b/tests.branching/foreach-handles-command-failure.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,6 +23,6 @@ set -eu cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" checkout test:morphs master -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello "$SRCDIR/scripts/test-morph" foreach git remote update non-existant-remote diff --git a/tests.branching/morph-repository-stored-in-cloned-repositories.script b/tests.branching/morph-repository-stored-in-cloned-repositories.script index 342c3d0b..f60b16ae 100755 --- a/tests.branching/morph-repository-stored-in-cloned-repositories.script +++ b/tests.branching/morph-repository-stored-in-cloned-repositories.script @@ -42,7 +42,7 @@ git config morph.repository echo cd "$DATADIR/workspace/master" -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello echo "morph.repository of an edited repository:" cd "$DATADIR/workspace/master/test/hello" diff --git a/tests.branching/petrify.script b/tests.branching/petrify.script index 5a3cb8c4..f8e7c1e9 100755 --- a/tests.branching/petrify.script +++ b/tests.branching/petrify.script @@ -29,7 +29,7 @@ cd "$DATADIR/workspace" cd test/petrify/test/morphs git push --quiet origin HEAD -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum goodbye +"$SRCDIR/scripts/test-morph" edit goodbye (cd ../goodbye && git push --quiet origin HEAD) "$SRCDIR/scripts/test-morph" petrify diff --git a/tests.branching/status-in-dirty-branch.script b/tests.branching/status-in-dirty-branch.script index 7fdd8862..37fca97b 100755 --- a/tests.branching/status-in-dirty-branch.script +++ b/tests.branching/status-in-dirty-branch.script @@ -35,7 +35,7 @@ cd "$DATADIR/workspace" # Make the branch have some interesting changes and pitfalls cd branch1 -"$SRCDIR/scripts/test-morph" edit hello-system stratum2 hello +"$SRCDIR/scripts/test-morph" edit hello cd test/stratum2-hello git checkout -q master diff --git a/tests.branching/workflow-separate-stratum-repos.script b/tests.branching/workflow-separate-stratum-repos.script index f2fd519b..1d8cc1e5 100755 --- a/tests.branching/workflow-separate-stratum-repos.script +++ b/tests.branching/workflow-separate-stratum-repos.script @@ -34,14 +34,14 @@ cd "$DATADIR/workspace" # Edit one chunk cd "me/readme-fixes" -"$SRCDIR/scripts/test-morph" edit hello-system stratum2 hello +"$SRCDIR/scripts/test-morph" edit hello cd "$DATADIR/workspace/me/readme-fixes/test/stratum2-hello" echo > README yoyoyo git add README git commit -m "Fix README in hello" --quiet # Edit the other chunk too -"$SRCDIR/scripts/test-morph" edit hello-system stratum3 hello +"$SRCDIR/scripts/test-morph" edit hello cd "$DATADIR/workspace/me/readme-fixes/test/stratum3-hello" echo > README yoyoyo git add README diff --git a/tests.branching/workflow.script b/tests.branching/workflow.script index 51a8d106..f84489db 100755 --- a/tests.branching/workflow.script +++ b/tests.branching/workflow.script @@ -23,7 +23,7 @@ set -eu cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch test:morphs me/readme-fix -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello cd me/readme-fix/test/hello echo > README yoyoyo git add README diff --git a/tests.deploy/setup-build b/tests.deploy/setup-build index 0fc561f9..c6b24da5 100644 --- a/tests.deploy/setup-build +++ b/tests.deploy/setup-build @@ -23,7 +23,7 @@ source "$SRCDIR/scripts/fix-committer-info" cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch test:morphs branch1 -"$SRCDIR/scripts/test-morph" edit linux-system linux-stratum linux +"$SRCDIR/scripts/test-morph" edit linux # Fix UUID's in the checked out repos to make build branch names deterministic git config -f "$DATADIR/workspace/branch1/.morph-system-branch/config" \ diff --git a/tests.merging/basic.script b/tests.merging/basic.script index 6d01ba16..5a1c1842 100755 --- a/tests.merging/basic.script +++ b/tests.merging/basic.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ git push --quiet origin test/stable cd "$DATADIR/workspace/test/feature" # Edit hello in FROM -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello cd test:hello touch newfile.txt git add newfile.txt diff --git a/tests.merging/conflict-chunks.script b/tests.merging/conflict-chunks.script index 5a0c5f52..b0d118ee 100755 --- a/tests.merging/conflict-chunks.script +++ b/tests.merging/conflict-chunks.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -44,14 +44,12 @@ add_text_in_repo() { # Sow the seeds of conflict cd "$DATADIR/workspace/test/stable" -"$SRCDIR/scripts/test-morph" edit hello-system stratum2 hello -"$SRCDIR/scripts/test-morph" edit hello-system stratum3 hello +"$SRCDIR/scripts/test-morph" edit hello add_text_in_repo "test:stratum2-hello" "xyzzy" add_text_in_repo "test:stratum3-hello" "xyzzy" cd "$DATADIR/workspace/test/feature" -"$SRCDIR/scripts/test-morph" edit hello-system stratum2 hello -"$SRCDIR/scripts/test-morph" edit hello-system stratum3 hello +"$SRCDIR/scripts/test-morph" edit hello add_text_in_repo "test:stratum2-hello" "plugh" add_text_in_repo "test:stratum3-hello" "plover" diff --git a/tests.merging/conflict-morphology-kind.script b/tests.merging/conflict-morphology-kind.script index ca8403b8..cd2a24f5 100755 --- a/tests.merging/conflict-morphology-kind.script +++ b/tests.merging/conflict-morphology-kind.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,7 +25,6 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch test:morphs test/unmergable cd "$DATADIR/workspace/test/unmergable/test:morphs" -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum sed -ie 's/"kind": "stratum"/"kind": "chunk"/' hello-stratum.morph git commit --quiet --all -m "Unmergeable because kind has changed" diff --git a/tests.merging/conflict-stratum-field-ordering.script b/tests.merging/conflict-stratum-field-ordering.script index c96c59ab..b83358bf 100755 --- a/tests.merging/conflict-stratum-field-ordering.script +++ b/tests.merging/conflict-stratum-field-ordering.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -41,7 +41,6 @@ git push --quiet origin test/stable # Make a change in TO cd "$DATADIR/workspace/test/stable" -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum cd test:morphs cat <<EOF > "hello-stratum.morph" { @@ -69,7 +68,6 @@ git commit --quiet --all -m "Split up 'hello' chunk into runtime and devel" # Make a change in FROM that isn't very mergable cd "$DATADIR/workspace/test/feature" -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum cd test:morphs cat <<EOF > "hello-stratum.morph" { diff --git a/tests.merging/move-chunk-repo.script b/tests.merging/move-chunk-repo.script index 3a00015b..405e6c88 100755 --- a/tests.merging/move-chunk-repo.script +++ b/tests.merging/move-chunk-repo.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,7 +26,7 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch test:morphs baserock/newbranch -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello # Chunk moves to a new location (we manually update the ref back to master # here, so 'morph edit' can create a system branch in the new repo from it). @@ -38,7 +38,7 @@ sed -e 's/"repo": "test:hello"/"repo": "test:hello-lorried"/' \ git commit -q --all -m "'hello' repository has moved" # Now we further edit the chunk, just for fun. -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello cd "$DATADIR/workspace/baserock/newbranch/test:hello-lorried" touch newfile.txt git add newfile.txt diff --git a/tests.merging/rename-chunk.script b/tests.merging/rename-chunk.script index 8c323798..ac63cdd7 100755 --- a/tests.merging/rename-chunk.script +++ b/tests.merging/rename-chunk.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" branch test:morphs baserock/newbranch # Rename the chunk, and then commit a seperate change -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum hello +"$SRCDIR/scripts/test-morph" edit hello cd baserock/newbranch/test:hello cat hello.morph | sed -e 's/"name": "hello"/"name": "goodbye"/' > goodbye.morph diff --git a/tests.merging/rename-stratum.script b/tests.merging/rename-stratum.script index ba759fa3..11c4cb50 100755 --- a/tests.merging/rename-stratum.script +++ b/tests.merging/rename-stratum.script @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (C) 2012-2013 Codethink Limited +# Copyright (C) 2012-2014 Codethink Limited # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,14 +26,8 @@ cd "$DATADIR/workspace" "$SRCDIR/scripts/test-morph" init "$SRCDIR/scripts/test-morph" branch test:morphs baserock/newbranch -# The user may 'morph edit hello-system hello-stratum hello' and commit here: -# we currently silently ignore her changes on merge, because we don't -# associate hello-stratum and goodbye-stratum at all. - # Rename the stratum -"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum cd baserock/newbranch/test:morphs - sed -e 's/"morph": "hello-stratum"/"morph": "goodbye-stratum"/'\ -i hello-system.morph sed -e 's/"name": "hello-stratum"/"name": "goodbye-stratum"/' \ @@ -42,9 +36,6 @@ git rm -q hello-stratum.morph git add goodbye-stratum.morph git commit -q --all -m "Rename hello-stratum to goodbye-stratum" -# The user may 'morph edit hello-system goodbye-stratum hello' and commit -# here, too: same problem. - # Merge changes back to master (this should fail, because we don't support # adding strata inside branches yet). cd "$DATADIR/workspace" diff --git a/yarns/branches-workspaces.yarn b/yarns/branches-workspaces.yarn index a9cfb19b..c542994a 100644 --- a/yarns/branches-workspaces.yarn +++ b/yarns/branches-workspaces.yarn @@ -203,16 +203,6 @@ fields when referring to strata, when it didn't before. AND in branch foo, system test-system refers to test-stratum without repo AND in branch foo, system test-system refers to test-stratum without ref -Morph edit should only work with a system argument. - - SCENARIO morph edit errors when supplied only a stratum and chunk as arguments - GIVEN a workspace - AND a git server - WHEN the user checks out the system branch called master - AND the user edits the chunk test-chunk in the stratum test-stratum with no system specified in branch master - THEN morph failed - AND the edit error message includes the string "is not a system" - Status of system branch checkout -------------------------------- @@ -226,8 +216,7 @@ repositories referenced in the system branch. WHEN the user creates a system branch called foo THEN morph reports no outstanding changes in foo - WHEN the user edits the stratum test-stratum in the system test-system in branch foo - AND the user edits the chunk test-chunk in the stratum test-stratum in the system test-system in branch foo + WHEN the user edits the chunk test-chunk in the stratum test-stratum in the system test-system in branch foo THEN morph reports changes in foo in test:morphs only WHEN creating file foo in test/test-chunk in branch foo diff --git a/yarns/implementations.yarn b/yarns/implementations.yarn index e4f36399..0635af72 100644 --- a/yarns/implementations.yarn +++ b/yarns/implementations.yarn @@ -423,13 +423,9 @@ Editing morphologies with `morph edit`. "$field" name="$MATCH_4" "$MATCH_5"; } 2>&1 | grep -qFe "Object does not contain $MATCH_5" - IMPLEMENTS WHEN the user edits the stratum (\S+) in the system (\S+) in branch (\S+) - cd "$DATADIR/workspace/$MATCH_3/test/morphs" - run_morph edit "$MATCH_2" "$MATCH_1" - IMPLEMENTS WHEN the user edits the chunk (\S+) in the stratum (\S+) in the system (\S+) in branch (\S+) cd "$DATADIR/workspace/$MATCH_4/test/morphs" - run_morph edit "$MATCH_3" "$MATCH_2" "$MATCH_1" + run_morph edit "$MATCH_1" IMPLEMENTS THEN the edited chunk (\S+) has git branch (\S+) ls -l "$DATADIR/workspace/$MATCH_2" @@ -439,10 +435,6 @@ Editing morphologies with `morph edit`. echo "$MATCH_2" > "$DATADIR/git-branch.wanted" diff -u "$DATADIR/git-branch.wanted" "$DATADIR/git-branch.actual" - IMPLEMENTS WHEN the user edits the chunk (\S+) in the stratum (\S+) with no system specified in branch (\S+) - cd "$DATADIR/workspace/$MATCH_3" - attempt_morph edit "$MATCH_2" "$MATCH_1" - To produce buildable morphologies, we need them to be of the same architecture as the machine doing the testing. This uses `morph print-architecture` to get a value appropriate for morph. |