Support #4136
closedSwitch from svn to git
Added by Sargis Dallakyan over 8 years ago. Updated almost 8 years ago.
0%
Description
Planning to switch from svn to git before Appion hackathon.
Updated by Sargis Dallakyan over 8 years ago
We have many servers and two clusters that are doing nightly update through svn. Appion/Leginon wiki pages and autoinstaller are also using svn.
Found this interesting post and presentation on Git and Subversion - http://www.tfnico.com/presentations/git-and-subversion
We'll probably be living with Git and Subversion in parallel before we can leave SVN behind.
Updated by Neil Voss over 8 years ago
Does any one know how the revision numbers will work in redmine after the switch. Git uses hexadecimal hash tags for commits (e.g., a768bce98dedcde45d645ca). I guess redmine will house the main repo, so it will have commit numbers, like r19767.
Updated by Sargis Dallakyan over 8 years ago
Neil Voss wrote:
Does any one know how the revision numbers will work in redmine after the switch. Git uses hexadecimal hash tags for commits (e.g., a768bce98dedcde45d645ca). I guess redmine will house the main repo, so it will have commit numbers, like r19767.
According to http://www.redmine.org/boards/2/topics/15536?r=21988 "Link to a changeset with a non-numeric hash: commit:c6f4d0fd (displays c6f4d0fd)."
I've setup a private git repo for spotiton at http://emg.nysbc.org/projects/spottion/repository and I can confirm this.
Redmine git integration also requires that redmine project name and git repository name to be the same. We'll need to name the git repository either appion or leginon or create a new redmine project with a different name.
Updated by Anchi Cheng over 8 years ago
We can create myami as project name and put leginon and appion as sub project if needed. Will that work ?
Updated by Sargis Dallakyan over 8 years ago
Sounds good. I've gone through the steps mentioned at http://john.albin.net/git/convert-subversion-to-git and created a sample git repo on emg server:
pwd=/srv/git git svn clone http://emg.nysbc.org/svn/myami --no-metadata -A authors-transform.txt --stdlayout appion #this took about 1 hour! git init --bare myami.git cd myami.git/ git symbolic-ref HEAD refs/heads/trunk cd ../appion/ git remote add bare ../myami.git/ git config remote.bare.push 'refs/remotes/*:refs/heads/*' git push bare
I've configured Appion project setting on Redmine and added this Git repository - http://emg.nysbc.org/projects/appion/repository/26
Redmine also allows to select or update the Redmine user mapped to each username found in the repository log.
In the week of 3DEM GRC, I'll make the svn read only, redo the steps to get the latest svn commits, and then we will begin phasing out svn and start using git.
Updated by Sargis Dallakyan over 8 years ago
Made the switch from svn to git. To clone the new git repository run:
git clone http://$user@emg.nysbc.org/git/myami
where $user is your redmine user name. Use your redmine password when it prompts for a password. I had to create http://emg.nysbc.org/projects/myami/ and add members there since the git repository name needs to match redmine identifier as discussed at http://www.redmine.org/boards/2/topics/15962
The svn repository is now read only. I'll remove svn repository from redmine later on to avoid duplicate entries in the search result.
Still need to work out some issues:
- Anonymous or public access to git is not working. In other words
git clone http://emg.nysbc.org/git/myami
without $user is not working. - The main repository at http://emg.nysbc.org/projects/appion/repository shows @ trunk only, but not the branches.
Updated by Sargis Dallakyan over 8 years ago
I see that there is a drop-down menu next to Statistics | Branch at http://emg.nysbc.org/projects/appion/repository
git svn clone kept the info about branches and we can nicely see the branches with redmine using this drop-down menu.
Updated by Anchi Cheng over 8 years ago
tried on my Mac
git clone http://$user@emg.nysbc.org/git/myami/ git-trunk Cloning into 'git-trunk'... Password for 'http://emg.nysbc.org': error: RPC failed; result=22, HTTP code = 500 fatal: The remote end hung up unexpectedly
git-trunk is a subdirectory I hope to put the sandbox in.
Updated by Sargis Dallakyan over 8 years ago
Anchi Cheng wrote:
tried on my Mac
git clone http://$user@emg.nysbc.org/git/myami/ git-trunk
[...]git-trunk is a subdirectory I hope to put the sandbox in.
Try git clone http://acheng@emg.nysbc.org/git/myami/ git-trunk
instead.
I'm thinking that github might work better out of box compared to redmine/git since github is more widely used and it's better documented.
Updated by Anchi Cheng over 8 years ago
as long as we can link redmine issue, I am fine either way. redmine one might have one advantage: It probably log who has cloned the repository then we can report that in our grant annual report.
Updated by Sargis Dallakyan over 8 years ago
- Status changed from New to Assigned
Managed to get public access to git working thanks to this post http://www.redmine.org/boards/2/topics/22498
To clone the git repo run the following command:
git clone http://emg.nysbc.org/git/myami.git
Use your redmine username and password to commit changes back.
Only members of the following project are supposed to be able to commit - http://emg.nysbc.org/projects/myami
To do list for the new release:- Change autoinstaller to use git instead of svn.
- Change install instructions on the wiki from svn to git.
Updated by Carl Negro over 8 years ago
I merged changes to a git branch for the first time (yay) today using the following commands:
git clone -b myami-beta http://cnegro@emg.nysbc.org/git/myami/ myami-beta-git git cherry-pick 314ffaf8 git commit -m "merge myami-trunk to myami-beta, r 314ffaf8, refs #4303" git push
Where 314ffaf8 is a single revision to merge, myami-beta is the branch, and myami-beta-git is the destination folder. No need to specify the source branch, just the correct revision hash. Still have to test doing a range or multiple revisions.
Updated by Neil Voss over 8 years ago
So as outside users, we are just supposed to push our commits to the "trunk" that we check out from:
git clone http://emg.nysbc.org/git/myami.git
Do you want us to push small bug fixes (no major changes) to myami-beta? Or is it best to email Anchi or Carl to do so?
Updated by Anchi Cheng over 8 years ago
I tried to push my cherry-picked version with the public accessed clone but that does not work. Maybe do need to the user specific one if want to commit ?
Updated by Carl Negro over 8 years ago
I think that is probably right. Sargis said only redmine users who are part of the myami project can commit, the user-specific trunk/branch must be how it checks access.
Updated by Anchi Cheng over 8 years ago
Neil,
If you see minor bug fix, and absolutely sure it does not break other functions, you can merge the change in myami-beta as I found that cherry-pick with multiple version does not work easily, but keep in mind that myami-beta is our production branch at SEMC that is daily updated to user level and lack some earlier revisions. Please do not add things that involve unmerged early major change. At some point, we will branch myami-beta from trunk again to absorb all newer changes.
Updated by Neil Voss over 8 years ago
Hi Anchi,
I see thanks. So, I think it is only appropriate for me to cherry-pick fixes to the beta branch when fixing a bug report from one of the NYSBC users, otherwise it can wait for the re-branching.
Updated by Anchi Cheng over 8 years ago
Found a way to merge all changes in one subdirectory such as leginon from trunk to myami-beta as a single commit. Hope I have not done anything bad.
git clone -b myami-beta http://$user@emg.nysbc.org/git/myami cd myami git checkout origin/trunk leginon git commit git push
The -b flag seemed to keep the checkout HEAD attached to myami-beta which makes the thing a lot simpler.
Updated by Sargis Dallakyan over 8 years ago
- Related to Task #4346: support git for myami installation and upgrade added
Updated by Sargis Dallakyan over 8 years ago
- Status changed from Assigned to Closed
Updated by Anchi Cheng over 8 years ago
Show difference between origin/trunk with the locally commit (not yet pushed) change where local addition shows as +
git diff origin/trunk HEAD
Updated by Philip Baldwin about 8 years ago
Found sort of a nice "simple git guide". http://rogerdudler.gihub.io/git-guide/
Updated by Neil Voss almost 8 years ago
Use
git config --global branch.autosetuprebase always
wanted to document it here.
Updated by Sargis Dallakyan almost 8 years ago
- Related to Bug #4771: unable to update local ref after git forced update added