chiark / gitweb /
Recognize refs under remotes/ as parent branch on stack creation.
[stgit] / contrib / stg-k
CommitLineData
22584709
YD
1#!/bin/sh
2set -e
3
4# stg-k - execute given StGIT command while preserving local changes
5
6# Uses a temporary patch to save local changes, then execute the given
7# command, and restore local changes from the saved patch. In
8# essence, "stg-k pop" is a "stg pop -k" that works better, hence its
9# name.
10
11# CAVEAT: this script relies on the operation to run ignoring hidden
12# patches, so in 0.12 (where "stg push" can push an hidden patch)
13# "stg-k push" will fail midway, albeit with no information loss -
14# you'll just have to finish manually. Luckilly this appears to work
15# on master branch.
16
17# Copyright (c) 2007 Yann Dirson <ydirson@altern.org>
18# Subject to the GNU GPL, version 2.
19
20stg new __local -m " - local changes (internal patch)"
21stg refresh
22stg pop
23
24# avoid bad interactions like "stg-k push" not behaving as expected
25stg hide __local
26
27stg "$@"
28
29stg unhide __local
30
31stg push __local
32stg-unnew