May 20, 2007

get Tamarin using hg Mercurial

Few days ago Edwin Smith (Tamarin creator) announced on mozilla.dev.tech.js-engine that the Tamarin repository has moved to Mercurial.

Hi Folks,

As you may have been following, Mozilla is moving to Mercurial.
Tamarin has now moved over, the new repository is at
http://hg.mozilla.org/tamarin-central. Tamarin has been removed from
CVS (although it's history still lives on). The Tamarin project page
will soon reflect the change.

Happy updating, smooth sailing, and all that!

Edwin Smith
a Tamarin Guy
If you want to know why mozilla moved to Mercurial check out this post from preed (I love the pix :p).


Now let's install Mercurial on Windows, but before that just a little note, yes all this is a dumbed down tutorial to get the source code from Tamarin, not that I think dumb people read this blog but even if I love open source, mozilla, tamarin etc. I always think about the newbie, the student or other people feeling overwhelmed by a high barrier to entry to use something.

Sure, when you breath Mercurial, CVS, SVN everyday (heck even my blogger template is under SVN :p), you don't even think, you get the tool, you don't need tutorial, you just do it and boom it's done, well sorry to say that blokes but the "boom it's done" ain't gonna help any newbie wanting to have fun with Tamarin, so here you go an easy howto is following.

First thing first, get the Mercurial installer, either follow their home page or go directly here, and then install.
(don't mind the strange name as "Mercurial 0.9.3-10edaed7f909" for ex, just get the last one).

During the install if you get this error
C:\Windows\system32\msvcr71.dll
An error occured while trying to replace the existing file
...
ignore it and continue

basically, msvccr71 is the Microsoft C Runtime Library, and if you installed VSC++ express following this post you already have it.
(imho the Mercurial installer should not try to overwrite it)

now open a prompt and see if mercurial is correctly installed
(if you don't already have a "DOS prompt here" check this)

type
c:\>hg
and something should happen.
If not, then got to the directory where you installed Mercurial and use add_path (nice app from Marco Barisione)
c:\path\to\Mercurial>add_path c:\path\to\Mercurial
test again, for exemple here
D:\sources\opensource\Tamarin\tamarin-src>hg
and you should obtain
Mercurial Distributed SCM

basic commands:

 add        add the specified files on the next commit
 annotate   show changeset information per file line
 clone      make a copy of an existing repository
 commit     commit the specified files or all outstanding changes
 diff       diff repository (or selected files)
 export     dump the header and diffs for one or more changesets
 init       create a new repository in the given directory
 log        show revision history of entire repository or files
 merge      merge working directory with another revision
 parents    show the parents of the working dir or revision
 pull       pull changes from the specified source
 push       push changes to the specified destination
 remove     remove the specified files on the next commit
 revert     revert files or dirs to their states as of some revision
 serve      export the repository via HTTP
 status     show changed files in the working directory
 update     update working directory

use "hg help" for the full list of commands or "hg -v" for details
Now that hg is fully installed, let's checkout the source code of tamarin, the repository is at this new URL http://hg.mozilla.org/tamarin-central/.
When you access it using a browser you got a simple yet very usefull interface (love the RSS feed :)), but this same URL is what we gonna use to fetch the code with hg.

It's even simpler than CVS, just type this
C:\>hg clone http://hg.mozilla.org/tamarin-central/ tamarin
here this command will do a checkout of the code into the "c:\tamarin\" directory, but depending on where you executed the command it could be anyother path and/or directory, the result will look like this
requesting all changes
adding changesets
adding manifests
adding file changes
added 86 changesets with 7586 changes to 3189 files
3165 files updated, 0 files merged, 0 files removed, 0 files unresolved
later if you want to update those sources, you will just need to go back to that same path and execute that command
C:\tamarin>hg pull
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
that's all folks.

2 comments

  1. Your "hg update" command is incorrect. To pull new changes from hg, you have to use "hg pull". "update" updates your *working tree* from your local repository.

  2. humm indeed ...
    I'm really too biased towards SVN
    just assumed the same command name had the same use.

    I don't say svn is better than hg, I just know I use svn 99% of the time, and so when you are used to "svn update" it just stick real hard.
    (and before that I was using cvs update!)