| 1 | #!/bin/sh |
| 2 | set -e |
| 3 | |
| 4 | # stg-swallow - completely merge an unapplied patch into current one |
| 5 | |
| 6 | # Copyright (c) 2006-2007 Yann Dirson <ydirson@altern.org> |
| 7 | # Subject to the GNU GPL, version 2. |
| 8 | |
| 9 | # FIXME: |
| 10 | # - should provide support for conflict solving ? |
| 11 | |
| 12 | [ "$#" = 1 ] || { echo >&2 "Usage: $(basename $0) <patch>"; exit 1; } |
| 13 | patch="$1" |
| 14 | |
| 15 | stg pick --fold "$patch" |
| 16 | stg refresh |
| 17 | stg push "$patch" |
| 18 | |
| 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" |