Getting Mercurial to Ignore Stuff

Posted by John
on Saturday, 15 November 2008

Mercurial

Simple to do, first make your .hgignore file:

gedit .hgignore

Add to this some basic syntax

syntax: glob
*.obj
*.exe
*.avi
*.swf
public/videos/*

(basically here you're telling mercurial what file extensions and directories to ignore in your app's root directory)

Save & close the file, now when you do hg add . and hg commit it'll skip these files & directories and keep your repository clean storing only the things you need to worry about; the code.

GIT Distributed Version Control

Posted by John
on Monday, 12 May 2008
Install
sudo aptitude install git-core
Basic Commands
git init                   ...init repository
git add .                  ...add everything in dir to repository
git commit -a -m 'update'  ...add + commit changes
git diff                   ...show changes since last commit

git add [file]             ...add file
git rm [file]              ...remove file
git mv [file]              ...move file
Mirror Git Repository
rsync -azvCL --delete --progress 
   -e "ssh -i /home/[user]/.ssh/[mykey]" .git/* 
[user]@[user].strongspace.com:/home/[user]/[project]/.git/
Ignore Whitespace
git-apply --whitespace=nowarn

Installing SVN via MacPorts

Posted by John
on Wednesday, 23 January 2008

Following on from my previous article concerning using MacPorts to install system software easily on your Mac, in this article I'll guide you thru install Subversion and all it's dependencies under Apple's Leopard O/S.

Update MacPorts

First off you don't have to install MacPorts with Leopard as it comes pre-installed, but you do need to update it.

So in Terminal run...

sudo port -v selfupdate

Perfect that should update the stock 1.5 build to the latest 1.6 release.

SVN Dependencies

Now to installing Subversion's dependencies, without these Subversion will not build. So in Terminal run...

sudo port install sqlite3
sudo port install apr-util
sudo port install neon

Excellent, you should now be ready to install Subversion 1.4.6 from source via MacPorts

Finally Subversion

Just run...

sudo port install subversion

Should install ok leaving you with the latest binary build of Subversion on your Apple machine.

What about a GUI ?

Ok, as most people don't really like using SVN from the command-line, you can download a mac gui interface to it at...

More MacPorts are available at...

Handy Tip

Before I go you can find out the location of a piece of software via the 'which' command.

which svn

Should return the path where it's installed.

Remove .SVN directories

Posted by John
on Monday, 17 December 2007

Quick little command, run this inside a directory to remove any .svn directories within it recursively.

find . -name .svn -print0 | xargs -0 rm -rf

Thanks goes to Sitening

Tuning your SVN Deployment

Posted by John
on Thursday, 23 August 2007

One of the problems you may run into with a project that has been deployed with SVN is choosing what it should ignore so that the production app does not fall over itself.

E.g. accidentally putting log files under version control and then deploying them to the server knowing your box will alter these over time.

So how can you get around this, pretty simple really; but first off try the following commands...

Reverting a Directory

svn revert log/*

This basically tells svn to revert everything in the log directory to it's previous state.

Ignoring .log files

svn propset svn:ignore ".log" log

This tells svn to ignore any .log files within the log directory, so the log files generated on your production box aren't the ones from your laptop.

Ignoring mongrel .pid's

svn propset svn:ignore ".pid" pid

This like the command above will ignore the .pid files generated on your laptop, not taking these to your production box.

Ignoring the contents of a Directory

To go one step more, how about when you want the entire contents of a directory ignored from SVN. So say the photos generated on your production box don't get overwritten from your development laptop.

svn propset svn:ignore '*' photo

Enjoy,