Tuesday, 17 March 2009

Bazaar seems to do the job

Today I 'ave mainly been thinking about ... keeping my code under version control (again).

I have been using Bazaar for the last week or so and it just works. I started a new project and moved files around as I created and refactored. So for now its Bazaar for me. Its pity I would have to move away from google code (here) to here. But for now I will just continue to use it locally. These are my most used commands:




bzr whoami "Bob Smith bob@smith.com"
bzr whoami

bzr init # create a new repo in current folder
bzr add
bzr log
bzr status
bzr diff
bzr ignored
bzr rm file.py
bzr revert file.py
bzr rm -keep file.py
bzr commit -m 'story'
bzr mv folder newfolder
bzr mv file.py newfolder/


Monday, 16 March 2009

Spotify

Today I 'ave mainly been thinking about .. spotify. .... Following the advice of Mac User, I created an account, here, downloaded the spotify application and have been listening to all kinds of music.... Free.

To be honest the choice of music is immense and it is an odd experience being able to listen to almost any music you choose. The package is meant to include adverts but I did not notice any.

So my next plan is to make a few eclectic playlists and get my laptop hooked up to my Hi-Fi. The ultimate iPod collection.. Did I say it was Free?

Thursday, 12 March 2009

More ways to code in blogs

Today I 'ave mainly been tinking about different ways to publish code in blogs. This is an example produced using Pygments.



class Thingy(object):
pass



Now this is perhaps a better way to do it. I like this because it does not require me to edit my blog html. On the downside I have to have all my snippets on my laptop. Perhaps not a bad thing?

First get pygments:


easy_install Pygments


Then generate the html with all the style inline


pygmentize -f html -O noclasses=true code_example1.py


Then paste into the Edit Html view

Wednesday, 11 March 2009

Adding code to my blog


Today I 'ave mainly been thinking about... how I can include code in my blog. For example I would like to include some code here:




class Thing(object):
pass




And then add more words here...



To get this to work I edited my blogger site html to add 2 lines after head to include prettify.css and prettify.js from google code. I also had to call onload in the body tag. This is described here and I looked here at the source to see how it worked in practice. You can just look at the source of this page. I hope one day blogger will have a nice code button in the Compose window. 




def func(param):
pass




Looks like I will have to alter my colour scheme!

Tuesday, 10 March 2009

Now I am confused its Bazzar

Today I 'ave mainly been thinking about DVCS again. I was getting ready to continue the story of Bob and Alice with Mercurial when I found several articles claiming that Bazzar was the new svn. So instead of helping Bob and Alice get their work done... I read enough about Bazaar to get my subversion library into bazaar.

My main problem was finding the right bit of documentation. In the end it was very simple:

bzr branch http://mysite/svn/trunk

It only took a few seconds and I seem to have all my files and history. (Much faster than Mercurial)

So maybe Bob and Alice will try out bzr later.

Monday, 9 March 2009

Mercurial for a small project

Today I 'ave been mainly thinking about ... how to use Mercurial for a small team.

Start from repository main (created from existing svn).

Create 2 clones one for each person on the team.

 hg clone main bob
 hg clone main alice

(good old Bob and Alice)

Bob does a few changes 

 vi
 hg status
 hg diff
 hg commit

Alice does a few more changes including an odd one in a file changed by Bob
 
 emacs
 hg diff
 hg status
 hg commit

What will Bob do next? ...anyway I am off to the pub.



Sunday, 8 March 2009

Mercurial?

My first attempt at blogging... here goes.

In case anyone is interested, the title is a catch phrase from a character Jesse in the Fast Show (UK TV Comedy).

Today I 'ave mainly been thinking about ... the options available for sharing source files.

Over the years I have used DEC CMS, *nix RCS, CVS and most recently SVN.

I am aware that there are several alternatives available, and today I have invested some time looking at Mercurial as an alternative to svn

 On the whole I like svn but I have had problems when I have attempted to move files around (re-factoring often causes this), especially renaming folders seems to cause me a bit of trouble when I come to commit. 

I have also noticed that the Python community are considering the options to move away from subversion. See python PEP 374.

Here are my early thoughts.

Getting a svn repository and converting it to Mercurial went very smoothly. I had 2 attempts: First I let it get all revisions. Even for a smallish library it took quite a time to construct the new repository. On my second attempt I only asked for the last 3 revisions and this was much quicker.

Now I have just got to get into the Mercurial mindset and find an appropriate work flow.

One barrier to use may be finding a place to host my Mercurial repository.

More later.