File: guilt-delete

package info (click to toggle)
guilt 0.36-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,312 kB
  • sloc: sh: 3,063; makefile: 95; perl: 42
file content (56 lines) | stat: -rwxr-xr-x 767 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006-2013
#

USAGE="[-f] <patchname>"
if [ -z "$GUILT_VERSION" ]; then
	echo "Invoking `basename "$0"` directly is no longer supported." >&2
	exit 1
fi

_main() {

case $# in
	1)
		# just patchname
		force=
		;;
	2)
		# -f patchname
		if [ "$1" != "-f" ]; then
			usage
		fi

		force=t
		shift
		;;
	*)
		usage
		;;
esac

patch="$1"

if [ -z "$patch" ]; then
	die "You must specify a patch to delete"
fi

if [ ! -f "$GUILT_DIR/$branch/$patch" ]; then
	die "Patch $patch does not exist."
fi

p=`grep -e "^$patch$" < "$applied"`
if [ ! -z "$p" ] ; then
	die "Cannot delete an applied patch"
fi

series_remove_patch "$patch"

guilt_hook "delete" "$patch"

[ ! -z "$force" ] && rm -f "$GUILT_DIR/$branch/$patch"

exit 0

}