Changeset View
Changeset View
Standalone View
Standalone View
copy-branch.sh.in
- This file was added.
Property | Old Value | New Value |
---|---|---|
File Mode | null | 100755 |
1 | #!/bin/bash | ||||
---|---|---|---|---|---|
2 | | ||||
3 | # public domain | ||||
4 | # | ||||
5 | # template for script for copying private branches over from kdevplatform repo to kdevelop repo | ||||
6 | | ||||
7 | # variables which need adapting: | ||||
8 | KDEVPLATFORM_DIR=/path/to/kdevplatform | ||||
9 | KDEVELOP_DIR=/path/to/kdevelop | ||||
10 | PATCHESBASE_DIR=/tmp/kdevplatform-transfer-patches | ||||
11 | | ||||
12 | | ||||
13 | if [ "$1" == "" ]; then | ||||
14 | echo "Please pass a branch as argument." | ||||
15 | exit 1 | ||||
16 | fi | ||||
17 | | ||||
18 | # commit which is last of merged ones | ||||
19 | KDEVPLATFORM_BASECOMMIT=9362447d74c81babdd8619f52435a3cadff49521 | ||||
20 | BRANCH=$1 | ||||
21 | PATCHES_DIR="$PATCHESBASE_DIR/$BRANCH" | ||||
22 | | ||||
23 | if [ -e "$PATCHES_DIR" ]; then | ||||
24 | echo "Directory $PATCHES_DIR already exists, please remove." | ||||
25 | exit 1 | ||||
26 | fi | ||||
27 | | ||||
28 | mkdir -p "$PATCHES_DIR" || exit 1 | ||||
29 | | ||||
30 | cd "$KDEVPLATFORM_DIR" | ||||
31 | | ||||
32 | echo "Rebasing '$BRANCH' to merged commit from master in kdevplatform..." | ||||
33 | git rebase $KDEVPLATFORM_BASECOMMIT $BRANCH || exit 1 | ||||
34 | | ||||
35 | echo "Creating patches of branch '$BRANCH' against 'master' in kdevplatform..." | ||||
36 | git format-patch $KDEVPLATFORM_BASECOMMIT...$BRANCH -o "$PATCHES_DIR" || exit 1 | ||||
37 | | ||||
38 | cd "$KDEVELOP_DIR" | ||||
39 | | ||||
40 | echo "Creating branch '$BRANCH' in kdevelop, based on 'master'..." | ||||
41 | # for something close to last kdevplatform master | ||||
42 | git checkout -b $BRANCH 391e53faef2fba25abbd36da7d81596cb027e3fc || exit 1 | ||||
43 | | ||||
44 | if [ "$?" != 0 ]; then | ||||
45 | echo "Could not create branch '$BRANCH'." | ||||
46 | exit 1 | ||||
47 | fi | ||||
48 | | ||||
49 | echo "Applying patches for branch '$BRANCH' in kdevelop..." | ||||
50 | git am --directory=kdevplatform "$PATCHES_DIR"/* || exit 1 | ||||
51 | | ||||
52 | if [ "$?" != 0 ]; then | ||||
53 | exit 1 | ||||
54 | fi | ||||
55 | | ||||
56 | echo "Rebasing '$BRANCH' to master in kdevelop..." | ||||
57 | git rebase master $BRANCH || exit 1 |