1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,97 +0,0 @@ |
1 |
-#!/usr/bin/env bash |
|
2 |
- |
|
3 |
-# This script should be run after cloning, it will update the remote |
|
4 |
-# information so that git svn commands work properly for both the master and |
|
5 |
-# release branches. |
|
6 |
- |
|
7 |
-set -eou pipefail |
|
8 |
-IFS=$'\n\t' |
|
9 |
- |
|
10 |
-set +u |
|
11 |
-package=$1 |
|
12 |
- |
|
13 |
-# otherwise use the default repo name |
|
14 |
-if [ -z "$package" ];then |
|
15 |
- package=$(git remote -v | perl -ne 'if (m!/([^/]+?)(?:.git)?\s!) { print $1; exit}') |
|
16 |
-fi |
|
17 |
-set -u |
|
18 |
- |
|
19 |
-base_url="https://hedgehog.fhcrc.org/bioconductor/" |
|
20 |
- |
|
21 |
-is_mirror_clone () { |
|
22 |
- git remote show origin | grep -i -q bioconductor-mirror |
|
23 |
- return $? |
|
24 |
-} |
|
25 |
- |
|
26 |
-add_release_tracking () { |
|
27 |
- local branch=$1 |
|
28 |
- shift |
|
29 |
- local remote=$1 |
|
30 |
- shift |
|
31 |
- for release_branch in $@; do |
|
32 |
- svn_branch=$(echo $release_branch | perl -ne 'if (/release-(\d+)\.(\d+)/) { print "RELEASE_$1_$2"; }') |
|
33 |
- svn_url="$base_url/branches/$svn_branch/madman/Rpacks/$package" |
|
34 |
- git config --add svn-remote.$release_branch.url $svn_url |
|
35 |
- git config --add svn-remote.$release_branch.fetch :refs/remotes/git-svn-$release_branch |
|
36 |
- git update-ref refs/remotes/git-svn-$release_branch refs/$remote/$release_branch |
|
37 |
- done |
|
38 |
-} |
|
39 |
- |
|
40 |
-add_branch () { |
|
41 |
- set +eu |
|
42 |
- local local_branch=$1 |
|
43 |
- local remote_branch=${2-$local_branch} |
|
44 |
- if ! git branch --track $local_branch bioc/$remote_branch 2>/dev/null 1>&2; then |
|
45 |
- 1>&2 cat <<END |
|
46 |
-$local_branch already exists, create a custom branch to track bioc/$remote_branch with |
|
47 |
- \`git branch --track NEW_NAME bioc/$remote_branch\` |
|
48 |
-END |
|
49 |
- fi |
|
50 |
-} |
|
51 |
- |
|
52 |
-if is_mirror_clone; then |
|
53 |
- git checkout master |
|
54 |
- git svn init "$base_url/trunk/madman/Rpacks/$package" |
|
55 |
- git update-ref refs/remotes/git-svn refs/remotes/origin/master |
|
56 |
- git svn rebase |
|
57 |
- git remote add bioc https://github.com/Bioconductor-mirror/${package}.git |
|
58 |
- git fetch bioc 2>/dev/null 1>&2 |
|
59 |
- |
|
60 |
- release_branches=$(git branch -r | perl -ne 'if (m!origin/(release-.*)!) { print $1, "\n" }') |
|
61 |
- for release_branch in ${release_branches[@]}; do |
|
62 |
- add_branch $release_branch |
|
63 |
- done |
|
64 |
- |
|
65 |
- add_release_tracking origin heads $release_branches |
|
66 |
- |
|
67 |
- cat <<\END |
|
68 |
-Commit to git as normal, when you want to push your commits to svn |
|
69 |
- 1. `git svn rebase` to get the latest SVN changes. |
|
70 |
- 2. `git svn dcommit --add-author-from` to commit your changes to SVN. |
|
71 |
-END |
|
72 |
- |
|
73 |
-else |
|
74 |
- git remote add bioc "https://github.com/Bioconductor-mirror/${package}.git" |
|
75 |
- git fetch bioc 2>/dev/null 1>&2 |
|
76 |
- git config --add svn-remote.devel.url "$base_url/trunk/madman/Rpacks/$package" |
|
77 |
- git config --add svn-remote.devel.fetch :refs/remotes/git-svn-devel |
|
78 |
- git update-ref refs/remotes/git-svn-devel refs/remotes/bioc/master |
|
79 |
- |
|
80 |
- release_branches=$(git branch -r | perl -ne 'if (m!bioc/(release-.*)!) { print $1, "\n" }') |
|
81 |
- add_release_tracking bioc remotes/bioc $release_branches |
|
82 |
- |
|
83 |
- for release_branch in ${release_branches[@]}; do |
|
84 |
- add_branch $release_branch |
|
85 |
- done |
|
86 |
- add_branch devel master |
|
87 |
- cat <<\END |
|
88 |
-Commit to git as normal, when you want to push your commits to svn |
|
89 |
- 1. `git checkout devel` to switch to the devel branch. (use release-X.X for |
|
90 |
- release branches) |
|
91 |
- 2. `git svn rebase` to get the latest SVN changes. |
|
92 |
- 3. `git merge master --log` to merge your changes from the master branch |
|
93 |
- or skip this step and work directly on the current branch. |
|
94 |
- 4. `git svn dcommit --add-author-from` to sync and commit |
|
95 |
- your changes to svn. |
|
96 |
-END |
|
97 |
-fi |