User:VladVukicevic/Mercurial Testing

From MozillaWiki
Jump to: navigation, search

How I use hg with cvs.

Setting up your cvs master

I assume that you're doing everything in some dir where you keep your moz stuff.

mkdir cvssrc
cd cvssrc
... cvs co mozilla/ ...
... MOZ_CO_PROJECT=... pull_all ...

You now have a mozilla checkout in cvssrc/mozilla. This is your mozilla master. Keep this clean; it's better to do a fresh checkout of this.

cd cvssrc/mozilla

cat > .hgignore <<EOF

hg init
hg add
hg commit -m "Initial cvs import"

Note: hg add should add all the files into the repo; if it doesn't, try hg add .

Creating a working dir

Now, you create a working dir by cloning the cvs repo.

hg clone cvssrc/mozilla mozilla

Note that the directories have to be called "mozilla" for to work, which is why it sits in a separate cvssrc dir.

Now do all your hacking in the new mozilla dir (sibling to cvssrc).

Updating from CVS

In the cvssrc/mozilla dir:

... MOZ_CO_PROJECT... pull_all ...
hg addremove
hg commit -m "cvs sync"

Now in your working dir:

hg pull ../cvssrc/mozilla
hg update

Committing changes

First, make your working dir up to date with CVS by doing the above instructions. This will make things easier. Resolve merge conflicts normally.

Then, in your working dir:

(hg add/remove new files as necessary)
hg commit -m "b=123456, implement cool feature, r=bob"

Then in the cvssrc/mozilla dir:

hg pull ../../mozilla
hg update
(cvs add/remove any added/removed files)
cvs commit -m "b=123456, implement cool feature, r=bob"

If you have mutliple patches to commit:

hg pull ../../mozilla
hg log -l 5   (show only the 5 latest log entries)
hg update 59  (the first revision number since the last cvs sync)
cvs commit ...
hg update 60
cvs commit ...

Using MQ

I suggest using mq to manage multiple patches in your working dir. See Generally, I make sure to qpop all my patches off my working tree before I pull from the cvs tree, because that way parts of your patches don't end up being in merge commits. Then I qpush each patch and fix any conflicts along the way. I use 'qrm -r' to "commit" patches, because I'm not sure how qcommit works.

Sharing your work between computers/people

You can do hg serve and it'll fire up a server on port 8080 (er, maybe 8000?). Then on another machine you can just hg pull://host:8080/.

Old misc notes.

hg import took a while; didn't time. Just imported a CVS checkout, ignoring CVS dirs.

hg clone from this to a new dir took 4.5min

hg status on a clean dir: 7s. (lots of stuff is in the memory cache at this point)

hg diff on a clean dir: 8s.

hg diff on dirty dir: 8s still. (!!!)