From 35ee3e342b0eb2a3224c2bc11c9455c8b25d8947 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Tue, 22 Jan 2013 12:19:24 +0000 Subject: Rename morph tag tests to follow pattern The pattern is COMMAND-assertion, not morph-COMMAND-assertion. --- .../morph-tag-creates-commit-and-tag.script | 39 ----- .../morph-tag-creates-commit-and-tag.stdout | 59 ------- tests.branching/morph-tag-fails-if-tag-exists.exit | 1 - .../morph-tag-fails-if-tag-exists.script | 33 ---- .../morph-tag-fails-if-tag-exists.stderr | 1 - .../morph-tag-tag-works-as-expected.script | 46 ------ .../morph-tag-tag-works-as-expected.stdout | 62 -------- ...rph-tag-works-with-multiple-morphs-repos.script | 123 --------------- ...rph-tag-works-with-multiple-morphs-repos.stdout | 174 --------------------- tests.branching/tag-creates-commit-and-tag.script | 39 +++++ tests.branching/tag-creates-commit-and-tag.stdout | 59 +++++++ tests.branching/tag-fails-if-tag-exists.exit | 1 + tests.branching/tag-fails-if-tag-exists.script | 33 ++++ tests.branching/tag-fails-if-tag-exists.stderr | 1 + tests.branching/tag-tag-works-as-expected.script | 46 ++++++ tests.branching/tag-tag-works-as-expected.stdout | 62 ++++++++ .../tag-works-with-multiple-morphs-repos.script | 123 +++++++++++++++ .../tag-works-with-multiple-morphs-repos.stdout | 174 +++++++++++++++++++++ 18 files changed, 538 insertions(+), 538 deletions(-) delete mode 100755 tests.branching/morph-tag-creates-commit-and-tag.script delete mode 100644 tests.branching/morph-tag-creates-commit-and-tag.stdout delete mode 100644 tests.branching/morph-tag-fails-if-tag-exists.exit delete mode 100755 tests.branching/morph-tag-fails-if-tag-exists.script delete mode 100644 tests.branching/morph-tag-fails-if-tag-exists.stderr delete mode 100755 tests.branching/morph-tag-tag-works-as-expected.script delete mode 100644 tests.branching/morph-tag-tag-works-as-expected.stdout delete mode 100755 tests.branching/morph-tag-works-with-multiple-morphs-repos.script delete mode 100644 tests.branching/morph-tag-works-with-multiple-morphs-repos.stdout create mode 100755 tests.branching/tag-creates-commit-and-tag.script create mode 100644 tests.branching/tag-creates-commit-and-tag.stdout create mode 100644 tests.branching/tag-fails-if-tag-exists.exit create mode 100755 tests.branching/tag-fails-if-tag-exists.script create mode 100644 tests.branching/tag-fails-if-tag-exists.stderr create mode 100755 tests.branching/tag-tag-works-as-expected.script create mode 100644 tests.branching/tag-tag-works-as-expected.stdout create mode 100755 tests.branching/tag-works-with-multiple-morphs-repos.script create mode 100644 tests.branching/tag-works-with-multiple-morphs-repos.stdout (limited to 'tests.branching') diff --git a/tests.branching/morph-tag-creates-commit-and-tag.script b/tests.branching/morph-tag-creates-commit-and-tag.script deleted file mode 100755 index e66d981f..00000000 --- a/tests.branching/morph-tag-creates-commit-and-tag.script +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -## Check that 'morph tag example-tag' successfully creates a dangling -## commit and an annotated tag pointing to this commit. - -set -eu - -# Make sure the commits always have the same SHA1s. -. "$SRCDIR/scripts/fix-committer-info" - -# Create a workspace and branch. -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" checkout test:morphs master - -# Tag the system branch. -"$SRCDIR/scripts/test-morph" tag example-tag -- -m Message - -# Show the tag itself and its log. This allows to verify a couple of things, -# including that the commit and tag are created, that the commit message is -# set correctly and that all references are petrified. -"$SRCDIR/scripts/test-morph" foreach -- git show example-tag -"$SRCDIR/scripts/test-morph" foreach -- git log --format=fuller example-tag diff --git a/tests.branching/morph-tag-creates-commit-and-tag.stdout b/tests.branching/morph-tag-creates-commit-and-tag.stdout deleted file mode 100644 index 8c36ede3..00000000 --- a/tests.branching/morph-tag-creates-commit-and-tag.stdout +++ /dev/null @@ -1,59 +0,0 @@ -test:morphs -tag example-tag -Tagger: developer -Date: Tue Jul 31 16:51:54 2012 +0000 - -Message - -commit 2f0a16ffe676335e6914f1c6117fc0cbe261eacf -Author: developer -Date: Tue Jul 31 16:51:54 2012 +0000 - - Message - -diff --git a/hello-stratum.morph b/hello-stratum.morph -index 3b7be17..87561c1 100644 ---- a/hello-stratum.morph -+++ b/hello-stratum.morph -@@ -5,8 +5,9 @@ - { - "name": "hello", - "repo": "test:hello", -- "ref": "master", -- "build-depends": [] -+ "ref": "f4d032b42c0134e67bdf19a43fa99072493667d7", -+ "build-depends": [], -+ "unpetrify-ref": "master" - } - ] - } -diff --git a/hello-system.morph b/hello-system.morph -index f3f64b4..d26675d 100644 ---- a/hello-system.morph -+++ b/hello-system.morph -@@ -8,7 +8,8 @@ - { - "morph": "hello-stratum", - "repo": "test:morphs", -- "ref": "master" -+ "ref": "example-tag", -+ "unpetrify-ref": "master" - } - ] - } -test:morphs -commit 2f0a16ffe676335e6914f1c6117fc0cbe261eacf -Author: developer -AuthorDate: Tue Jul 31 16:51:54 2012 +0000 -Commit: developer -CommitDate: Tue Jul 31 16:51:54 2012 +0000 - - Message - -commit 48d38ef3f39857d7dba4ed1ffc51653c6bed4906 -Author: developer -AuthorDate: Tue Jul 31 16:51:54 2012 +0000 -Commit: developer -CommitDate: Tue Jul 31 16:51:54 2012 +0000 - - initial diff --git a/tests.branching/morph-tag-fails-if-tag-exists.exit b/tests.branching/morph-tag-fails-if-tag-exists.exit deleted file mode 100644 index d00491fd..00000000 --- a/tests.branching/morph-tag-fails-if-tag-exists.exit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/tests.branching/morph-tag-fails-if-tag-exists.script b/tests.branching/morph-tag-fails-if-tag-exists.script deleted file mode 100755 index b02f87dc..00000000 --- a/tests.branching/morph-tag-fails-if-tag-exists.script +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -## Check that 'morph tag example-tag' fails if 'example-tag' already exists. - -set -eu - -# Make sure the commits always have the same SHA1s. -. "$SRCDIR/scripts/fix-committer-info" - -# Create a workspace and branch. -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" checkout test:morphs master - -# Tag the system branch twice. -"$SRCDIR/scripts/test-morph" tag example-tag -- -m First -"$SRCDIR/scripts/test-morph" tag example-tag -- -m Second diff --git a/tests.branching/morph-tag-fails-if-tag-exists.stderr b/tests.branching/morph-tag-fails-if-tag-exists.stderr deleted file mode 100644 index b774dfba..00000000 --- a/tests.branching/morph-tag-fails-if-tag-exists.stderr +++ /dev/null @@ -1 +0,0 @@ -ERROR: test:morphs: Tag "example-tag" already exists diff --git a/tests.branching/morph-tag-tag-works-as-expected.script b/tests.branching/morph-tag-tag-works-as-expected.script deleted file mode 100755 index 14c2ad3e..00000000 --- a/tests.branching/morph-tag-tag-works-as-expected.script +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -## Check that tagging an existing tag commit with 'morph tag' preserves -## the unpetrify-ref and does not "double-petrify" apart from updating -## references to "example-tag" to "tagged-tag". - -set -eu - -# Make sure the commits always have the same SHA1s. -. "$SRCDIR/scripts/fix-committer-info" - -# Create a workspace and branch. -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init -"$SRCDIR/scripts/test-morph" checkout test:morphs master - -# Tag the system branch. -"$SRCDIR/scripts/test-morph" tag example-tag -- -m First - -# Check out the tag. -"$SRCDIR/scripts/run-git-in" master/test:morphs checkout -b example-tag \ - 2>/dev/null - -# Tag the tag. -"$SRCDIR/scripts/test-morph" tag tagged-tag -- -m Second - -# List all tags and show the second one. -"$SRCDIR/scripts/test-morph" foreach -- git tag -l -"$SRCDIR/scripts/test-morph" foreach -- git show tagged-tag -"$SRCDIR/scripts/test-morph" foreach -- git log --format=fuller tagged-tag diff --git a/tests.branching/morph-tag-tag-works-as-expected.stdout b/tests.branching/morph-tag-tag-works-as-expected.stdout deleted file mode 100644 index ec12ba66..00000000 --- a/tests.branching/morph-tag-tag-works-as-expected.stdout +++ /dev/null @@ -1,62 +0,0 @@ -test:morphs -example-tag -tagged-tag -test:morphs -tag tagged-tag -Tagger: developer -Date: Tue Jul 31 16:51:54 2012 +0000 - -Second - -commit a96154002b3ffe71bd120e38682edbbe40b8453b -Author: developer -Date: Tue Jul 31 16:51:54 2012 +0000 - - Second - -diff --git a/hello-stratum.morph b/hello-stratum.morph -index 3b7be17..87561c1 100644 ---- a/hello-stratum.morph -+++ b/hello-stratum.morph -@@ -5,8 +5,9 @@ - { - "name": "hello", - "repo": "test:hello", -- "ref": "master", -- "build-depends": [] -+ "ref": "f4d032b42c0134e67bdf19a43fa99072493667d7", -+ "build-depends": [], -+ "unpetrify-ref": "master" - } - ] - } -diff --git a/hello-system.morph b/hello-system.morph -index f3f64b4..2981e9b 100644 ---- a/hello-system.morph -+++ b/hello-system.morph -@@ -8,7 +8,8 @@ - { - "morph": "hello-stratum", - "repo": "test:morphs", -- "ref": "master" -+ "ref": "tagged-tag", -+ "unpetrify-ref": "master" - } - ] - } -test:morphs -commit a96154002b3ffe71bd120e38682edbbe40b8453b -Author: developer -AuthorDate: Tue Jul 31 16:51:54 2012 +0000 -Commit: developer -CommitDate: Tue Jul 31 16:51:54 2012 +0000 - - Second - -commit 48d38ef3f39857d7dba4ed1ffc51653c6bed4906 -Author: developer -AuthorDate: Tue Jul 31 16:51:54 2012 +0000 -Commit: developer -CommitDate: Tue Jul 31 16:51:54 2012 +0000 - - initial diff --git a/tests.branching/morph-tag-works-with-multiple-morphs-repos.script b/tests.branching/morph-tag-works-with-multiple-morphs-repos.script deleted file mode 100755 index c80c0564..00000000 --- a/tests.branching/morph-tag-works-with-multiple-morphs-repos.script +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2012 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -## Check that "morph tag" works if morphologies are spread across multiple -## repositories. In this case, it should copy all petrified morphologies -## into the branch root repository and only create the tag there. - -set -eu - -# Make sure the commits always have the same SHA1s. -. "$SRCDIR/scripts/fix-committer-info" - -# Create new directory for repos used in this test. -mkdir -p "$DATADIR/repos" - -# Create the first morphs repository. -mkdir "$DATADIR/repos/morphs1" - -# Create system morphology in first morphs repository. -cat < "$DATADIR/repos/morphs1/test-system.morph" -{ - "name": "test-system", - "kind": "system", - "system-kind": "syslinux-disk", - "arch": "$(uname -m)", - "disk-size": "1G", - "strata": [ - { - "morph": "stratum1", - "repo": "repos:morphs1", - "ref": "master" - }, - { - "morph": "stratum2", - "repo": "repos:morphs2", - "ref": "master" - } - ] -} -EOF - -# Create stratum that depends on another stratum. -cat < "$DATADIR/repos/morphs1/stratum1.morph" -{ - "name": "stratum1", - "kind": "stratum", - "build-depends": [ - { - "morph": "stratum3", - "repo": "repos:morphs2", - "ref": "master" - } - ] -} -EOF - -# Commit all files to the first repository. -scripts/run-git-in "$DATADIR/repos/morphs1" init -scripts/run-git-in "$DATADIR/repos/morphs1" add . -scripts/run-git-in "$DATADIR/repos/morphs1" commit -m initial - -# Create second morphs repository. -mkdir "$DATADIR/repos/morphs2" - -# Create two strata in the second repository. -cat < "$DATADIR/repos/morphs2/stratum2.morph" -{ - "name": "stratum2", - "kind": "stratum", - "build-depends": [ - { - "morph": "stratum3", - "repo": "repos:morphs2", - "ref": "master" - } - ] -} -EOF -cat < "$DATADIR/repos/morphs2/stratum3.morph" -{ - "name": "stratum3", - "kind": "stratum" -} -EOF - -# Commit all files to the second repository. -"$SRCDIR/scripts/run-git-in" "$DATADIR/repos/morphs2" init -"$SRCDIR/scripts/run-git-in" "$DATADIR/repos/morphs2" add . -"$SRCDIR/scripts/run-git-in" "$DATADIR/repos/morphs2" commit -m initial - -cd "$DATADIR/workspace" -"$SRCDIR/scripts/test-morph" init - -# Check out the master system branch. -"$SRCDIR/scripts/test-morph" \ - --repo-alias=repos="file://$DATADIR/repos/%s#file://$DATADIR/%s" \ - checkout repos:morphs1 master - -# Tag the master system branch. -"$SRCDIR/scripts/test-morph" \ - --repo-alias=repos="file://$DATADIR/repos/%s#file://$DATADIR/%s" \ - tag tag-across-multiple-repos -- -m "create tag" - -# Show the tag. -GIT_DIR="$DATADIR/workspace/master/repos:morphs1/.git" \ - git show tag-across-multiple-repos -GIT_DIR="$DATADIR/workspace/master/repos:morphs1/.git" \ - git log --format=fuller -n1 -p --stat tag-across-multiple-repos diff --git a/tests.branching/morph-tag-works-with-multiple-morphs-repos.stdout b/tests.branching/morph-tag-works-with-multiple-morphs-repos.stdout deleted file mode 100644 index 98be9086..00000000 --- a/tests.branching/morph-tag-works-with-multiple-morphs-repos.stdout +++ /dev/null @@ -1,174 +0,0 @@ -Initialized empty Git repository in TMP/repos/morphs1/.git/ -[master (root-commit) 0bfadac] initial - 2 files changed, 30 insertions(+), 0 deletions(-) - create mode 100644 stratum1.morph - create mode 100644 test-system.morph -Initialized empty Git repository in TMP/repos/morphs2/.git/ -[master (root-commit) 06b1b9c] initial - 2 files changed, 15 insertions(+), 0 deletions(-) - create mode 100644 stratum2.morph - create mode 100644 stratum3.morph -tag tag-across-multiple-repos -Tagger: developer -Date: Tue Jul 31 16:51:54 2012 +0000 - -create tag - -commit ddcf257bd01b46424dc570e72aa8946b6dfdbc5f -Author: developer -Date: Tue Jul 31 16:51:54 2012 +0000 - - create tag - -diff --git a/stratum1.morph b/stratum1.morph -index 93a2d04..bf622db 100644 ---- a/stratum1.morph -+++ b/stratum1.morph -@@ -4,8 +4,10 @@ - "build-depends": [ - { - "morph": "stratum3", -- "repo": "repos:morphs2", -- "ref": "master" -+ "repo": "repos:morphs1", -+ "ref": "tag-across-multiple-repos", -+ "unpetrify-ref": "master", -+ "unpetrify-repo": "repos:morphs2" - } - ] - } -diff --git a/stratum2.morph b/stratum2.morph -new file mode 100644 -index 0000000..d27599c ---- /dev/null -+++ b/stratum2.morph -@@ -0,0 +1,13 @@ -+{ -+ "name": "stratum2", -+ "kind": "stratum", -+ "build-depends": [ -+ { -+ "morph": "stratum3", -+ "repo": "repos:morphs1", -+ "ref": "tag-across-multiple-repos", -+ "unpetrify-ref": "master", -+ "unpetrify-repo": "repos:morphs2" -+ } -+ ] -+} -diff --git a/stratum3.morph b/stratum3.morph -new file mode 100644 -index 0000000..a735127 ---- /dev/null -+++ b/stratum3.morph -@@ -0,0 +1,4 @@ -+{ -+ "name": "stratum3", -+ "kind": "stratum" -+} -diff --git a/test-system.morph b/test-system.morph -index 27806c1..c5e4d98 100644 ---- a/test-system.morph -+++ b/test-system.morph -@@ -8,12 +8,15 @@ - { - "morph": "stratum1", - "repo": "repos:morphs1", -- "ref": "master" -+ "ref": "tag-across-multiple-repos", -+ "unpetrify-ref": "master" - }, - { - "morph": "stratum2", -- "repo": "repos:morphs2", -- "ref": "master" -+ "repo": "repos:morphs1", -+ "ref": "tag-across-multiple-repos", -+ "unpetrify-ref": "master", -+ "unpetrify-repo": "repos:morphs2" - } - ] - } -commit ddcf257bd01b46424dc570e72aa8946b6dfdbc5f -Author: developer -AuthorDate: Tue Jul 31 16:51:54 2012 +0000 -Commit: developer -CommitDate: Tue Jul 31 16:51:54 2012 +0000 - - create tag ---- - stratum1.morph | 6 ++++-- - stratum2.morph | 13 +++++++++++++ - stratum3.morph | 4 ++++ - test-system.morph | 9 ++++++--- - 4 files changed, 27 insertions(+), 5 deletions(-) - -diff --git a/stratum1.morph b/stratum1.morph -index 93a2d04..bf622db 100644 ---- a/stratum1.morph -+++ b/stratum1.morph -@@ -4,8 +4,10 @@ - "build-depends": [ - { - "morph": "stratum3", -- "repo": "repos:morphs2", -- "ref": "master" -+ "repo": "repos:morphs1", -+ "ref": "tag-across-multiple-repos", -+ "unpetrify-ref": "master", -+ "unpetrify-repo": "repos:morphs2" - } - ] - } -diff --git a/stratum2.morph b/stratum2.morph -new file mode 100644 -index 0000000..d27599c ---- /dev/null -+++ b/stratum2.morph -@@ -0,0 +1,13 @@ -+{ -+ "name": "stratum2", -+ "kind": "stratum", -+ "build-depends": [ -+ { -+ "morph": "stratum3", -+ "repo": "repos:morphs1", -+ "ref": "tag-across-multiple-repos", -+ "unpetrify-ref": "master", -+ "unpetrify-repo": "repos:morphs2" -+ } -+ ] -+} -diff --git a/stratum3.morph b/stratum3.morph -new file mode 100644 -index 0000000..a735127 ---- /dev/null -+++ b/stratum3.morph -@@ -0,0 +1,4 @@ -+{ -+ "name": "stratum3", -+ "kind": "stratum" -+} -diff --git a/test-system.morph b/test-system.morph -index 27806c1..c5e4d98 100644 ---- a/test-system.morph -+++ b/test-system.morph -@@ -8,12 +8,15 @@ - { - "morph": "stratum1", - "repo": "repos:morphs1", -- "ref": "master" -+ "ref": "tag-across-multiple-repos", -+ "unpetrify-ref": "master" - }, - { - "morph": "stratum2", -- "repo": "repos:morphs2", -- "ref": "master" -+ "repo": "repos:morphs1", -+ "ref": "tag-across-multiple-repos", -+ "unpetrify-ref": "master", -+ "unpetrify-repo": "repos:morphs2" - } - ] - } diff --git a/tests.branching/tag-creates-commit-and-tag.script b/tests.branching/tag-creates-commit-and-tag.script new file mode 100755 index 00000000..e66d981f --- /dev/null +++ b/tests.branching/tag-creates-commit-and-tag.script @@ -0,0 +1,39 @@ +#!/bin/sh +# +# Copyright (C) 2012 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 +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +## Check that 'morph tag example-tag' successfully creates a dangling +## commit and an annotated tag pointing to this commit. + +set -eu + +# Make sure the commits always have the same SHA1s. +. "$SRCDIR/scripts/fix-committer-info" + +# Create a workspace and branch. +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" init +"$SRCDIR/scripts/test-morph" checkout test:morphs master + +# Tag the system branch. +"$SRCDIR/scripts/test-morph" tag example-tag -- -m Message + +# Show the tag itself and its log. This allows to verify a couple of things, +# including that the commit and tag are created, that the commit message is +# set correctly and that all references are petrified. +"$SRCDIR/scripts/test-morph" foreach -- git show example-tag +"$SRCDIR/scripts/test-morph" foreach -- git log --format=fuller example-tag diff --git a/tests.branching/tag-creates-commit-and-tag.stdout b/tests.branching/tag-creates-commit-and-tag.stdout new file mode 100644 index 00000000..8c36ede3 --- /dev/null +++ b/tests.branching/tag-creates-commit-and-tag.stdout @@ -0,0 +1,59 @@ +test:morphs +tag example-tag +Tagger: developer +Date: Tue Jul 31 16:51:54 2012 +0000 + +Message + +commit 2f0a16ffe676335e6914f1c6117fc0cbe261eacf +Author: developer +Date: Tue Jul 31 16:51:54 2012 +0000 + + Message + +diff --git a/hello-stratum.morph b/hello-stratum.morph +index 3b7be17..87561c1 100644 +--- a/hello-stratum.morph ++++ b/hello-stratum.morph +@@ -5,8 +5,9 @@ + { + "name": "hello", + "repo": "test:hello", +- "ref": "master", +- "build-depends": [] ++ "ref": "f4d032b42c0134e67bdf19a43fa99072493667d7", ++ "build-depends": [], ++ "unpetrify-ref": "master" + } + ] + } +diff --git a/hello-system.morph b/hello-system.morph +index f3f64b4..d26675d 100644 +--- a/hello-system.morph ++++ b/hello-system.morph +@@ -8,7 +8,8 @@ + { + "morph": "hello-stratum", + "repo": "test:morphs", +- "ref": "master" ++ "ref": "example-tag", ++ "unpetrify-ref": "master" + } + ] + } +test:morphs +commit 2f0a16ffe676335e6914f1c6117fc0cbe261eacf +Author: developer +AuthorDate: Tue Jul 31 16:51:54 2012 +0000 +Commit: developer +CommitDate: Tue Jul 31 16:51:54 2012 +0000 + + Message + +commit 48d38ef3f39857d7dba4ed1ffc51653c6bed4906 +Author: developer +AuthorDate: Tue Jul 31 16:51:54 2012 +0000 +Commit: developer +CommitDate: Tue Jul 31 16:51:54 2012 +0000 + + initial diff --git a/tests.branching/tag-fails-if-tag-exists.exit b/tests.branching/tag-fails-if-tag-exists.exit new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/tests.branching/tag-fails-if-tag-exists.exit @@ -0,0 +1 @@ +1 diff --git a/tests.branching/tag-fails-if-tag-exists.script b/tests.branching/tag-fails-if-tag-exists.script new file mode 100755 index 00000000..b02f87dc --- /dev/null +++ b/tests.branching/tag-fails-if-tag-exists.script @@ -0,0 +1,33 @@ +#!/bin/sh +# +# Copyright (C) 2012 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 +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +## Check that 'morph tag example-tag' fails if 'example-tag' already exists. + +set -eu + +# Make sure the commits always have the same SHA1s. +. "$SRCDIR/scripts/fix-committer-info" + +# Create a workspace and branch. +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" init +"$SRCDIR/scripts/test-morph" checkout test:morphs master + +# Tag the system branch twice. +"$SRCDIR/scripts/test-morph" tag example-tag -- -m First +"$SRCDIR/scripts/test-morph" tag example-tag -- -m Second diff --git a/tests.branching/tag-fails-if-tag-exists.stderr b/tests.branching/tag-fails-if-tag-exists.stderr new file mode 100644 index 00000000..b774dfba --- /dev/null +++ b/tests.branching/tag-fails-if-tag-exists.stderr @@ -0,0 +1 @@ +ERROR: test:morphs: Tag "example-tag" already exists diff --git a/tests.branching/tag-tag-works-as-expected.script b/tests.branching/tag-tag-works-as-expected.script new file mode 100755 index 00000000..14c2ad3e --- /dev/null +++ b/tests.branching/tag-tag-works-as-expected.script @@ -0,0 +1,46 @@ +#!/bin/sh +# +# Copyright (C) 2012 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 +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +## Check that tagging an existing tag commit with 'morph tag' preserves +## the unpetrify-ref and does not "double-petrify" apart from updating +## references to "example-tag" to "tagged-tag". + +set -eu + +# Make sure the commits always have the same SHA1s. +. "$SRCDIR/scripts/fix-committer-info" + +# Create a workspace and branch. +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" init +"$SRCDIR/scripts/test-morph" checkout test:morphs master + +# Tag the system branch. +"$SRCDIR/scripts/test-morph" tag example-tag -- -m First + +# Check out the tag. +"$SRCDIR/scripts/run-git-in" master/test:morphs checkout -b example-tag \ + 2>/dev/null + +# Tag the tag. +"$SRCDIR/scripts/test-morph" tag tagged-tag -- -m Second + +# List all tags and show the second one. +"$SRCDIR/scripts/test-morph" foreach -- git tag -l +"$SRCDIR/scripts/test-morph" foreach -- git show tagged-tag +"$SRCDIR/scripts/test-morph" foreach -- git log --format=fuller tagged-tag diff --git a/tests.branching/tag-tag-works-as-expected.stdout b/tests.branching/tag-tag-works-as-expected.stdout new file mode 100644 index 00000000..ec12ba66 --- /dev/null +++ b/tests.branching/tag-tag-works-as-expected.stdout @@ -0,0 +1,62 @@ +test:morphs +example-tag +tagged-tag +test:morphs +tag tagged-tag +Tagger: developer +Date: Tue Jul 31 16:51:54 2012 +0000 + +Second + +commit a96154002b3ffe71bd120e38682edbbe40b8453b +Author: developer +Date: Tue Jul 31 16:51:54 2012 +0000 + + Second + +diff --git a/hello-stratum.morph b/hello-stratum.morph +index 3b7be17..87561c1 100644 +--- a/hello-stratum.morph ++++ b/hello-stratum.morph +@@ -5,8 +5,9 @@ + { + "name": "hello", + "repo": "test:hello", +- "ref": "master", +- "build-depends": [] ++ "ref": "f4d032b42c0134e67bdf19a43fa99072493667d7", ++ "build-depends": [], ++ "unpetrify-ref": "master" + } + ] + } +diff --git a/hello-system.morph b/hello-system.morph +index f3f64b4..2981e9b 100644 +--- a/hello-system.morph ++++ b/hello-system.morph +@@ -8,7 +8,8 @@ + { + "morph": "hello-stratum", + "repo": "test:morphs", +- "ref": "master" ++ "ref": "tagged-tag", ++ "unpetrify-ref": "master" + } + ] + } +test:morphs +commit a96154002b3ffe71bd120e38682edbbe40b8453b +Author: developer +AuthorDate: Tue Jul 31 16:51:54 2012 +0000 +Commit: developer +CommitDate: Tue Jul 31 16:51:54 2012 +0000 + + Second + +commit 48d38ef3f39857d7dba4ed1ffc51653c6bed4906 +Author: developer +AuthorDate: Tue Jul 31 16:51:54 2012 +0000 +Commit: developer +CommitDate: Tue Jul 31 16:51:54 2012 +0000 + + initial diff --git a/tests.branching/tag-works-with-multiple-morphs-repos.script b/tests.branching/tag-works-with-multiple-morphs-repos.script new file mode 100755 index 00000000..c80c0564 --- /dev/null +++ b/tests.branching/tag-works-with-multiple-morphs-repos.script @@ -0,0 +1,123 @@ +#!/bin/sh +# +# Copyright (C) 2012 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 +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + +## Check that "morph tag" works if morphologies are spread across multiple +## repositories. In this case, it should copy all petrified morphologies +## into the branch root repository and only create the tag there. + +set -eu + +# Make sure the commits always have the same SHA1s. +. "$SRCDIR/scripts/fix-committer-info" + +# Create new directory for repos used in this test. +mkdir -p "$DATADIR/repos" + +# Create the first morphs repository. +mkdir "$DATADIR/repos/morphs1" + +# Create system morphology in first morphs repository. +cat < "$DATADIR/repos/morphs1/test-system.morph" +{ + "name": "test-system", + "kind": "system", + "system-kind": "syslinux-disk", + "arch": "$(uname -m)", + "disk-size": "1G", + "strata": [ + { + "morph": "stratum1", + "repo": "repos:morphs1", + "ref": "master" + }, + { + "morph": "stratum2", + "repo": "repos:morphs2", + "ref": "master" + } + ] +} +EOF + +# Create stratum that depends on another stratum. +cat < "$DATADIR/repos/morphs1/stratum1.morph" +{ + "name": "stratum1", + "kind": "stratum", + "build-depends": [ + { + "morph": "stratum3", + "repo": "repos:morphs2", + "ref": "master" + } + ] +} +EOF + +# Commit all files to the first repository. +scripts/run-git-in "$DATADIR/repos/morphs1" init +scripts/run-git-in "$DATADIR/repos/morphs1" add . +scripts/run-git-in "$DATADIR/repos/morphs1" commit -m initial + +# Create second morphs repository. +mkdir "$DATADIR/repos/morphs2" + +# Create two strata in the second repository. +cat < "$DATADIR/repos/morphs2/stratum2.morph" +{ + "name": "stratum2", + "kind": "stratum", + "build-depends": [ + { + "morph": "stratum3", + "repo": "repos:morphs2", + "ref": "master" + } + ] +} +EOF +cat < "$DATADIR/repos/morphs2/stratum3.morph" +{ + "name": "stratum3", + "kind": "stratum" +} +EOF + +# Commit all files to the second repository. +"$SRCDIR/scripts/run-git-in" "$DATADIR/repos/morphs2" init +"$SRCDIR/scripts/run-git-in" "$DATADIR/repos/morphs2" add . +"$SRCDIR/scripts/run-git-in" "$DATADIR/repos/morphs2" commit -m initial + +cd "$DATADIR/workspace" +"$SRCDIR/scripts/test-morph" init + +# Check out the master system branch. +"$SRCDIR/scripts/test-morph" \ + --repo-alias=repos="file://$DATADIR/repos/%s#file://$DATADIR/%s" \ + checkout repos:morphs1 master + +# Tag the master system branch. +"$SRCDIR/scripts/test-morph" \ + --repo-alias=repos="file://$DATADIR/repos/%s#file://$DATADIR/%s" \ + tag tag-across-multiple-repos -- -m "create tag" + +# Show the tag. +GIT_DIR="$DATADIR/workspace/master/repos:morphs1/.git" \ + git show tag-across-multiple-repos +GIT_DIR="$DATADIR/workspace/master/repos:morphs1/.git" \ + git log --format=fuller -n1 -p --stat tag-across-multiple-repos diff --git a/tests.branching/tag-works-with-multiple-morphs-repos.stdout b/tests.branching/tag-works-with-multiple-morphs-repos.stdout new file mode 100644 index 00000000..98be9086 --- /dev/null +++ b/tests.branching/tag-works-with-multiple-morphs-repos.stdout @@ -0,0 +1,174 @@ +Initialized empty Git repository in TMP/repos/morphs1/.git/ +[master (root-commit) 0bfadac] initial + 2 files changed, 30 insertions(+), 0 deletions(-) + create mode 100644 stratum1.morph + create mode 100644 test-system.morph +Initialized empty Git repository in TMP/repos/morphs2/.git/ +[master (root-commit) 06b1b9c] initial + 2 files changed, 15 insertions(+), 0 deletions(-) + create mode 100644 stratum2.morph + create mode 100644 stratum3.morph +tag tag-across-multiple-repos +Tagger: developer +Date: Tue Jul 31 16:51:54 2012 +0000 + +create tag + +commit ddcf257bd01b46424dc570e72aa8946b6dfdbc5f +Author: developer +Date: Tue Jul 31 16:51:54 2012 +0000 + + create tag + +diff --git a/stratum1.morph b/stratum1.morph +index 93a2d04..bf622db 100644 +--- a/stratum1.morph ++++ b/stratum1.morph +@@ -4,8 +4,10 @@ + "build-depends": [ + { + "morph": "stratum3", +- "repo": "repos:morphs2", +- "ref": "master" ++ "repo": "repos:morphs1", ++ "ref": "tag-across-multiple-repos", ++ "unpetrify-ref": "master", ++ "unpetrify-repo": "repos:morphs2" + } + ] + } +diff --git a/stratum2.morph b/stratum2.morph +new file mode 100644 +index 0000000..d27599c +--- /dev/null ++++ b/stratum2.morph +@@ -0,0 +1,13 @@ ++{ ++ "name": "stratum2", ++ "kind": "stratum", ++ "build-depends": [ ++ { ++ "morph": "stratum3", ++ "repo": "repos:morphs1", ++ "ref": "tag-across-multiple-repos", ++ "unpetrify-ref": "master", ++ "unpetrify-repo": "repos:morphs2" ++ } ++ ] ++} +diff --git a/stratum3.morph b/stratum3.morph +new file mode 100644 +index 0000000..a735127 +--- /dev/null ++++ b/stratum3.morph +@@ -0,0 +1,4 @@ ++{ ++ "name": "stratum3", ++ "kind": "stratum" ++} +diff --git a/test-system.morph b/test-system.morph +index 27806c1..c5e4d98 100644 +--- a/test-system.morph ++++ b/test-system.morph +@@ -8,12 +8,15 @@ + { + "morph": "stratum1", + "repo": "repos:morphs1", +- "ref": "master" ++ "ref": "tag-across-multiple-repos", ++ "unpetrify-ref": "master" + }, + { + "morph": "stratum2", +- "repo": "repos:morphs2", +- "ref": "master" ++ "repo": "repos:morphs1", ++ "ref": "tag-across-multiple-repos", ++ "unpetrify-ref": "master", ++ "unpetrify-repo": "repos:morphs2" + } + ] + } +commit ddcf257bd01b46424dc570e72aa8946b6dfdbc5f +Author: developer +AuthorDate: Tue Jul 31 16:51:54 2012 +0000 +Commit: developer +CommitDate: Tue Jul 31 16:51:54 2012 +0000 + + create tag +--- + stratum1.morph | 6 ++++-- + stratum2.morph | 13 +++++++++++++ + stratum3.morph | 4 ++++ + test-system.morph | 9 ++++++--- + 4 files changed, 27 insertions(+), 5 deletions(-) + +diff --git a/stratum1.morph b/stratum1.morph +index 93a2d04..bf622db 100644 +--- a/stratum1.morph ++++ b/stratum1.morph +@@ -4,8 +4,10 @@ + "build-depends": [ + { + "morph": "stratum3", +- "repo": "repos:morphs2", +- "ref": "master" ++ "repo": "repos:morphs1", ++ "ref": "tag-across-multiple-repos", ++ "unpetrify-ref": "master", ++ "unpetrify-repo": "repos:morphs2" + } + ] + } +diff --git a/stratum2.morph b/stratum2.morph +new file mode 100644 +index 0000000..d27599c +--- /dev/null ++++ b/stratum2.morph +@@ -0,0 +1,13 @@ ++{ ++ "name": "stratum2", ++ "kind": "stratum", ++ "build-depends": [ ++ { ++ "morph": "stratum3", ++ "repo": "repos:morphs1", ++ "ref": "tag-across-multiple-repos", ++ "unpetrify-ref": "master", ++ "unpetrify-repo": "repos:morphs2" ++ } ++ ] ++} +diff --git a/stratum3.morph b/stratum3.morph +new file mode 100644 +index 0000000..a735127 +--- /dev/null ++++ b/stratum3.morph +@@ -0,0 +1,4 @@ ++{ ++ "name": "stratum3", ++ "kind": "stratum" ++} +diff --git a/test-system.morph b/test-system.morph +index 27806c1..c5e4d98 100644 +--- a/test-system.morph ++++ b/test-system.morph +@@ -8,12 +8,15 @@ + { + "morph": "stratum1", + "repo": "repos:morphs1", +- "ref": "master" ++ "ref": "tag-across-multiple-repos", ++ "unpetrify-ref": "master" + }, + { + "morph": "stratum2", +- "repo": "repos:morphs2", +- "ref": "master" ++ "repo": "repos:morphs1", ++ "ref": "tag-across-multiple-repos", ++ "unpetrify-ref": "master", ++ "unpetrify-repo": "repos:morphs2" + } + ] + } -- cgit v1.2.1