Posts Tagged ‘subversion’
All posts tagged subversion.
If you are a web or application developer, there will come a time (hopefully) that you will need to use subversion for your projects. While I use the command line for this – there are some GUI applications that make it easy for people to manage their files using subversion. For this documentation, I have chosen to write about RapidSVN because it runs on both Mac and PC.
ONE TIME PROCESS
- Download the RapidSVN you will use to check in and check out files at: http://www.rapidsvn.org/download/release/0.9.6/. For Mac users – download the .dmg gile. For PC users, download the .exe file
- Install the applications on your computer.
- Check out the files that you want to edit. Go to the “Repository” menu and select “checkout”.
- Enter in the URL of the repository where the files are currently located. (http://www.example.com/svn/yourfiles)
- Choose where you want these files on your to be downloaded to on your computer (destination directory)
- Use the latest revision (unless you have a reason to choose something else)
- Do not worry about “Peg Revision” – Click the “Ok” button
- You will be prompted for a user name and password – those are for the repository. Enter in the information and your files will then be downloaded to your computer.
AFTER YOU HAVE INITIALLY CHECKED OUT THE FILES AND ARE READY TO MODIFY THEM
- Make changes to the existing files as needed. Once you are done, click on the icon for “Commit Change”. (Look for the up orange arrow).
- Enter in some documentation of the change. (Ex: I changed the CSS so that the navigation now works in IE 6)
- Click the “OK” button and your changes are now made to the files in the repository.
ADD NEW FILES
- Add the new files/folders to your local (on your desktop) copy of the files.
- Within RapidSVN – Click on the bookmark you want to work with on the left side of the window. On the right side – the files for that bookmarked repository will appear. You will see all your files – old and new.
- Highlight the new files you added and click on the “Add Selected” button.
- You will be prompted for a comment (explanation). (Ex. Added new graphic files for the header)
- Check those new files in by clicking on the “Commit Change” button. Add another comment. (Ex. Checking in the new graphic files).
DELETE EXISTING FILES
*** Regardless of what happens – DO NOT DELETE CHECKED IN FILES USING YOUR OPERATING SYSTEM’ DELETE OPTIONS (move to trash, etc). If you want to delete a file from the repository – you must use SVN. If you delete the files with your OS – you will get errors which will stop all future edits until it is remedied. You might see a folder with a name of “.” do not worry about it, remove it, or try to delete it.
*** You can only delete files that have already been checked in. If you add files, do not check them in, and want to delete them – you can use the OS to delete the files.
- Within RapidSVN – Click on the bookmark you want to work with on the left side of the window. On the right side – the files for that bookmarked repository will appear.
- Highlight the file you want to delete and click on the “Delete Selected” icon. The file will still be listed until you check in your changes.
- Check in your changes by clicking on the “Commit Change” button. Add a comment. (Ex. Removed old logo file). 4. The list of files will now be updated.
Ever delete something with svn (svn del) and then realize you needed it again? You can get it back by using:
svn copy -r HEAD filenameyoudeleted.extension filenameyoudeleted.extension
- svn copy is the command to get a working copy back
- -r is short for revision. I used HEAD which will give you the latest in repository. You can specify a revision number, revision right before you committed, etc (check out svn help copy)
- filename is what you deleted, then where it goes. I usually do something like this within the folder the file was located so you do not see any paths, but if your file was in /www/files/ you would need to specify the file path to /www/files/filnameyoudeleted.extension /www/files/filnameyoudeleted.extension
Working with SVN is a lifesaver – and this tip is gold.
Because I always forget…to change the text editor that svn uses with the commit messages, just type in this command (if you use bash):
*Substitute vi for your editor of choice.
**Personally, I once was a pico/nano fan, then I moved to emacs, and now I am a vi person.
Something that confuses a lot of people when they start using subversion is the file status. (svn st) Here is a quick list of the file status codes and what they mean:
- A File was added
- C Conflicting changes
- D File was deleted
- G File was merged
- R File was replaced
- U File was updated
- ? File is not under version control (you will need to add it)
- ! File is missing (probably was deleted using the OS or some other application and not subversion)
In order to take a look at WordPress 2.5 before it was released, I used subversion to check out the latest code available using the instructions given on the WordPress site. Once WordPress 2.5 was released, I wanted to keep my sites using 2.5 and not the bleeding edge releases (2.6) so I needed to easily switch repositories from http://svn.automattic.com/wordpress/trunk/ to http://svn.automattic.com/wordpress/branches/2.5/.
I had never had to switch repositories, so it took some reading to figure it out. For future reference, the following command works when used in the directory you have the checked out files in: “svn switch http://newrepos.com .” For my example, I ran the command: “svn switch http://svn.automattic.com/wordpress/branches/2.5/ .”
Anyone who uses subversion will need this sooner or later. Change directories to the root directory and run:
find . -name .svn -print0 | xargs -0 rm -rf. Bingo…all .svn directories are gone and you can start fresh!
There are some things I am very thankful for when I am working in PhotoShop…being able to navigate the history, the background eraser, the rounded corners tool, but there are sometimes when I fingers end up moving faster than my brain and save and close PSD files before I had the chance to undo a “merge down”. Until a few months ago, I would end up swearing at this point and have to redo parts if not all of a graphic. Now, since my development files are in subversion, I can simply open the command line and revert the file to the previous state:
svn revert /folder/filename.ext and all is ok. No swearing. Thanks subversion!
PS. I ordered DirectTV today. Bye bye Comcast!
[tags]subversion, svn revert[/tags]
After finally getting some to to set up my development environment, I began thinking…why am I not using Apache 2.2 and PHP 5.1.2? What made me think about this? “Legacy Release” The phrase “legacy release” is what httpd.apache.org described Apache 1.3.x as in their news section. I have been using Apache 1.x for several years now, only ever really thinking about migrating to 2.0 because of the need to run a subversion server. I have a solid web server solution in place that has made me very happy for the last few years using Apache 1.3.x, but it is finally time to check out something in the 2.x family, and I am going to make that 2.2. I am going to spend some time tomorrow reading about any known issues (especially with PHP, as I remember that being a show stopper for my interest in 2.0 before) and then install/configure it. Stay tuned for some tutorials on what I did to get everything up and running!
[tags]apache, php, mysql, subversion[/tags]
Today was a good day. Lots of information on how to create killer Dashboard widgets, Safari feedback session, in depth information on Color Management, Subversion for the rest of us, and then upgrading to Tiger server. I am exhausted, but learning lots of really cool technologies. I am going to start working on making my own Dashboard widget, so stay tuned. What is it going to be? That is the question. If anyone has any suggestions or can think of something they want, let me know and I will try to create it for you. I also learned of a free on-line book on subversion, so I also added that to my tech resources.
Day 3 summary: Best quote of the day in the migrating to Tiger server: “Never update a production server without a current resume.”