Changes

Jump to: navigation, search

Using Mercurial locally with CVS

2,459 bytes added, 21:32, 31 July 2007
no edit summary
This page is an introduction on how to use Mercurial locally with CVS. That is, code is still checked out/committed to the Mozilla repository using CVS, but all local work is done using Mercurial.
 
You will manually pull updates from CVS, and you won't get any changeset information (that is, everyone's commits since the last time you updated from CVS will come in as one big blob), but your own commits will be kept as separate changesets.
== Prerequisites ==
* a clone of the above repository, which is where all your work takes place (you can have more than one of these; but you can only have one CVS repository)
Each chunk of commands will assume that you're starting in some toplevel directory; the CVS repository will end up in <tt>cvssrc/mozilla</tt>; feel free to replace <tt>cvssrc</tt> with something else.
Note that there are other ways of setting this up, such as using named branches, or doing all your work in one repository, but this is the way that works for me, and I think is also the easiest way to avoid getting very confused.
=== Initializing the CVS repository ===
% cd mozilla
% MOZ_CO_PROJECT=browser make -f client.mk pull_all
 
Now, check that tree into a mercurial repository.
 
% cd cvssrc/mozilla
% hg init
% vi .hgignore <i>see below</i>
% hg addremove
% hg commit -m "cvs sync"
 
Here are the contents of my .hgignore file; they can probably be optimized, but this works for me (please edit this if you end up with a better one!)..
 
.*~$
^CVS
.*/CVS
.*/CVS/.*
.*/NONE
#\.\#.*$
^Makefile$
^config.log$
^config.cache$
^config.status$
^.client-defs.mk$
^config-defs.h$
^.mozconfig$
^.mozconfig.mk$
^.mozconfig.out$
^a.out$
^unallmakefiles$
^nss$
^mozilla-config.h$
.flc$
.orig$
.pyc$
 
<tt>hg addremove</tt> marks any files in the working dir that aren't present in the repository for addition, and marks any missing files as missing. The <tt>hg commit</tt> will create your initial commit.
 
=== Cloning the CVS repository ===
 
<b>Do not do any work inside the CVS repository!</b> Instead, create a clone:
 
% hg clone cvssrc/mozilla mozilla
 
And do your work inside the <tt>mozilla</tt> repository.
 
== Doing work ==
 
Perform any changes inside the cloned <tt>mozilla</tt> repository. You may use any combination of hg extensions, including <tt>mq</tt>, <tt>transplant</tt>, etc. to manage your changes in this repository.
 
Once you are ready to commit your work back to CVS, you'll need to make sure that a hg changeset exists for your patch(es). In the simplest way, this will just mean running <tt>hg commit</tt>.
 
=== Committing your work to CVS ===
 
Let's say you just made a change:
 
% cd mozilla
% echo "Hello World" >> README.txt
% hg commit -m "Add mystery message to README.txt"
% hg log -l 2
256[tip] 603e507ddf25 2007-07-31 13:41 -0700 vladimir
Add mystery message to README.txt
255 a4a7678829ff 2007-07-31 13:31 -0700 vladimir
cvs sync
Confirm, emeritus
792
edits

Navigation menu