5 local default
="${2:-n}"
9 printf "%s y/n [%s] > " "$prompt" "$default"
11 case "${input:-$default}" in
20 mkdir
"pwclient.get.$$"
23 mv *.
patch "../$1.patch"
25 rmdir "pwclient.get.$$"
29 date +"%a, %d %b %Y %H:%M:%S %z" |
sed -e 's|, 0|, |'
37 for line
in $
(sed -ne '/^Subject: */ { s/^Subject: *//p; :next; n; s/^ \+//p; t next; b }' "$1"); do
38 subject
="$subject$line"
41 printf "%s\n" "$subject" |
sed -e 's/^\[.*\] *//'
52 for addr
in $
(sed -ne "/^$field: */ { s/^$field: *//p; :next; n; s/^ \\+//p; t next; b }" "$file"); do
53 list
="${list:+$list, }$(echo "$addr" | sed -e 's/^ \+//; s/ \+$//')"
56 [ -n "$list" ] && printf "%s: %s\n" "$field" "$list"
60 sed -ne "s/^$2: *//p" "$1" |
head -n1
64 local remote_ref remote_url remote_host remote_host remote_repo remote_user
66 remote_ref
="$(git for-each-ref --format='%(push:short)' $(git symbolic-ref -q HEAD))"
68 [ -n "$remote_ref" ] || \
69 remote_ref
="$(git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD))"
71 [ -n "$remote_ref" ] || \
74 remote_url
="$(git remote get-url "${remote_ref%%/*}")"
78 remote_host
="${remote_url##http*://}"
79 case "$remote_host" in *@
*)
80 remote_user
="${remote_host%%@*}"
81 remote_host
="${remote_host##*@}"
83 case "$remote_host" in */*)
84 remote_repo
="${remote_host#*/}"
85 remote_host
="${remote_host%%/*}"
89 remote_host
="$remote_url"
90 case "$remote_host" in *@
*)
91 remote_user
="${remote_host%%@*}"
92 remote_host
="${remote_host##*@}"
94 case "$remote_host" in *:*)
95 remote_repo
="${remote_host##*:}"
96 remote_host
="${remote_host%%:*}"
101 case "$remote_host" in
102 git.lede-project.org
)
103 case "$remote_repo" in
105 echo "Merged into ${remote_ref##*/} with"
108 echo "Merged into my staging tree with"
111 echo "Merged into ${remote_repo:-the repository}, branch ${remote_ref##*/} with"
120 echo "http://$remote_host/?p=$remote_repo;a=commitdiff;h=$(git log -1 --format=%h)."
127 echo "$1" |
grep -sqE '^[0-9]+$' ||
{
128 echo "Usage: $0 <patch-id>" >&2
132 [ -f "$1.patch" ] ||
{
133 pwclient info
"$1" >/dev
/null
2>/dev
/null ||
{
134 echo "Unknown patch ID: $1" >&2
139 echo "Failed to download patch" >&2
144 git am
"$1.patch" ||
{
145 echo "Failed to apply patch $1" >&2
152 if ! yesno
"Keep change?" "y"; then
153 git
reset --hard HEAD^
155 if yesno
"Set to 'Changes Requested'?"; then
156 pwclient update
-s "Changes Requested" "$1"
159 if yesno
"Set to 'Accepted'?" "y"; then
160 pwclient update
-s "Accepted" "$1"
162 if yesno
"Send reply mail?" "y"; then
164 printf "From: %s <%s>\n" "$(git config user.name)" "$(git config user.email)"
166 get_hdr_list
"$1.patch" Cc
168 printf "Date: %s\n" "$(get_date)"
169 printf "Subject: Merged: %s\n\n" "$(get_subject "$1.
patch")"
178 if yesno
"Edit reply?" "n"; then
180 --to "$(get_hdr "$1.
patch" To)" \
181 --cc "$(get_hdr "$1.
patch" From)" \
182 --in-reply-to "$(get_hdr "$1.
patch" Message-Id)" \
186 --to "$(get_hdr "$1.
patch" To)" \
187 --cc "$(get_hdr "$1.
patch" From)" \
188 --in-reply-to "$(get_hdr "$1.
patch" Message-Id)" \
189 --confirm=never
"$1.reply"
192 rm -f "$1.reply" "$1.patch"