blob: 924c079f678afda7b75e6a529d74e1745a7bf499 [file] [log] [blame]
#!/bin/sh
set -e
# stg-swallow - completely merge an unapplied patch into current one
# Copyright (c) 2006-2007 Yann Dirson <ydirson@altern.org>
# Subject to the GNU GPL, version 2.
# FIXME:
# - should provide support for conflict solving ?
[ "$#" = 1 ] || { echo >&2 "Usage: $(basename $0) <patch>"; exit 1; }
patch="$1"
stg pick --fold "$patch"
stg refresh
stg push "$patch"
#stg clean "$patch"
#stg pop; stg clean -u
[ $(stg id "$patch//top") != $(stg id "$patch//bottom") ] ||
{ echo >&2 "Assertion failed: patch '$patch' is not empty after swallowing, not deleting it."; exit 1; }
stg delete "$patch"