From 93f97d3ff42ad2c4428374a53a67fd5576e741d0 Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Thu, 7 Aug 2008 08:13:38 +0000
Subject: [PATCH] Bug 61: When using Subversion, rub now searches for version
 tags in both 'tags' and 'branches' directories.

---
 autoconf_share/rub  | 16 +++++++++++++++-
 autoconf_share/rub1 | 34 +++++++++++++++++++++++++++++++---
 2 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/autoconf_share/rub b/autoconf_share/rub
index 034c230481d..d3fb75846e4 100755
--- a/autoconf_share/rub
+++ b/autoconf_share/rub
@@ -676,7 +676,21 @@ do
       # Use the switch command to do this.
       part="trunk"
       if [ "$vers" != "" ]; then
-        part="branches/$vers"
+        # $vers can be either in tags or in branches; try both
+        for dir in tags branches
+        do
+          part="$dir/$vers"
+          # if list command succeeds, we've got the correct value for $part
+          if $command list $svnurl/$part/$pkg > /dev/null 2>&1; then
+            break
+          else
+            part=
+          fi
+        done
+        if [ "$part" = "" ]; then
+          echo "Error: version $vers of $pkg not found"
+          exit 1
+        fi
       fi
       echo "(cd $pkg  &&  $command switch $svnurl/$part/$pkg)" >> rub.log 2>&1
       (cd $pkg  &&  $command switch $svnurl/$part/$pkg) >> rub.log 2>&1
diff --git a/autoconf_share/rub1 b/autoconf_share/rub1
index 0c7c02f14bd..42a97724c4f 100755
--- a/autoconf_share/rub1
+++ b/autoconf_share/rub1
@@ -125,7 +125,7 @@ if [ "$pkgline" = "" ]; then
       # Remove the part '-release-branch' leaving the CVS tag name.
       getvers=`cvs log $pkgname/configure.in 2>&1 | grep release-branch | head -1 | sed -e 's/[ \t]*\(.*\)-release-branch.*/\1/'`
     else
-      getvers=`svn list $svnurl/branches 2>&1 | grep $pkgnmvers | grep release-root | tail -1 | sed -e 's/[ \t]*\(.*\)-release-root.*/\1/'`
+      getvers=`svn list $svnurl/branches 2>&1 | grep $pkgnmvers | grep release-branch | tail -1 | sed -e 's/[ \t]*\(.*\)-release-branch.*/\1/'`
     fi
   fi
 
@@ -211,7 +211,21 @@ if [ "$pkgline" = ""  -o  "$getvers" != "$curvers" ]; then
         # in version is also handled.
         part="trunk"
         if [ "$getvers" != "" ]; then
-          part="branches/$getvers"
+          # $getvers can be either in tags or in branches; try both
+          for dir in tags branches
+          do
+            part="$dir/$getvers"
+            # if list command succeeds, we've got the correct value for $part
+            if $command list $svnurl/$part/$pkgname > /dev/null 2>&1; then
+              break
+            else
+              part=
+            fi
+          done
+          if [ "$part" = "" ]; then
+            echo "Error: version $getvers of $pkgname not found"
+            exit 1
+          fi
         fi
         echo "(cd $pkgname  &&  $command switch $svnurl/$part/$pkgname)" >> rub.log 2>&1
         (cd $pkgname  &&  $command switch $svnurl/$part/$pkgname) >> rub.log 2>&1
@@ -253,7 +267,21 @@ if [ "$pkgline" = ""  -o  "$getvers" != "$curvers" ]; then
         # Check out the leaf.
         part=trunk
         if [ "$getvers" != "" ]; then
-          part="branches/$getvers"
+          # $getvers can be either in tags or in branches; try both
+          for dir in tags branches
+          do
+            part="$dir/$getvers"
+            # if list command succeeds, we've got the correct value for $part
+            if $command list $svnurl/$part/$pkgname > /dev/null 2>&1; then
+              break
+            else
+              part=
+            fi
+          done
+          if [ "$part" = "" ]; then
+            echo "Error: version $getvers of $pkgname not found"
+            exit 1
+          fi
         fi
         # Find out if it is a leaf package or super package by testing
 	# if it has a configure.in file.
-- 
GitLab