rss

categories

tags

Bazaar Part 1: Basics

Ok, this is going to be nothing new for those of you who have gone through the 5 minute tutorial on the bzr website. I’m going through it again here, so the rest of this follows. First, I created a directory like this:

% ls -R myProject
0 myDir/ 8 test1.txt 8 test2.txt 8 test3.txt
myProject/myDir:
total 0
0 test4.txt

All of the .txt files have the line “Initial Content” in them. Once this was setup, I did the following:

put myProject under management.

[andrew karma] /Users/andrew/Development/BZR/myProject
>>>>>> bzr init
Created a standalone tree (format: pack-0.92)

add the files in myProject to bzr

[andrew karma] /Users/andrew/Development/BZR/myProject
>>>>>> bzr add
adding myDir
adding test1.txt
adding test2.txt
adding test3.txt
adding myDir/test4.txt

finally, commit

[andrew karma] /Users/andrew/Development/BZR/myProject
>>>>>> bzr commit -m “First Commit”
Committing to: /Users/andrew/Development/BZR/myProject/
added myDir
added test1.txt
added test2.txt
added test3.txt
added myDir/test4.txt
Committed revision 1.

At this point, we can files in this directory, commit, revert, do all of the fun stuff you can do with version control. However, I don’t really care about what I can do in this directory. What I care
about is how to share this stuff. I’m going to start off by using the local directory created above as my source. Remember, any place I use /Users/andrew/Development/BZR/myProject, you could just as easily be using SFTP, FTP, or other protocols described here.

So, what can we do with this thing we created? Well, if you’re a CVS user the following should look very familiar.

[andrew karma] /Users/andrew/tmp
>>>>>> bzr checkout ~/Development/BZR/myProject
[andrew karma] /Users/andrew/tmp
>>>>>> ls
total 0
0 myProject/

We’ve just checked out myProject. Lets see what happens when we edit files here.

Modify test1.txt in the checkout and check the status of this checkout.

[andrew karma] /Users/andrew/tmp/myProject
>>>>>> echo “Line added from a checkout” >> test1.txt
[andrew karma] /Users/andrew/tmp/myProject
>>>>>> bzr status
modified:
test1.txt

Now, while in the checkout, we’ll do a commit. Then, check the contents of test1.txt in the “head” area.

[andrew karma] /Users/andrew/tmp/myProject
>>>>>> bzr commit -m “Modified test1.txt in the checkout”
Committing to: /Users/andrew/Development/BZR/myProject/
modified test1.txt
Committed revision 2.

Now, let’s check out what’s going on in the “head” area.

[andrew karma] /Users/andrew/Development/BZR/myProject
>>>>>> cat test1.txt
Initial Content

Huh, I thought we updated this, let’s try something shall we?

[andrew karma] /Users/andrew/Development/BZR/myProject
>>>>>> bzr update
M test1.txt
All changes applied successfully.
Updated to revision 2.

[andrew karma] /Users/andrew/Development/BZR/myProject
>>>>>> cat test1.txt
Initial Content
Line added from a checkout

Now, that’s what I expected to see. I think this clarifies some things for me. Here are the conclusions I think I can draw from this. I’m still not entirely sure, but based on my reading, and what I’m seeing in the examples above:

  • myProject contains the repository and the working-tree
  • I think, the working-tree is just the files
  • The .bzr directory is where all of the content is actually stored.

I know that none of this is magic. Just sort of proving that bzr add, bzr checkout, bzr status, and bzr commit, do largely what they do in CVS. Next post we’ll start looking at branching.

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>