blob: 9c0542740fffb5017641e83b46ed13b73180e080 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
guilt: pop and delete tags
Add support for popping to a tag and the ability to delete
a tag while popping from the tree
Upstream-Status: Inappropriate [oe-specific]
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
guilt-pop | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
--- a/guilt-pop
+++ b/guilt-pop
@@ -17,6 +17,13 @@ while [ $# -gt 0 ]; do
-n)
num=t
;;
+ -t|--t)
+ tag=$2
+ shift
+ ;;
+ -d|--d) # can only be used with --t
+ delete_tag=t
+ ;;
*)
break
;;
@@ -24,7 +31,7 @@ while [ $# -gt 0 ]; do
shift
done
-# "guilt-pop" or "guilt-pop foo" or "guilt-pop -n foo"
+# "guilt-pop" or "guilt-pop foo" or "guilt-pop -n foo" or "guilt-pop -t <tag>"
if [ -z "$all" ] && [ $# -gt 1 ]; then
usage
fi
@@ -44,12 +51,26 @@ fi
patch="$1"
[ ! -z "$all" ] && patch="-a"
+
+# tag processing will just roll into another one of
+# the pop types, number or patch name
+if [ ! -z "$tag" ]; then
+ git-rev-list HEAD ^$tag > /dev/null 2>/dev/null
+ if [ $? -eq 0 ]; then
+ revs="`git-rev-list HEAD ^$tag`"
+ num=`echo "$revs" | wc -l`
+ patch=$num
+ else
+ echo "Cannot find tag $tag";
+ exit 0
+ fi
+fi
+
if [ ! -s "$applied" ]; then
disp "No patches applied."
exit 0
elif [ "$patch" = "-a" ]; then
# we are supposed to pop all patches
-
sidx=`wc -l < $applied`
eidx=0
elif [ ! -z "$num" ]; then
@@ -96,3 +117,6 @@ pop_many_patches `git rev-parse refs/pat
p=`get_top`
[ ! -z "$p" ] && disp "Now at $p." || disp "All patches popped."
+if [ ! -z "$delete_tag" ]; then
+ git tag -d $tag
+fi;
|