An update to the github migration script.
We should definitively decide which branches to migrate over and not migrate "one-offs" or feature-branches that have long been merged into master
Corrected migration script:
BRANCHES=`git branch -r | grep -v "upstream/" | sed -e 's/^ *origin///'` for B in $BRANCHES do echo $B git checkout -t -b $B origin/$B # git push upstream $B:$B done
this fails on
+ git checkout -t -b release-3.0.1 origin/release-3.0.1 warning: refname 'origin/release-3.0.1' is ambiguous. warning: refname 'origin/release-3.0.1' is ambiguous. fatal: Ambiguous object name: 'origin/release-3.0.1'.
Probably because of
snert:/tmp/rhq hrupp$ git branch -r | grep 3.0.1 origin/origin/release-3.0.1 origin/release-3.0.1 [...]
so origin/release-3.0.1 needs to be filtered out above
After the script has run one can add the upstream remote and then push all branches at once: git push -v --all upstream
Now that this is done we can pull out the plugins
1) create the plugin repo on github 2) filter down the plugins
$ cd /tmp $ git clone /tmp/rhq rhq-plugins
run this script to "nail" the branches": BRANCHES=`git branch -r | grep -v "upstream/" | sed -e 's/^ *origin///'` for B in $BRANCHES do echo $B git branch -t $B origin/$B done
now filter down the plugins
git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter modules/plugins -- --all
Took another 10-15 mins locally
Now continue with step 5 of the git stackoverflow entry ( http://stackoverflow.com/a/359759/100957 ) , which is
$ git reset --hard $ git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d $ git reflog expire --expire=now --all $ git gc --aggressive --prune=now
And then push to GH:
$ git remote add upstream <github url> $ git push --all upstream
3) Now get rid of the plugins in the first ("main") repository
NOTE: best is to check out the main tree from github and then do this. Or make sure to remove origin from the remotes, so that this can not mess up fedorahosted (as I accidentally did)
BRANCHES=`git branch -r | grep -v "upstream/" | grep -v "origin/release-3.0.1" | sed -e 's/^ *origin///'` for B in $BRANCHES do echo $B git checkout -f $B git rm -r --cached modules/plugins git commit -m "removed plugins" done
b) Remove the origin remote $ git remote remove origin
c) Send updates to github: $git push --all upstream
d) get rid of the (now untracked) plugins $ rm -r modules/plugins
e) adjust modules/pom.xml to no longer list plugins (in all branches)
4) in rhq-plugins repository a) copy over the .mailmap file from the main repo and commit b) fix the pom.xml to use a 4.5.1 parent pom (for master at least) c) fix the dev-container relative path within the pom.xml d) add a .gitignore file
Results are at : https://github.com/pilhuhn/rhq-plugins and https://github.com/pilhuhn/rhq/tree/master/modules
NOTES: - It may make sense to populate a file with the branches to copy once and then use this subsequently $ git branch -r | grep -v "upstream/" | grep -v "origin/release-3.0.1" | sed -e 's/^ *origin///' > branch-list.txt $ vi branch-list.txt ### only leave branches in we are interested in moving over $ BRANCHES=`cat branch-list.txt`
The current list of branches is attached