]> xenbits.xensource.com Git - osstest.git/commitdiff
cri-common: Refactor select_prevxenbranch to cri-getprevxenbranch
authorIan Campbell <ian.campbell@citrix.com>
Fri, 11 Sep 2015 09:52:49 +0000 (10:52 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 14 Sep 2015 10:36:17 +0000 (11:36 +0100)
This moves it outside any prevailing set -x and reduces the amount of
noise in various logs.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
cri-common
cri-getprevxenbranch [new file with mode: 0755]

index 94696ab77ec46d95aaf9fae229c92182cb06e78a..266948524d3306bbebe588a28d5b714eda743726 100644 (file)
@@ -61,21 +61,7 @@ repo_tree_rev_fetch_git () {
 }
 
 select_prevxenbranch () {
-       local b
-       local p
-       for b in $(./mg-list-all-branches) ; do # already sorted by version
-               case "$b" in
-               xen*)
-                       if [ "x$b" = "x$xenbranch" ] ; then
-                               break
-                       else
-                               p=$b
-                       fi
-                       ;;
-               *)      ;;
-               esac
-       done
-       prevxenbranch=$p
+       prevxenbranch=`./cri-getprevxenbranch $xenbranch`
 }
 
 select_xenbranch () {
diff --git a/cri-getprevxenbranch b/cri-getprevxenbranch
new file mode 100755 (executable)
index 0000000..308b0c7
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+set -e
+
+xenbranch=$1
+p=
+
+for b in $(./mg-list-all-branches) ; do # already sorted by version
+    case "$b" in
+       xen*)
+           if [ "x$b" = "x$xenbranch" ] ; then
+               break
+           else
+               p=$b
+           fi
+           ;;
+       *)      ;;
+    esac
+done
+
+echo $p