I set up an automatic compilation process in shellscript, and I just want to figure if the trunk didn't received any commit from the last tagging... Is there a way to perform it with a simple svn command line, without read and compare the history, "scriptly" or manually ?
Asked
Active
Viewed 57 times
2 Answers
2
In SVN a tag is neither an alias for a revision nor immutable. Instead it is just a copy! It is possible to modify the tag after it has been created. So the only way is to compare the revision numbers of the two paths. This question shows how to get them.
-
Thanks, exactly what I looked for. – Amessihel Aug 11 '16 at 15:46
0
Thanks to @ceving, here's a nice sample to check if a project tree is up-to-date regarding tags.
Given that a project is set as the following :
rootdev/prj1/
rootdev/prj1/trunk
rootdev/prj1/tags
Script :
#!/bin/bash
tabs 30 # be fancy
function last-rev ()
{
svn log "$1" -r HEAD:1 -l 1 -q | grep -ao '^r\S*'
}
find rootdev -ipath "*tags" |
while read tags
do
module="$(dirname $tags)"
modulename="$(basename $module)"
lasttag="$(ls -1 $tags | tail -n 1)"
lastrev=$(last-rev "$module")
lasttagrev=$(last-rev "$tags/$lasttag")
echo -ne "$modulename\t: $lasttag\t$lasttagrev/$lastrev "
[[ "$lastrev" == "$lasttagrev" ]] && echo "[UPTODATE]" || echo "[OUTDATED]"
done
Output :
DateUtils : 1.0.0 r116/r116 [UPTODATE]
ThisUtils : 1.0.0 r116/r116 [UPTODATE]
SomeUtils : 1.2.1 r125/r125 [UPTODATE]
ThatUtils : 1.0.1 r101/r101 [UPTODATE]
NotUtils : 1.0.0 r101/r128 [OUTDATED]
WhyUtils : 1.2.0 r130/r130 [UPTODATE]

Amessihel
- 5,891
- 3
- 16
- 40