summaryrefslogtreecommitdiff
path: root/tests.branching/morph-tag-creates-commit-and-tag.script
diff options
context:
space:
mode:
authorJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-12-05 17:51:47 +0000
committerJannis Pohlmann <jannis.pohlmann@codethink.co.uk>2012-12-13 14:30:35 +0000
commit51e4bbb4dffde9574404df9c5e947f518dc49a41 (patch)
tree208d2826e88932f2442c44b4268bdda76346206f /tests.branching/morph-tag-creates-commit-and-tag.script
parentd63c97a0bef1cd2f03ca266acda67cad065632df (diff)
downloadmorph-51e4bbb4dffde9574404df9c5e947f518dc49a41.tar.gz
Add an initial implementation of "morph tag"
In order to make releases and freeze system branches entirely, we need to be able to 100% petrify a system branch (that is, resolve ALL refs into SHA1s) and tag this state to be able to check it out again later. This is essentially what "morph tag" does. It takes a tag name and an arbitrary amount of arguments to "git tag", petrifies all morphologies of the current system branch behind the scenes, creates a dangling commit and attaches an annotated tag to it. Petrifying in this case means that all refs used for chunks are resolved into commit SHA1s. For stratum and system morphologies, the refs are replaced by the name of the tag that's being created. The "tag" command also supports tagging when stratum morphologies are spread across multiple repositories. In this case, it will include all statum morphologies from other repos in the tag commi in the branch root repo. The references to these morphologies are updated so that they point to the branch root repo and the tag being created. This commit also adds a few tests for "morph tag" to verify that all this works.
Diffstat (limited to 'tests.branching/morph-tag-creates-commit-and-tag.script')
-rwxr-xr-xtests.branching/morph-tag-creates-commit-and-tag.script39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests.branching/morph-tag-creates-commit-and-tag.script b/tests.branching/morph-tag-creates-commit-and-tag.script
new file mode 100755
index 00000000..4de3e4b9
--- /dev/null
+++ b/tests.branching/morph-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.
+source "$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 example-tag