Tags: patch

I remade the patch so it also handles URLs without usernames
This patch fixes #441436.

-- 
Jonathan Beckman
Network Operator
Spotify


This e-mail (including any attachments) may contain information that is
confidential and/or privileged. It is intended only for the recipient(s).
If you have reason to believe that you are not the intended recipient of
this e-mail, please contact the sender immediately and delete the e-mail
from your computer.
Index: get-config-dir-svn
===================================================================
--- get-config-dir-svn	(revision 5050)
+++ get-config-dir-svn	(working copy)
@@ -9,11 +9,19 @@
 # Short-Description: get $FAI from an svn repository.
 ### END SUBROUTINE INFO
 
-# matched string: "svn://[EMAIL PROTECTED]/svnpath"
+# matched string: "svn://user:[EMAIL PROTECTED]/svnpath"
 protocol=$(expr match "$FAI_CONFIG_SRC" '\([^:]*\)://')
-username=$(expr match "$FAI_CONFIG_SRC" '[^:]*://\([EMAIL PROTECTED])@')
-svnpath=$(expr match "$FAI_CONFIG_SRC" '[^:]*://[EMAIL PROTECTED]@\([^[:space:]]\+\)')
+username=$(expr match "$FAI_CONFIG_SRC" '[^:]*://\([^@:]*\)[@:]')
 
+# If we have a username in our url we should parse out svnpath differently
+# also we should parse out possible password.
+if [ -n $username ]; then
+    svnpath=$(expr match "$FAI_CONFIG_SRC" '[^:]*://[EMAIL PROTECTED]@\([^[:space:]]\+\)')
+    password=$(expr match "$FAI_CONFIG_SRC" '[^:]*://[^:]*:\([EMAIL PROTECTED])@')
+else
+    svnpath=$(expr match "$FAI_CONFIG_SRC" '[^:]*://\([^[:space:]]\+\)')
+fi
+
 case $protocol in
 	svn)
 		svnurl="svn://$svnpath"
@@ -39,15 +47,16 @@
 esac
 		
 [ -n "$username" ] && user="--username $username"
+[ -n "$password" ] && pass="--password $password"
 [ -z "$username" ] && svnurl=$FAI_CONFIG_SRC
 
 if [ -d "$FAI/.svn" ] ; then
    echo "Updating SVN in $FAI"
    cd $FAI
-   svn up $user | grep -v 'Updated to revision' > $LOGDIR/getconf.log
+   svn up $user $pass | grep -v 'Updated to revision' > $LOGDIR/getconf.log
    task_error 701
 else 
    echo "Checking out SVN"
-   svn co $user $svnurl $FAI | grep -v 'Checked out revision' > $LOGDIR/getconf.log
+   svn co $user $pass $svnurl $FAI | grep -v 'Checked out revision' > $LOGDIR/getconf.log
    task_error 702
 fi

Reply via email to