Better diagnostic for wrong branch configuration.
[stgit/ydirson.git] / contrib / stg-swallow
blob924c079f678afda7b75e6a529d74e1745a7bf499
1 #!/bin/sh
2 set -e
4 # stg-swallow - completely merge an unapplied patch into current one
6 # Copyright (c) 2006-2007 Yann Dirson <ydirson@altern.org>
7 # Subject to the GNU GPL, version 2.
9 # FIXME:
10 # - should provide support for conflict solving ?
12 [ "$#" = 1 ] || { echo >&2 "Usage: $(basename $0) <patch>"; exit 1; }
13 patch="$1"
15 stg pick --fold "$patch"
16 stg refresh
17 stg push "$patch"
19 #stg clean "$patch"
20 #stg pop; stg clean -u
21 [ $(stg id "$patch//top") != $(stg id "$patch//bottom") ] ||
22 { echo >&2 "Assertion failed: patch '$patch' is not empty after swallowing, not deleting it."; exit 1; }
23 stg delete "$patch"