File: guilt-fold

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 (49 lines) | stat: -rwxr-xr-x 885 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
#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006-2013
#

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

_main() {

if [ "$1" = "-k" ]; then
	keep=t
	shift
fi

if [ $# -ne 1 ]; then
	usage
fi

patch="$1"
if [ -z "$patch" ]; then
	die "No patch name supplied."
fi

# make sure it is a file
if [ ! -f "$GUILT_DIR/$branch/$patch" ]; then
	die "Patch $patch does not exist."
fi

# make sure that there are no unapplied changes
if ! must_commit_first; then
	die "Uncommited changes detected. Refresh first."
fi

# make sure it is not applied
pline=`cat "$applied" | grep -e "^$patch$"`
if [ ! -z "$pline" ]; then
	die "Patch is applied. Pop the patch first."
fi

fold_patch "$patch"

# back it up just in case :)
[ -z "$keep" ] && mv "$GUILT_DIR/$branch/$patch" "$GUILT_DIR/$branch/$patch~"

}