summaryrefslogtreecommitdiffstats
path: root/tools/latestbranch.sh
blob: ae9dd1fc0d77308e4145f931bc738531a9a8e2ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# set -x

repolist=$1
source="git://cloud.onap.org/mirror"

  #
  # csv column #nn: latest branch
  #

  readarray -t array < ./${repolist};
  i=0
  csv[i]="${csv[i]},MASTER repo name"
  ((i++))
  for line in "${array[@]}"
  do
    reponame=$(echo $line | awk -F "|" '{print $1}');
    csv[i]="${csv[i]},${reponame}"
    ((i++))
    
    #echo " "
    #echo ${reponame}
  
    git ls-remote -q --heads "${source}/${reponame}" | sed 's/^.*heads\///' | sed -nr '/^master$|^amsterdam$|^beijing$|^casablanca$|^dublin$|^elalto$|^frankfurt$|^guilin$|^honolulu$|^istanbul$/Ip' | tail -2 | head -1
    #git ls-remote -q --heads "${source}/${reponame}" | sed 's/^.*heads\///' 

  done
  unset array
  unset i
  unset reponame

exit