MercurialContents
Introduction to Mercurial (hg)Here is an introductory talk on version control (html slides, pdf, rst). The bundle of the repository, or the tgz and zip version of the repository are available. (My) Mercurial FAQWhere is the keyword substitution (in cvs/svn terms)?See http://www.selenic.com/mercurial/wiki/index.cgi/KeywordExtension. This extension is bundled in version 1.0 (if not earlier). Observations:
Can I pull from several different repositories?Yes, see http://www.selenic.com/mercurial/wiki/index.cgi/CommunicatingChanges for details. How do I know what revision my working directory is?In subversion language, the question is "what is the equivalent hg command for svn info?" The answer is the id command, and the parent command. An extended explanation: Assume you have a repository with (at least) three revisions. You now go back to an older version. In this (simple) education example, let's assume we use: $> hg update -r 0 to go back to version 0. The question is: how can I check for this directory at a later point which version it is? The id command provides this answer (in principle): $> hg id c2696a428dc5 Usually, it is more convenient (and valid for the local repository) to use the numeric id: $> hg id -n 0 Note that there exists the related parent command, which shows the parent(s) of the working directory, and the date of the parent revision and some more information: $> hg parents changeset: 0:c2696a428dc5 user: Hans Fangohr [phi] <fangohr@soton.ac.uk> date: Wed Mar 12 09:50:33 2008 +0000 summary: initial commit Use Mercurial without access to server (using bundles)ProblemSuppose we have developer A and B that need to work on the same project, but cannot access any mercurial servers jointly (typically due to firewalls, restrictions imposed by employer, etc). Suppose A hold the repository THEREPO from which the work is meant to start. SolutionSomehow, A needs to give B a copy of the repository (mail, email, usbstick, ftp server, ...). Suppose the current tip of that repository is 4f45839f613c:
and email the bundle changes.bundle to B. This bundle contains all changes since the specified base version.
If the bundle contains changes that are already present in B's version of THEREPO, then these will be ignored when pulling. As long as the bundle doesn't grow to large, this allows to use the bundle command with the same --base revision again and again to create bundles including further changes. A bit wasteful, but convenient. If B wants to communicate changes to A, he needs to follow the same instructions (to create a bundle and email it to A). The scenario described above can be dealt with more elegantly: it just outlines the basic idea. Other things to know about bundles:
Mercurial on Windows
How to clone an ssh repositoryThere are two options: Using the command lineUse the usual hg commands, for example $> hg clone ssh://somemachine.some.domain//somedirectorypath or $> hg clone ssh://username@somemachine.some.domain//somedirectorypath if your username at somemachine.some.domain is different from your local name. Using the graphical interfaceRight click on some selected document or folder. Choose TortoiseHg->Clone a Repository In the resulting menu, add the address as above, i.e. $> hg clone ssh://somemachine.some.domain//somedirectorypath or $> hg clone ssh://username@somemachine.some.domain//somedirectorypath You also need to specify the target location on your local machine's directory structure. Click Clone (top left corner), and you will have to enter the password of username@somemachine.some.domain. If correct, the repository will be cloned to the local machine. (This was testing with TortoiseHG 0.6) Removing a changeset from a repositoryThis is discussed in many places. See for example http://stackoverflow.com/questions/907133/mercurial-remove-changeset-from-remote-branch How to go back to earlier version and continue from there?A nice summary from Martin Geisler is available at http://stackoverflow.com/questions/2540454/mercurial-revert-back-to-old-version-and-continue-from-there . |
|