Greetings Everyone!

While trying to help isolate a "SQLITE_CONSTRAINT: abort at 41" problem
that Andy Bradford is looking into (Thanks Andy!), I ran across what looks
like a rename being lost in a merge.  At the end of this email is a Bash
script that can be used to reproduce this scenario.

There are 3 branches in play here: trunk, branch_1, and branch_2.

In "trunk", all the initial files and directories are created.  Later on,
only merges will take place in "trunk". No file edits.

In "branch_1", files are edited, deleted, and moved around (via 'mv
--hard') which results in the RENAME.

In "branch_2", a directory is renamed and all files are modified after the
directory is renamed.

When running the script, "/bin/bash -x ./test_lost_rename.sh", the
interesting output is:

+ fossil co trunk
foo/dir_1/foo_dir_1_1.txt
foo/dir_1/foo_dir_1_2.txt
foo/dir_2/foo_dir_2_1.txt
foo/dir_2/foo_dir_2_2.txt
foo/foo_1.txt
foo/foo_2.txt
+ fossil merge branch_1
DELETE foo/dir_1/foo_dir_1_2.txt
DELETE foo/foo_2.txt
RENAME foo/dir_2/foo_dir_2_2.txt -> foo/dir_1/foo_dir_1_2.txt
ADDED foo/dir_2/foo_dir_2_2.txt
 "fossil undo" is available to undo changes to the working checkout
+ fossil commit -m 'merged branch_1
New_Version: dd05bdcb9ab051d4ecf48016832eef6fc2cb3b48
+ fossil co branch_2
bar/dir_1/foo_dir_1_1.txt
bar/dir_1/foo_dir_1_2.txt
bar/dir_2/foo_dir_2_1.txt
bar/dir_2/foo_dir_2_2.txt
bar/foo_1.txt
bar/foo_2.txt
+ fossil merge trunk
DELETE bar/dir_1/foo_dir_1_2.txt
DELETE bar/foo_2.txt
ADDED foo/dir_2/foo_dir_2_2.txt
 "fossil undo" is available to undo changes to the working checkout.

The RENAME takes place when "branch_1" is merged into "trunk", but not when
"trunk" is merged into "branch_2".  I would expect fossil to be able to
figure this out since it was able to determine that it had to "DELETE
bar/dir_1/foo_dir_1_2.txt" (vs "DELETE foo/dir_1/foo_dir_1_2.txt")

Were my expectations wrong? Or is this an area of improvement for fossil?

Apologies for the uninspired file and directory names.


---------- Begin Script: test_lost_rename.sh  ---------------

#!/bin/bash
#
# The initial file layout:
# test/
#       foo/
#               dir_1/
#                       foo_dir_1_1.txt
#                       foo_dir_1_2.txt
#               dir_2/
#                       foo_dir_2_1.txt
#                       foo_dir_2_2.txt
#               foo_1.txt
#               foo_2.txt

mkdir test_lost_rename
cd test_lost_rename/

mkdir -p foo/dir_1 foo/dir_2
echo "trunk added" > foo/foo_1.txt
echo "trunk added" > foo/foo_2.txt
echo "trunk added" > foo/dir_1/foo_dir_1_1.txt
echo "trunk added" > foo/dir_1/foo_dir_1_2.txt
echo "trunk added" > foo/dir_2/foo_dir_2_1.txt
echo "trunk added" > foo/dir_2/foo_dir_2_2.txt

fossil new ../test_lost_rename.fossil
fossil open ../test_lost_rename.fossil
fossil addrem
fossil commit -m "trunk setup"

fossil branch new branch_1 trunk
fossil co branch_1
fossil rm --hard foo/foo_2.txt foo/dir_1/foo_dir_1_2.txt
fossil commit -m "fossil rm --hard foo/foo_2.txt foo/dir_1/foo_dir_1_2.txt"
fossil mv --hard foo/dir_2/foo_dir_2_2.txt foo/dir_1/foo_dir_1_2.txt
echo "branch_1 add" > foo/dir_2/foo_dir_2_2.txt
fossil add foo/dir_2/foo_dir_2_2.txt
fossil commit -m "fossil mv --hard foo/dir_2/foo_dir_2_2.txt
foo/dir_1/foo_dir_1_2.txt; fossil add foo/dir_2/foo_dir_2_2.txt"

fossil co trunk
fossil branch new branch_2 trunk
fossil co branch_2
fossil mv --hard foo bar
fossil mv foo bar
fossil commit -m "fossil mv --hard foo bar; fossil mv foo bar"

fossil co branch_2
echo "branch_2 edit" >> bar/dir_1/foo_dir_1_1.txt
echo "branch_2 edit" >> bar/dir_1/foo_dir_1_2.txt
echo "branch_2 edit" >> bar/dir_2/foo_dir_2_1.txt
echo "branch_2 edit" >> bar/dir_2/foo_dir_2_2.txt
echo "branch_2 edit" >> bar/foo_1.txt
echo "branch_2 edit" >> bar/foo_2.txt
fossil commit -m "edited all files"

fossil co branch_1
fossil merge trunk
fossil co trunk
fossil merge branch_1
fossil commit -m "merged branch_1"

fossil co branch_2
fossil merge trunk
fossil commit -m "merged trunk"
fossil co trunk
fossil merge branch_2
fossil commit -m "merged branch_2"

---------- End Script: test_lost_rename.sh  ---------------
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to