How to go from a git repo to svn. (update scripts)
-
Here is my story. I was happily developing my wordpress plugin, and saving it in bitbucket until I decided to let wordpress host my plugin (easy updates, how awesome?!). But i wanted to keep using git, because it is just way better. So I needed deployment script. I did some scripting and here is mine, you can use it for yourself.
I added and saved mine in my svn main folder (otherwise this script doesn’t work). it is based on powershell which their for windows. you might need to execute this command first: “Set-ExecutionPolic unrestricted“. to be able to run powershell scripts.
here it is (I called this file Update.ps1):
echo "SVN UPDATE SCRIPT" $gitFolder = "C:\Path\To\Your\Plugin" $svnUrl = "https://plugins.svn.www.ads-software.com/[svn-plugin-name]" $version = Read-Host 'Do you want to update version? Type version number (if not leave empty)' $message = Read-Host 'Commit message' if (-Not $message){ $message = "A Powershell Commit message" } Remove-Item trunk\* -recurse echo "Copying files" Copy-Item "$gitFolder\*" trunk\ -Recurse #Remove-Item trunk\.git -Recurse Remove-Item .\trunk\.idea -Recurse get-childitem .gitignore -recurse | remove-item echo "Setting up svn for commit" #Delete missing files svn status | ? { $_ -match '^!\s+(.*)' } | % { svn rm $Matches[1] } #Added new files svn status | ? { $_ -match '^\?\s+(.*)' } | % { svn add $Matches[1] } echo "Commiting to svn" svn commit -m $message if($version){ echo "Updateing to Verion $version" svn copy "$svnUrl/trunk" "$svnUrl/tags/$version" -m "$message. updated to version $version" }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to go from a git repo to svn. (update scripts)’ is closed to new replies.