From 21e00e2a8acdeb5a67fb3d1eded28a4a0bcbd94a Mon Sep 17 00:00:00 2001 From: Paul Sherwood Date: Sun, 8 Jun 2014 11:53:09 +0000 Subject: Fix tests for new `morph edit` syntax --- tests.as-root/build-with-external-strata.script | 1 - tests.branching.disabled/workflow-petrify.script | 4 ++-- tests.branching/add-then-edit.script | 5 +---- tests.branching/edit-checkouts-existing-chunk.script | 2 +- tests.branching/edit-clones-chunk.script | 4 ++-- tests.branching/edit-handles-submodules.script | 2 +- tests.branching/edit-updates-stratum.script | 2 +- .../edit-works-after-branch-root-was-renamed.script | 4 ++-- tests.branching/foreach-handles-command-failure.script | 4 ++-- .../morph-repository-stored-in-cloned-repositories.script | 2 +- tests.branching/petrify.script | 2 +- tests.branching/status-in-dirty-branch.script | 2 +- tests.branching/workflow-separate-stratum-repos.script | 4 ++-- tests.branching/workflow.script | 2 +- tests.merging/basic.script | 4 ++-- tests.merging/conflict-chunks.script | 8 +++----- tests.merging/conflict-morphology-kind.script | 3 +-- tests.merging/conflict-stratum-field-ordering.script | 4 +--- tests.merging/move-chunk-repo.script | 6 +++--- tests.merging/rename-chunk.script | 4 ++-- tests.merging/rename-stratum.script | 11 +---------- yarns/branches-workspaces.yarn | 13 +------------ yarns/implementations.yarn | 10 +--------- 23 files changed, 33 insertions(+), 70 deletions(-) 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.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 < "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 < "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. -- cgit v1.2.1