Ticket #132 (closed defect: fixed)

Opened 6 years ago

Last modified 6 years ago

Monotone -> Svn drops changes while remove or delete other files

Reported by: HenryN Owned by: lele
Priority: major Milestone: VersionOne
Component: mtn Version: 0.9
Keywords: Cc:

Description

The changes on file are missing, if any other file was 'removed' or 'renamed'. Output from 'Monotone diff' sems be good. See *.diff and *.log, files have created from the same command, as found in Tailor's verbose log.

Tailor version 0.9.28 Monotone Version 0.35 svn, Version 1.3.0 (r17949).

On Monotone:

  1. Create branch
  2. add 3 files
  3. change file1, delete file2
  4. change file1, rename file3 into file4

After Tailor in Subversion seen this:

  1. initial injection (Monotone branch)
  2. This revision was complete missing
  3. add file1, no info about file2, add file3. Information about file2 was hidden (because rev 0 has no file2).
  4. missing changes on file1, rename file3/4

Changes on file1 are not in svn, but it's in the subdir 'mtnside', The rsync has worked, but the command to svn has no set to commit changes on file1.

After paching tailor with mtn-initial-revision.patch have this in Subversion:

  1. initial injection
  2. add 3 files
  3. missing changes on file1. Deleted file2.
  4. missing changes on file1. Renamed file3/4

In the step 2. and 3. the change on file1.txt was totaly loosed. The file1 contains the first initial commit "foo1" from step 1 in all revisions.

With script 'test-mtn-rename.sh' can produce this problem.

Henry N.

Change History

comment:1 Changed 6 years ago by HenryN

Script test-mtn-rename.sh can not attach. Server sayed "internal error". So, included as text here...

#!/bin/sh -v
# File: test-mtn-svn-rename.sh
# 
# Test for 'rename' and 'drop' files.
# Test from Monotone to Subversion, than do it back to Monotone.
#
# Problem:
# The changes on file are missing, if any other file was 'removed' or 'renamed'.
# Output from 'Monotote diff' sems be good. See *.diff and *.log, files have
# created from the same command, as found in Tailor's verbose log.
#
# Tailor version 0.9.28
# Monotone Version 0.35
# svn, Version 1.3.0 (r17949).
#
# With only the date patch (4.mtn-date.patch):
# Step  Monotone side     	Subversion side         Back to Monotone
# 0.	       			initial injection	initial from Svn
# 1.	Add 3 files		-missing-
# 2.	Change file1		File1 added		File1 added
#	Delete file2		-no info about file2-
#				File3 added		File3 added
# 3.	Change file1		-missing-
#	Rename file3 to 4	Rename file3/4		Rename file3/4
#
# Step 1: Complete missing.
# Step 2: Information about file2 was hidden (because rev 0 has no file2).
# Step 3: Changes on file1 are not in svn, but it's in the subdir 'mtnside',
#         The rsync has worked, but the command to svn has no set to commit
#         changes on file1.
# 
# 
# With more patches (5.mtn-initial-revision.patch and 4.mtn-date.patch):
# Step  Monotone side     	Subversion side         Back to Monotone
# 0.	       			initial injection	initial from Svn
# 1.	Add 3 files		Add 3 files		Add 3 files
# 2.	Change file1		-missing-
#	Delete file2		Delete file2		Delete file2
# 3.	Change file1		-missing-
#	Rename file3 to 4	Rename file3/4		Rename file3/4
# 
# In the step 2. and 3. the change on file1.txt was totaly loosed. The file1
# contains the first initial commit "foo1" from step 1 in all revisions.
# 
# Henry(*)Bigfoot.de

# tested with monotone 0.35
# Needed for 'mtn log' on locale non EN.
export LANG=C

# Path to patched tailor
# export PATH=$HOME/src/tailor-0.9.28-1:$PATH

# Cleanup the used tempdirectory. Create a new directory and work there.
rm -rf testdir
mkdir testdir
cd testdir

# Create a new data base with a branch
mtn --db test1.mtn db init
mtn --db=test1.mtn --branch=A setup monotone-work

# Create 3 files, rename, drop and change some
cd monotone-work
echo "foo1" > file1.txt
echo "foo2" > file2.txt
echo "foo3" > file3.txt
mtn add file*.txt
mtn commit --message "initial commit 3 files"

echo "file1 changed, file2 dropped" > file1.txt
mtn drop file2.txt
mtn commit --message "file2 droped from revision"

echo "file3 renamed into file4" > file1.txt
mtn rename file3.txt file4.txt
mtn commit --message "file3 renamed into file4"
cd ..

# create first config for tailor
cat <<EOF >test-mtn-svn-forward.conf
[DEFAULT]
# use-propset = True
verbose = True

[project]
root-directory = $PWD/rootdir
source = monotone:source
target = svn:target

[monotone:source]
repository = $PWD/test1.mtn
module = A
subdir = mtnside

[svn:target]
repository = file://$PWD/svnrepository
module = A
subdir = svnside
EOF

# Convert from Monotone to Subversion
tailor -c test-mtn-svn-forward.conf

# create a second config for tailor
cat <<EOF >test-mtn-svn-backward.conf
[DEFAULT]
use-propset = True
verbose = True

[project]
root-directory = $PWD/rootdir-back
target = monotone:target
source = svn:source

[monotone:target]
repository = $PWD/test2.mtn
module = A
subdir = mtnside
# Please setup yours here...
# keyid = henry(*)bigfoot.de

[svn:source]
repository = file://$PWD/svnrepository
module = A
subdir = svnside
EOF

# Convert back from Subversion to Monotone
tailor -c test-mtn-svn-backward.conf

# Create a log to see into:
mtn --db=test1.mtn log --from `mtn --db=test1.mtn automate heads A` --no-graph > test1.log
mtn --db=test2.mtn log --from `mtn --db=test2.mtn automate heads A` --no-graph > test2.log

cd ..

comment:2 in reply to: ↑ description Changed 6 years ago by HenryN

Replying to HenryN:

Fixed by follow patch:

File: monotone-rename-drops-changes.patch

Monotone: Changes on file was missing, if other will be renamed or removed.
Check with 'test-mtn-svn-rename-change.sh'.
'test-mtn-svn-back-del-ren-add-change.sh' is a more complexe test.

============================================================
--- tailor-0.9.28/vcpx/repository/monotone.py
+++ tailor-0.9.28/vcpx/repository/monotone.py
@@ -555,6 +565,22 @@
                                 "followed by '%s','%s','%s'" % (fromw, oldr,
                                                                 tow, newr))

+                        # The 'chentry' is not nessesary if no other entries exist.
+                        # But needs, if one entry with rename or delete exist before,
+                        # because the list of modifired file will be upstream only
+                        # files from this list (Monotone to Subversion).
+                        # So, the best: Always list the changed files here.
+                        #
+                        # Add file to the list, if no rename or other entry exist.
+                        flag = True
+                        for i,e in enumerate(chset.entries):
+                            if e.name == fname[1:-1]:
+                               flag = False
+                               break
+                        if flag:
+                            chentry = chset.addEntry(fname[1:-1], chset.revision)
+                            chentry.action_kind = chentry.UPDATED
+
         except StopIteration:
             if in_item:
                 raise GetUpstreamChangesetsFailure("Unexpected end of 'diff' parsing changeset info")

The patch can download also from  http://www.henrynestler.com/tailor/monotone-rename-drops-changes.patch

A testing script (test-mtn-svn-rename-change.sh), my full patch (monotone-complete-20070602.patch) and more can cownload from  http://www.henrynestler.com/tailor/

Henry N.

comment:3 Changed 6 years ago by HenryN

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.