summaryrefslogtreecommitdiff
path: root/tests.merging/conflict-stratum-field-ordering.script
diff options
context:
space:
mode:
Diffstat (limited to 'tests.merging/conflict-stratum-field-ordering.script')
-rwxr-xr-xtests.merging/conflict-stratum-field-ordering.script106
1 files changed, 106 insertions, 0 deletions
diff --git a/tests.merging/conflict-stratum-field-ordering.script b/tests.merging/conflict-stratum-field-ordering.script
new file mode 100755
index 00000000..071d5204
--- /dev/null
+++ b/tests.merging/conflict-stratum-field-ordering.script
@@ -0,0 +1,106 @@
+#!/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.
+
+# Conflict caused by two equivalent strata having different order in two
+# different branches
+
+# Morph should possibly resolve this conflict automatically in the future,
+# because the meaning of the morphologies is unambiguious if not the
+# contents. It depends on how much weight we give to the sort order of
+# the morphology from a developer's point of view.
+
+set -eu
+
+# Disable test on versions of Python before 2.7.
+if ! python --version 2>&1 | grep '^Python 2\.[78]' > /dev/null
+then
+ cat "$SRCDIR/tests.branching/merge-conflict-stratum.stdout"
+ cat "$SRCDIR/tests.branching/merge-conflict-stratum.stderr" >&2
+ exit 1
+fi
+
+cd "$DATADIR/workspace"
+"$SRCDIR/scripts/test-morph" init
+
+# Create stable branch to merge TO
+"$SRCDIR/scripts/test-morph" branch baserock:morphs test/stable
+cd test/stable/baserock:morphs
+git push --quiet origin test/stable
+
+# Create feature branch to merge FROM
+"$SRCDIR/scripts/test-morph" branch baserock:morphs test/feature test/stable
+
+# Need 2 chunks!
+
+# Make a change in TO
+cd "$DATADIR/workspace/test/stable"
+"$SRCDIR/scripts/test-morph" edit hello-system hello-stratum
+cd baserock:morphs
+cat <<EOF > "hello-stratum.morph"
+{
+ "name": "hello-stratum",
+ "kind": "stratum",
+ "chunks": [
+ {
+ "name": "hello-runtime",
+ "repo": "baserock:hello",
+ "ref": "master",
+ "morph": "hello",
+ "build-depends": []
+ },
+ {
+ "name": "hello-devel",
+ "repo": "baserock:hello",
+ "ref": "master",
+ "morph": "hello",
+ "build-depends": []
+ }
+ ]
+}
+EOF
+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 baserock:morphs
+cat <<EOF > "hello-stratum.morph"
+{
+ "name": "hello-stratum",
+ "kind": "stratum",
+ "chunks": [
+ {
+ "name": "hello-devel",
+ "repo": "baserock:hello",
+ "ref": "master",
+ "morph": "hello",
+ "build-depends": []
+ },
+ {
+ "name": "hello-runtime",
+ "repo": "baserock:hello",
+ "ref": "master",
+ "morph": "hello",
+ "build-depends": []
+ }
+ ]
+}
+EOF
+git commit --quiet --all -m "Split up 'hello' chunk into devel and runtime"
+
+# Merge changes from test/feature to test/stable - we expect failure
+cd "$DATADIR/workspace/test/stable"
+"$SRCDIR/scripts/test-morph" merge test/feature