Ticket Change Details
Not logged in
Overview

Artifact ID: dbd4def99d8bbdeb948e2d73062e5a026ae1439e
Ticket: 67a47646ea38c7ed77112b579a6f7dce84e4eda9
commit failure after merge
User & Date: leor 2012-02-10 05:25:45
Changes

  1. comment changed to:
    I ran into a strange problem which results in "fossil commit" failure
    after a specific type of merge. Below I included a self-contained shell script that reproduces the problem. Tested with trunk version of fossil on Linux.
    Here is the problem's description.
    A fossil repository T.fossil contains two brunches "trunk" and "next".
    In both branches there are two files "foo" and "bar". At some point in
    development process I merge branch next into the trunk. The contents
    of the files are such that "fossil merge next" successfully
    auto-merges changes in bar but has merge conflicts in foo that has to
    be manually resolved. So far so good.
    <verbatim>
    $ fossil cha
    UPDATED_BY_MERGE bar
    EDITED     foo
    </verbatim>
    
    The project's internal logic dictates that while fixing merge
    conflicts in foo I have to make some changes to bar.
    After any changes to "bar" fossil refuses to commit claiming that
    "working checkout does not match what would have ended up in the repository".
    
    I think this behavior is incorrect, for it forces me to commit a
    broken state of the project, let say code does not compile.
    Please, run an attached shell script to reproduce the problem.
    
    <verbatim>
    ----%<--------%<----
    #!/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
    ---->%-------->%----
    </verbatim>
    
  2. foundin changed to: "trunk"
  3. private_contact changed to: "88dd45b41c4c2c9de79828b446518623552710a5"
  4. severity changed to: "Severe"
  5. status changed to: "Open"
  6. title changed to: "commit failure after merge"
  7. type changed to: "Code_Defect"