#!/bin/sh TEMP_D="" CR=' ' error() { echo "$@" 1>&2; } fail() { [ $# -eq 0 ] || error "$@"; exit 1; } Usage() { cat <&2 if git merge-base --is-ancestor "$commit" "$from_ref"; then drops="${drops} debian/patches/$bname" fi ;; *) echo "$bname${extra:+ ${extra}}";; esac done < $dpseries > "${TEMP_D}/series" drops=${drops# } if [ -n "$drops" ]; then cp "${TEMP_D}/series" "$dpseries" || fail "failed copying to $dpseries" if [ ! -s $dpseries ]; then git rm --force "$dpseries" || fail "failed removing empty $dpseries: git rm $dpseries" fi msg="drop cherry picks before merge from ${from_ref} at $new_upstream_ver" msg="$msg${CR}${CR}drop the following cherry picks:" for file in $drops; do git rm "$file" || fail "failed to git rm $file" msg="${msg}$CR $file" done git commit -m "$msg" "$dpseries" $drops fi fi git merge "${from_ref}" -m "merge from $from_ref at $new_upstream_ver" || fail "failed: git merge ${from_ref} -m 'merge from $from_ref ..'" clog="${TEMP_D}/changelog" gitlog="${TEMP_D}/gitlog" git log --first-parent --no-decorate --format=full \ "${prev_pkg_hash}..${from_ref}" > "$gitlog" || fail "failed git log ${prev_pkg_hash}..${from_ref}" cat >> "$clog" <> "$clog" || fail "failed git_log_to_dch" cat >> "$clog" < $(date -R) EOF cat "$clog" "debian/changelog" > "$TEMP_D/newlog" && cp "$TEMP_D/newlog" "debian/changelog" || fail "failed replacing debian/changelog" dch -e || fail "dch -e exited $?" git diff echo -n "Commit this change? (Y/n): " read answer || fail "failed to read answer" case "$answer" in n|[Nn][oO]) exit 1;; esac msg="update changelog (new upstream snapshot $new_upstream_ver)." git commit -m "$msg" debian/changelog || fail "failed to commit '$msg'"