Mercurial: Difference between revisions

From SpaceElevatorWiki.com
Jump to navigationJump to search
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Setting up Mercurial ==
'''We are using 1.0.1 of Mercurial right now. This is in the Ubuntu 8.04 backports.'''
apt-get install mercurial meld
Put something like this into your ~/.hgrc file:
[ui]
username= Keith Curtis <keithcu@gmail.com>
editor=gedit
merge=meld
'''Note: We only have 1.9 gigs of free disk space right now, so be careful not to waste it.'''
In the root of your repo is a hidden .hg directory with a complete history.
Also there is a .hgignore file. I made it filter out the pesky .svn directories. Feel free to add other types.
== We have Repo! ==  
== We have Repo! ==  
Web interface:
Web interface:
Line 4: Line 25:


=== Connect to Repo ===
=== Connect to Repo ===
hg clone http://keithcu.com/cgi-bin/hg.cgi YOURLOCALDIRNAME
hg clone http://keithcu.com/cgi-bin/hg.cgi NEWLOCALREPODIRNAME
 
=== To add files (This recurses, so clean out your binaries first) ===  
=== To add files (This recurses, so clean out your binaries first) ===  
hg add *
hg add *
=== To update files ===
=== To update files ===
''Just write to the files''
''Just write to the files''
Line 15: Line 34:


hg commit (''Type some description text on the top line and save and quit'')
hg commit (''Type some description text on the top line and save and quit'')
=== To get up to date with server ===  
=== To get up to date with server ===  
hg pull (''downloads, but doesn't apply them'')
hg pull (''downloads, but doesn't apply them'')
'''May need hg merge, hg commit, etc. (Fill in info!)'''


hg update (''applies them'')
hg update (''applies them'')
=== To push your changes up to server ===
=== To push your committed changes up to server ===
hg push
hg push


''I have unauthenticated push! Don't tell anyone about our secret repo! ;-)''
''I have unauthenticated push! Don't tell your hacker friends about our secret repo! ;-)''
 
Bigger cheatsheet http://www.ivy.fr/mercurial/ref/v1.0/
 
== Setting up Mercurial ==
 
apt-get install mercurial meld
 
Put something like this into your ~/.hgrc file:
 
[ui]


username= Keith Curtis <keithcu@gmail.com>
=== Creating Branches ===
 
Fill in later
editor=gedit
 
merge=meld
 
--------
Important commands are located here:
http://www.ivy.fr/mercurial/ref/v1.0/Mercurial-Usage-v1.0-120dpi.png


== Why use Mercurial? ==
== Why use Mercurial? ==
Line 55: Line 58:


== Links: ==
== Links: ==
2nd best cheatsheet: http://www.ivy.fr/mercurial/ref/v1.0/
Mercurial for CVS Users: http://www.selenic.com/mercurial/wiki/index.cgi/CvsConcepts
Mercurial for CVS Users: http://www.selenic.com/mercurial/wiki/index.cgi/CvsConcepts



Latest revision as of 22:30, 17 July 2008

Setting up Mercurial

We are using 1.0.1 of Mercurial right now. This is in the Ubuntu 8.04 backports.

apt-get install mercurial meld

Put something like this into your ~/.hgrc file:

[ui]

username= Keith Curtis <keithcu@gmail.com>

editor=gedit

merge=meld

Note: We only have 1.9 gigs of free disk space right now, so be careful not to waste it.

In the root of your repo is a hidden .hg directory with a complete history.

Also there is a .hgignore file. I made it filter out the pesky .svn directories. Feel free to add other types.

We have Repo!

Web interface: http://keithcu.com/cgi-bin/hg.cgi

Connect to Repo

hg clone http://keithcu.com/cgi-bin/hg.cgi NEWLOCALREPODIRNAME

To add files (This recurses, so clean out your binaries first)

hg add *

To update files

Just write to the files

hg diff

hg commit (Type some description text on the top line and save and quit)

To get up to date with server

hg pull (downloads, but doesn't apply them)

May need hg merge, hg commit, etc. (Fill in info!)

hg update (applies them)

To push your committed changes up to server

hg push

I have unauthenticated push! Don't tell your hacker friends about our secret repo! ;-)

Creating Branches

Fill in later

Why use Mercurial?

Mercurial is written in Python, is distributed has a solid community, has young code, etc. Bzr is built by Ubuntu, and does have some momentum, but I think Mercurial should and will win. Git is used by Linux but is considered complicated and has other downsides (see Git wikipedia article for a list of them.)

The biggest difference from a client/server VCS (ala svn) to a distributed one is the idea that branches are used a lot more. In svn, branches are used when you want to do some long-term development on something. But in a distributed VCS you create one for every individual bug that you are working on. This provides a nice level of isolation between disparate thing you might be working on. Because of all this branching, distributed VCSs try to make branching a cheap operation.

And one way to make branching cheap is to do it locally. The "distributed" part of these tools comes from the fact that they are designed to work offline. This lets you commit changes and such to your local disk without requiring Internet access to hit a central repository online (but you can commit your changes to an online repository later when you are ready to). This is really handy if you develop on a laptop; it really sucks to have to do a bunch of coding remotely and then commit one huge patch instead of committing a bunch of individual patches. You want the atomicity of commits that represent a single piece of semantic change to allow better tracking of how/why your code changed, not some blob of code that changes a bunch of things at once. Plus it allows for easier rollback if you accidentally introduced a bug. From [1]

Links:

2nd best cheatsheet: http://www.ivy.fr/mercurial/ref/v1.0/

Mercurial for CVS Users: http://www.selenic.com/mercurial/wiki/index.cgi/CvsConcepts

GUI tools: http://www.selenic.com/mercurial/wiki/index.cgi/GUIClients in Ubuntu, use "hg view"

Other good docs: http://www.selenic.com/mercurial/wiki/

Publishing repositories: http://www.selenic.com/mercurial/wiki/index.cgi/PublishingRepositories

http://www.selenic.com/mercurial/wiki/index.cgi/SharedSSH

http://ubuntu-tutorials.com/2007/02/05/unattended-ssh-login-public-key-ssh-authorization-ssh-automatic-login/

https://help.ubuntu.com/community/GnuPrivacyGuardHowto

https://help.ubuntu.com/community/SSHHowto

https://help.ubuntu.com/community/GPGsigningforSSHHowTo