Artifact
3dfd51dbc112622ad82683802a692bd1ae42c718:
Attachment "merge-conflict.sh" to
ticket [67a47646]
added by
leor
2012-02-10 05:40:55.
#!/bin/bash
################################################################################
# Demonstrates "fossil commit" failure after merge.
# We have a repo with two files bar, foo which is being developed in branches
# trunk and next. At some point next is merged into trunk. bar is successfully
# automerged while foo has merge conflicts requiring manual resolution.
# From internal logic of the project resolving conflicts in foo requires
# modifications to bar. After bar is edited "fossil commit" fails!
################################################################################
# Preamble to setup directories and output redirection
BNAME=merge-conflict
RTDIR="/tmp/fossil-tests/$BNAME"
rm -rf "$RTDIR"
mkdir -p "$RTDIR"
exec 2>&1
exec 1>& >(tee "$RTDIR/T.log")
echo "**************************************************************************"
echo "** $RTDIR/T.log -- this log"
echo "** $RTDIR/T.fossil -- test repo"
echo "** $RTDIR/T -- checkout"
echo "**************************************************************************"
set -x
# Test case
cd "$RTDIR" # Now in $RTDIR
fossil new T.fossil
mkdir -p T
cd T # Now in $RTDIR/T
fossil open ../T.fossil
echo "foo in the branch trunk" > foo
echo "bar in the trunk" > bar
fossil add foo bar
fossil ci -m 'added foo, bar to the trunk'
echo "foo in the branch next" > foo
echo "line added to bar in branch next" >> bar
fossil ci --branch next -m 'commit to newly created branch next'
# go to the trunk
fossil co trunk
fossil inf
# make changes to trunk
echo "new foo version in the trunk" > foo
fossil ci -m 'foo changed in trunk'
# merge next into trunk
fossil merge --detail next
fossil cha
echo "merged version of foo" > foo
echo "resolving merge conflicts in foo required changes in bar" > bar
# trying to commit. GETTING ERRORS!!!
fossil ci --force -m 'resolved conflicts in foo'
#EoF