#!/usr/bin/tcl
#
# Run this script to test to see that the latest trunk changes can be
# merged into LTS branches without breaking anything.
#
# To Use:
#
# * Copy this script into a directory above the sqlite checkout
# * Run "fossil update trunk" and "fossil revert"
# * Run "tclsh ../merge-test.tcl" (in other words run this script)
#
# Operation:
#
# This script changes to each LTS branch to be tested, merges the latest
# trunk changes into the branch (without committing them) and then
# runs "make test". Any errors are stored in local files.
#
# Limitations:
#
# Some LTS branches are not synced directly from trunk but rather from
# other LTS branches. These other branches cannot be tested because
# there is no good way to generate the intermediate merges.
#
###############################################################################
# Run a shell command contained in arguments. Put the return code in
# global variable ::res and the output string in global variable ::result
#
# Run the shell command contained in arguments. Print an error and exit
# if anything goes wrong.
#
# Write $content into a file named $filename. The file is overwritten if it
# already exist. The file is create if it does not already exist.
#
# Run the merge-test
#
foreach
mustbeok fossil revert
mustbeok fossil up trunk
puts "reset back to trunk"