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 --- 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 " 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;