Hi Julian,
I found that the TC URL_at_REV info from a merge conflict only prints the
target URLs, omitting the recursed-into portions of it.
See the output of the attached script, using any of
./java-refactor.sh.txt 2
./java-refactor.sh.txt 3
./java-refactor.sh.txt 4
./java-refactor.sh.txt 5
, which looks like:
[[[
---- variant four, merge branch to trunk as-is, accept theirs.
+ svn merge file:////arch/hg/svn-tc/test/repos/branch trunk/
--- Merging r2 through r3 into 'trunk':
C trunk/com/yoyodyne
Summary of conflicts:
Tree conflicts: 1
+ svn st
M trunk
! C trunk/com/yoyodyne
> local delete, incoming edit upon merge
+ svn info trunk/com/yoyodyne
Path: trunk/com/yoyodyne
Name: yoyodyne
Node Kind: none
Tree conflict: local delete, incoming edit upon merge
Source left: (dir) file:///.../repos/trunk_at_1
Source right: (dir) file:///.../repos/branch_at_3
]]]
It's supposed to print
[[[
Source left: (dir) file:///.../repos/trunk/com/yoyodyne_at_1
Source right: (dir) file:///.../repos/branch/com/yoyodyne_at_3
]]]
, including the portions below the target URL, right? Did I get this wrong
all the time??
Otherwise we'd need to change info upon update to be like this, too...
~Neels
#!/bin/bash
## GENERIC PREPARATIONS
if [ -f /usr/local/bin/superpower ]; then
# use my local way if my script is there (neels).
echo "##### REMEMBER TO SETUP YOUR ENVIRONMENT #####"
else
# the rest of the world:
# The next line is the only line you should need to adjust.
SVNDIR=/my/svn/trunk
alias svn=${SVNDIR}/subversion/svn/svn
alias svnserve=${SVNDIR}/subversion/svnserve/svnserve
alias svnadmin=${SVNDIR}/subversion/svnadmin/svnadmin
fi
svn --version
# Select an access method. If svn://, the svnserve setup is
# handled automagically by this script; but if http://, then
# you'll have to configure it yourself first.
#
# URL=http://localhost/neels/repos
# URL=svn://localhost/repos
URL=file:///`pwd`/repos
rm -rf repos wc
svnadmin create repos
# These are for svnserve only.
echo "[general]" > repos/conf/svnserve.conf
echo "anon-access = write" >> repos/conf/svnserve.conf
echo "auth-access = write" >> repos/conf/svnserve.conf
# The server will only be contacted if $URL is svn://foo, of course.
svnserve --pid-file svnserve-pid -d -r `pwd`
# And put the kill command in a file, in case need to run it manually.
echo "kill -9 `cat svnserve-pid`" > k
chmod a+rwx k
svn co -q ${URL} wc
set -x
cd wc
## ACTUAL TEST
# Original Java package (entirely fictional).
mkdir -p trunk/com/yoyodyne/gui
cat > trunk/com/yoyodyne/gui/Labels.java <<END
package com.yoyodyne.gui;
public static class Labels {
public static final String TITLE = "Yoyodyne Gadget";
}
END
cat > trunk/com/yoyodyne/gui/MainWindow.java <<END
package com.yoyodyne.gui;
import org.gtk.*;
public class MainWindow extends GtkWindow {
public MainWindow(){
this.setTitle(Labels.TITLE);
}
}
END
svn add trunk
svn ci -m "commit original package"
# Someone branches it.
svn cp trunk branch
svn up .
# Now, there is conflicting development on trunk and branch.
# trunk: change the overall package name.
svn mv trunk/com/yoyodyne trunk/com/dynaco
cat > trunk/com/dynaco/gui/Labels.java <<END
package com.dynaco.gui;
public static class Labels {
public static final String TITLE = "Dynaco Gadget";
}
END
cat > trunk/com/dynaco/gui/MainWindow.java <<END
package com.dynaco.gui;
import org.gtk.*;
public class MainWindow extends GtkWindow {
public MainWindow(){
this.setTitle(Labels.TITLE);
}
}
END
svn ci -m "committing yoyodyne->dynaco on trunk" trunk
# branch: The Labels class is moved to another sub-package.
svn mkdir branch/com/yoyodyne/lang
svn mv branch/com/yoyodyne/gui/Labels.java branch/com/yoyodyne/lang/
cat > branch/com/yoyodyne/lang/Labels.java <<END
package com.yoyodyne.lang;
public static class Labels {
public static final String TITLE = "Yoyodyne Gadget";
}
END
cat > branch/com/yoyodyne/gui/MainWindow.java <<END
package com.yoyodyne.gui;
import com.yoyodyne.lang.*;
import org.gtk.*;
public class MainWindow extends GtkWindow {
public MainWindow(){
this.setTitle(Labels.TITLE);
}
}
END
svn ci -m "committing Labels.java=>lang on branch" branch
# So the conflicting changes are now in the repository, one on trunk,
# one on branch. Now, a developer guy wants to merge to trunk. He tries
# a couple of different approaches, the "variants":
# If this script is invoked with an argument, use it to indicate
# which variant to run.
variant=$1
if [ -z "$variant" ]; then
variant=1
fi
if [ $variant = "1" ]; then
echo "---- variant one, get branch up-to-date with trunk."
svn merge $URL/trunk branch/
# Fails to show any tree-conflics.
# This should fail because the merge tries to delete com/yoyodyne
# but that is not the same com/yoyodyne that was originally deleted
# anymore. The branch modified it. We'd need to call diff to tell us
# whether branch/com/yoyodyne and trunk/com/yoyodyne_at_1 are any different,
# but diff needs fixing.
fi
if [ $variant = "2" ]; then
echo "---- variant two, get subdir of branch up-to-date with trunk."
svn merge $URL/trunk/com/dynaco branch/com/yoyodyne
# reports a tree-conflict on branch/com/yoyodyne/gui/Labels.java,
# because the branch moved it away to lang/Labels.java while trunk
# wants to edit it.
svn st
svn info branch/com/yoyodyne/gui/Labels.java
svn ci -m m
# Commit fails. Good.
svn resolve --accept=working branch/com/yoyodyne/gui/Labels.java
svn st
svn diff
# This looks good. We've gotten all information available,
# the resolve works.
fi
if [ $variant = "3" ]; then
echo "---- variant three, merge branch to trunk as-is."
svn merge $URL/branch trunk/
# reports a tree-conflict on trunk/com/yoyodyne.
svn st
svn info trunk/com/yoyodyne
svn ci -m m
# Commit fails. Good.
svn resolve --accept=working trunk/com/yoyodyne
svn st
svn diff
# Ok, the conflict marker is gone. We said the current working
# copy is what we want to keep, so this worked out.
fi
if [ $variant = "4" ]; then
echo "---- variant four, merge branch to trunk as-is, accept theirs."
svn merge $URL/branch trunk/
# reports a tree-conflict on trunk/com/yoyodyne.
svn st
svn info trunk/com/yoyodyne
svn ci -m m
# Commit fails. Good.
svn resolve --accept=theirs-full trunk/com/yoyodyne
svn st
svn diff
# Hey, wait a minute, this does exactly the same as --accept=working.
# That's not what we want here.
fi
if [ $variant = "5" ]; then
echo "---- variant five, merge branch to trunk as-is, subdir only."
svn merge $URL/branch/com/yoyodyne trunk/com/dynaco
# reports a tree-conflict on trunk/com/dynaco/gui/Labels.java.
# A new .../lang/Labels.java was added without comment.
svn st
svn info trunk/com/dynaco/gui/Labels.java
svn ci -m m
# Commit fails. Good.
svn resolve --accept=working trunk/com/dynaco/gui/Labels.java
svn st
svn diff
echo "---"
cat trunk/com/dynaco/lang/Labels.java
# Hm. We said --accept=working, and in doing so we agreed on deleting
# our gui/Labels.java. A new lang/Labels.java was added, but we might
# not see that that's related.
# What's good: The change from the branch was brought in.
# The new trunk/com/dynaco/lang/Labels.java is still saying
# "package com.yoyodyne.lang.*;", which needs a local edit. Also,
# the constant TITLE was (technically) reverted back to saying
# "Yoyodyne" instead of "Dynaco" on current trunk. But there is
# no conflict marker or anything that tells me about those.
# This can't be fixed without proper move information in Subversion.
fi
## ACTUAL TEST ENDS
echo "====="
cd ..
./k
Received on 2008-11-26 05:00:19 CET