Tags
webcam vindaloo vim version vegan unix unicef trojan todo tmux thinkpad textmate testing tagging syntax svn sugar subversion stubbing sphinx spam spaces solaris sitemap site sinatra shoulda sheet set security search schema_info SchemaInfo ruby rinari restaurant relationships refresh rdiff-backup ramaze railsconf08 railsconf07 rails protools production power placeboeffect pink floyd PIC perl overheat outbreak osx os x NYHS NYC nginx netbeans nested nanophotonics mysql music MPEG-4 mongrel model migration microvolunteer macbook mac logrotate logic log linux less leopard keynote JAX javascript java jacksonville iterm2 iterm imunizator highlighting hanna Handbrake haml hacks google geocoding genghistron gem gaming gabrielle's funny functional fun friends food fixesThe Decider said over 6 years ago permalink Comment? (0)
Tagged: svn cheat sheet
Making svn easier to use
As one of my UF professors use to say:
It’s known to those who know it
If you don’t use svnmerge.py you are really hurting yourself when doing branches with svn. Here’s my complete svn cheat sheet. The branching and merging stuff is at the bottom. Of course, substitute your URL for the svn+ssh://example.com/ in the examples.
Checking out
svn co svn+ssh://example.com/path/to/svnrepos/surveil surveil_local
Updating your local copy
cd surveil_local; svn up
See all codes at the bottom of this page
Status
svn stShow the status of your local copy vs the last time you updated. No network access.svn st -uDisplays update information from the repos. Uses the network- See all codes at the bottom of this page
Dealing with conflicts
Look for the ‘C’
svn up will display a C in the update status of a file if it finds a conflict. Use svn status -u to look for these problems before they occur.
Steps to resolve the conflict
- cd to the dir of the conflicted file
- There should be at least 4 copies of it listed as:
- .mine – file in your local as it existed before
svn up - .old_ref – file from last
svn up - .new_rev – file from this
svn up - .normal_extension – merged file with conflict “tags”
- Merge the conflicts by hand, meaning: Edit the .normal_extension file or copy one of the versions over this file. You’ll have to decide.
svn resolved my_file.normal_extensionsvn ci -m 'Conflics resolved! This version is great.' my_file.normal_extension
Status Codes
The first six columns in the output are each one character wide:
First column: Says if item was added, deleted, or otherwise changed
- ’ ’ no modifications
- ‘A’ Added
- ‘C’ Conflicted
- ‘D’ Deleted
- ‘I’ Ignored
- ‘M’ Modified
- ‘R’ Replaced
- ‘X’ item is unversioned, but is used by an externals definition
- ‘?’ item is not under version control
- ‘!’ item is missing (removed by non-svn command) or incomplete
- ‘~’ versioned item obstructed by some item of a different kind
Second column: Modifications of a file’s or directory’s properties
- ’ ’ no modifications
- ‘C’ Conflicted
- ‘M’ Modified
Third column: Whether the working copy directory is locked
- ’ ’ not locked
- ‘L’ locked
Fourth column: Scheduled commit will contain addition-with-history
- ’ ’ no history scheduled with commit
- ‘+’ history scheduled with commit
Fifth column: Whether the item is switched relative to its parent
- ’ ’ normal
- ‘S’ switched
Sixth column: Repository lock token
(without -u)
- ’ ’ no lock token
- ‘K’ lock token present
(with -u)
- ’ ’ not locked in repository, no lock token
- ‘K’ locked in repository, lock toKen present
- ‘O’ locked in repository, lock token in some Other working copy
- ‘T’ locked in repository, lock token present but sTolen
- ‘B’ not locked in repository, lock token present but Broken
The out-of-date information appears in the eighth column (with -u):
- ‘*’ a newer revision exists on the server
- ’ ’ the working copy is up to date
Remaining fields are variable width and delimited by spaces:
- The working revision (with -u or -v)
- The last committed revision and last committed author (with -v)
- The working copy path is always the final field, so it can
include spaces.
#
Ignoring files in a directory, like log/
We don’t want our log files versioned, so let’s remove them from SVN and tell SVN to ignore them in the future. You could also ignore the database.yml file, but I never do since I always mimic my development environment’s settings when I work from various machines (i.e. I use the same MySQL login and password from machine to machine).
svn remove log/*svn propset svn:ignore "*.*" log/svn ci -m "removing log files and ignoring them in the future"svn up
Branches
Be sure to read the svn-book about branches and merging! This is just a tribute…
Extra software to make things easier, http://www.orcaware.com/svn/wiki/Svnmerge.py
This software will make sure you don’t merge revisions twice.
Creating
- just copy trunk to a branch of your choice
svn copy svn+ssh://example.com/path/to/svnrepos/surveil/trunk svn+ssh://example.com/path/to/svnrepos/surveil/branches/my_new_branch -m "I just created my own personal branch from the trunk" - checkout your new branch:
svn co svn+ssh://example.com/path/to/svnrepos/branches/my_new_branch local_path_to_branch cd local_path_to_branch- Use the svnmerge software
svnmerge.py init svn ci -F svnmerge-commit-message.txtrm svnmerge-commit-message.txt
Keeping up-to-date with the trunk
- Make your changes to the branch
- Every now and then see what updates are available from the trunk:
svnmerge.py avail - Update your branch from the trunk:
svnmerge.py merge - Resolve any conflicts!
- @svn ci -F svnmerge-commit-message.txt # Check in the trunk merges: @
rm svnmerge-commit-message.txt- goto step 1.
Merging your branch back to the Trunk
- Find out in what change set revision your branch was created
cd local_path_to_branchsvn log --stop-on-copy(the oldest entry is the revision you are looking for, assume for the example it is 12345)
- (Temporarily) initialize merge tracking on the trunk, for your branch
cd trunk-working-copysvnmerge.py init -r1-12345 svn+ssh://example.com/path/to/svnrepos/branches/my_new_branch
- Perform the actual merge
svnmerge.py merge -bF
- Resolve any conflicts…
- edit
svnmerge-commit-message.txtto say what functionality you are merging into the trunk… - Commit the merge, but discard the changes made to the
svnmerge-integratedproperty on /trunksvn propdel svnmerge-integrated .svn commit -F svnmerge-commit-message.txtrm svnmerge-commit-message.txt
- Remove your branch
svn rm svn+ssh://example.com/path/to/svnrepos/branches/my_new_branch- Done