(Resend with sripts now)

This patch series fix some errors on converts from Monotone to
Subversion and back.

I'm sorry for my badly Phyton, I don't know to make it better. Please
feel free to replace some quick and dirty changes into better style. This
patches are more fixups and workarrounds instead repair the code. :-(

The testing scripts can put into the testing directory.
(I'm not ably to create new Python files)

PATCH 1/5
Monotone: File DELETED and ADDED in same diff. Combine to file UPDATED


PATCH 2/5
Subversion: use-propset in '[DEFAULT]' give an error for empty var.
Mostly on multiple branches. Or, if calls again after the inital first call.

Run tailor again without getting new revisions will crash with:
File "~/src/tailor-0.9.28-henry/vcpx/repository/svn.py", line 104, in create
 hookname = join(repodir, 'hooks', 'pre-revprop-change')
UnboundLocalError: local variable 'repodir' referenced before assignment

Check with 'test-mtn-to-svn.sh'


PATCH 3/5
Monotone: ExternalCommandChain: If one command give no outputs, don't reading
from stdin and waiting forever.  Simple break the command chain.

Check with 'test-mtn-to-svn.sh'


PATCH 4/5
Monotone: Can't handle microsecond.

Error output was while transform from Subversion to Monotone. It fails on
the first revision, that contains the Text "This directory will host the
upstream sources".

Check with 'test-mtn-to-svn.sh'


PATCH 5/5
Monotone: The initial convert from Monotone to Subversion (or others)
was losing the first revision.  All 'add file' found in the next revision.

Check with 'test-mtn-svn-and-back.sh' (see last commit). There the
'initial commit' will be missing in Subversion.

--
Henry N.
#!/bin/sh -v

# File: test-mtn-to-svn.sh
#
# Test for
# 1. "UnboundLocalError: local variable 'repodir' referenced before assignment"
# 2. reading from stdin on empty descendents
#
# (The doing on branch A and branch B has nothing to do with this error.
# This script does something more as it needed. Fighting with 'propagate'.)
# The error is coming up after the line "read junk".

# tested with monotone 0.35
export LANG=C

# Remove all files, we used here, and start from clean new dir
rm -rf testdir
mkdir testdir
cd testdir

# Create a new data file with a branch
mtn --db test1.mtn db init
mtn --db=test1.mtn --branch=A setup files

# Create one file and one revision
cd files
echo "foo" > file.txt
mtn add file.txt
mtn commit --message "initial commit A"

# create a second branch
echo "bar" > file2.txt
mtn add file2.txt
mtn commit --message "create a new branch B" --branch=B
cd ..

# change file on branch A, which exists in both branches
mtn --db=test1.mtn --branch=A co filesA
cd filesA
echo "fooA" > file.txt
mtn commit --message "changes on A"

# 'propagate' from branch B
mtn propagate B A
mtn update
mtn log --no-graph >mtn.log
cd ..

# create a config for tailor
cat <<EOF >test-mtn2svn.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

tailor -c test-mtn2svn.conf


# Now start again, without news from upstream.
#
# 1. Typicaly it crashes with:
#    File "~/src/tailor-0.9.28-henry/vcpx/repository/svn.py", line 104, in create
#       hookname = join(repodir, 'hooks', 'pre-revprop-change')
#    UnboundLocalError: local variable 'repodir' referenced before assignment"
#
# 2. Typicaly it hangs endless in reading from STDIN, because
#    "mtn automate descendents ..." gets nothing and the
#    "mtn automate toposort ..." hangs on reading from STDIN.
#    A workarround is CTRL-D to continue.
#
# Please press key ENTER to start these test:
read junk

# Run tailor again will hang on STDIN
tailor -c test-mtn2svn.conf

echo "tailor exists with: $?"

cd ..
#!/bin/sh -v

# File: test-mtn-svn-and-back.sh
# Test for converting 3 revisions from Monotone to Subversion and back to Monotone again.
# 1. It fails on --date for Monotone because Monotona don't understands dates with microseconds.
# 2. It's loosing the 'initial commit' from Monotone to Subversion.

# tested with monotone 0.35
export LANG=C

# Cleanup the used tempdirectory. Create a new empty tempdirectory 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 one file and 3 revisions
cd monotone-work
echo "foo" > file.txt
mtn add file.txt
mtn commit --message "initial commit"

echo "bar" > file.txt
mtn commit --message "change file"

echo "whatever" > file.txt
mtn commit --message "change file again"
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
# 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 ..
_______________________________________________
Tailor mailing list
[email protected]
http://lists.zooko.com/mailman/listinfo/tailor

Reply via email to