-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathandroid-tag
More file actions
executable file
·45 lines (39 loc) · 808 Bytes
/
android-tag
File metadata and controls
executable file
·45 lines (39 loc) · 808 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
topdir=$(pwd)
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <create|restore>"
exit 1
fi
action="$1"
create_tag()
{
# XXX: should verify "git status" to ensure to uncommitted diffs
repo manifest -r | cat
}
restore_tag()
{
while read line; do
prj_entry=$(echo $line | grep "<project ")
if [ -z "$prj_entry" ]; then
continue
fi
dir=$(echo $prj_entry | egrep -o "path=([^ ]*)" | cut -d'"' -f2)
tag=$(echo $prj_entry | egrep -o "revision=([^ ]*)" | cut -d'"' -f2)
if [ -z "$dir" -o -z "$tag" ]; then
echo "Malformed line $line"
continue
fi
if [ ! -d "$topdir/$dir" ]; then
echo "No such dir $dir"
continue
fi
echo "$dir -> $tag"
cd "$topdir/$dir"
git checkout "$tag"
done
}
case "$action" in
create) create_tag ;;
restore) restore_tag ;;
*) usage ;;
esac