[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Patches to svnmerge

From: Blair Zajac <blair_at_orcaware.com>
Date: 2005-07-13 04:42:27 CEST

Hi Archie,

Thanks for writing svnmerge, it's great!

I've got a patch to svnmerge from working with it for several weeks. I
can commit them myself or you can.

1) For bi-directional merges between only two directories, having
get_default_head filter out the directory it is currently working in is
useful, as then it'll pick the other directory automatically. Right now
I always needs to specify -S.

2) In a repository I was working with, I set up svnmerge to take merges
from a branch back into trunk, so I had to specify the -S command line
option to 'svnmerge init'. I copied the URL from my browser, so it
ended up with a trailing /. This caused problems later on, with the
code not able to find a matching repository local path if you specify a
local path to -S, because it'll run 'svn info' on the local path and end
up with a URL without a trailing /.

I haven't addressed this, but I think having get_repo_root() cache its
results would speed it up a bit, especially since I add another call to it.

Finally, have you considered rewriting this in another language that is
more cross platform friendly, such as Python or Perl? Right now Window
users need Cygwin to run this script. It would be faster and not as
hard to do some of the work, such as normalize_list().

Regards,
Blair

-- 
Blair Zajac, Ph.D.
<blair@orcaware.com>
Subversion and Orca training and consulting
http://www.orcaware.com/svn/

Index: svnmerge
===================================================================
--- svnmerge (revision 15331)
+++ svnmerge (working copy)
@@ -191,7 +191,13 @@
 # Subroutine to retrieve the default head of the given target
 get_default_head()
 {
- RETURN_VALUE=`"${SVN_MERGE_SVN}" propget "${SVN_MERGE_PROP}" "$1" | cut -d: -f 1`
+ # To make bi-directional merges easier, find the target's
+ # repository local path so it can be removed from the list of
+ # possible integration sources.
+ target_to_url "$1"
+ url_to_rlpath "${RETURN_VALUE}"
+
+ RETURN_VALUE=`"${SVN_MERGE_SVN}" propget "${SVN_MERGE_PROP}" "$1" | cut -d: -f 1 | grep -v "^${RETURN_VALUE}$"`
     [ -z "${RETURN_VALUE}" ] && error no integration info available
     [ `echo "${RETURN_VALUE}" | wc -l` -gt 1 ] && \
         error explicit \"src\" argument required
@@ -664,6 +670,21 @@
     exit 1
 fi
 
+# Previous svnmerge versions allowed trailing /'s in repository local
+# path. Newer versions will trim trailing /'s appearing in the
+# command line, so if there are any properties with trailing /'s, they
+# will not be matched.
+if TEMP=`"${SVN_MERGE_SVN}" propget "${SVN_MERGE_PROP}" "${BRANCH_DIR}" | grep -E '/+:[-0-9]+$'`; then
+ echo "${NAME}: old property values detected; an upgrade is required."
+ echo ''
+ echo 'Please execute and commit these changes to upgrade:'
+ echo ''
+ echo "svn propget ${SVN_MERGE_PROP} ${BRANCH_DIR} | sed -e 's/\/*\(:[-0-9]*\)/\1/g' > new_svnmerge_props.txt"
+ echo "svn propset ${SVN_MERGE_PROP} ${BRANCH_DIR} -F new_svnmerge_props.txt"
+ echo "rm new_svnmerge_props.txt"
+ exit 1
+fi
+
 # Calculate ${HEAD_URL} and ${HEAD_PATH}
 if [ -z "${HEAD}" ]; then
     if [ "${ACTION}" = "init" ]; then
@@ -679,6 +700,13 @@
     get_repo_root "${BRANCH_DIR}"
     HEAD_URL="${RETURN_VALUE}/${HEAD_PATH}"
 else
+ # The source was given as a command line argument and is stored in
+ # HEAD. Ensure that the specified source does not end in a /,
+ # otherwise it's easy to have the same source path listed more
+ # than once in the integrated version properties, with and without
+ # trailing /'s.
+ HEAD=`echo ${HEAD} | sed -e 's/\/*$//'`
+
     target_to_url "${HEAD}"
     HEAD_URL="${RETURN_VALUE}"
     url_to_rlpath "${HEAD_URL}"
@@ -711,4 +739,3 @@
 
 # Perform action
 ${ACTION}
-

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jul 13 04:43:14 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.