<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://chemwiki.ch.ic.ac.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Scliffor</id>
	<title>ChemWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://chemwiki.ch.ic.ac.uk/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Scliffor"/>
	<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/wiki/Special:Contributions/Scliffor"/>
	<updated>2026-04-04T00:37:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=509063</id>
		<title>Resgrp:comp-photo-new gdv layout</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=509063"/>
		<updated>2015-11-06T18:34:26Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: Removed mercurial commands, some minor edits&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Setting up ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Gaussian insists on having its executables not readable by world.  The best way to achieve this is to have a properly set umask; this is a good idea anyway, as having things readable (or writable!) by others is rarely a good idea.  If you need to allow others to view things you can set the permissions explicitly.  One problem here is that the Gaussian makefiles use the csh, which no sane person uses as a shell.  It&#039;s therefore possible that your umask is not being set for the c-shell, which results in world readable files by default.  Fix this permanently by inserting this line into &#039;&#039;both&#039;&#039; &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;~/.cshrc&amp;lt;/code&amp;gt; (you may have to create the latter):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  umask 077&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The new Gaussian development version layout ==&lt;br /&gt;
&lt;br /&gt;
When you first check out a version of gdv from the git repository you will notice that the code is laid out in a different format.  Most of the large monolithic files have been broken down into subdirectories with their constituent subroutines split out into individual files.  For example, &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; has been replaced by a &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory containing each &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; subroutine in its own file.  Most of the utility files have been processed similarly.  This layout is primarily to help the functioning of the version control system.  With the old system a modification to a subroutine within &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; would show up only as a change to the file &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, with only line numbers to help you guess what subroutine had actually been altered.  Moving a subroutine from a link file to a utility file would only show up as a deletion of a block of lines from one and an addition of a block of lines to the other.  The new system allows us to immediately see which subroutines have been altered and to track them if they are moved or copied.&lt;br /&gt;
When you check out the repository there are currently three scripts next to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; scripts convert between the two formats.  See [[#Importing your own code|Importing your own code]] for details on &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;.  These will be useful when receiving new tarballs from Gaussian, or converting already written code, or when the time comes to send code back to Gaussian.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; script attempts to get a distribution very close to an old form Gaussian layout, but there will be differences.  Some old-style files are in an arbitrary order which the script does not attempt to recreate.  Fortunately these are not files that we are likely to change.&lt;br /&gt;
The third script, &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt;, takes executables, libraries, and object files from an already compiled version of Gaussian.  It shouldn&#039;t matter whether the previously compiled version is new style or old-style.&lt;br /&gt;
&lt;br /&gt;
== Building from scratch ==&lt;br /&gt;
&lt;br /&gt;
By default you&#039;ll want to build from scratch.  This is actually quite quick.  Assuming you have checked out the version you wish to compile, and have loaded the appropriate compiler and Linda modules, you should &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.  Do &#039;&#039;&#039;not&#039;&#039;&#039; run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt;, as this will start the normal Gaussian build system, which will fail.&lt;br /&gt;
&lt;br /&gt;
You will need to set the symbolic link for &amp;lt;code&amp;gt;bsd/gdv.make&amp;lt;/code&amp;gt; to point to the appropriate makefile yourself.  This needs to be one of the modififed makefiles, which are prefixed with &#039;uber&#039;.   The easiest option is just to use &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt; which uses the same options that &amp;lt;code&amp;gt;i386.make&amp;lt;/code&amp;gt; does.  The other &#039;uber-*.make&#039; files are tailored to our particular systems (and therefore we may house them elsewhere in the future), such as the Sandybridge nodes or the Altix.  If you want to modify an existing makefile see the comments [[#The makefile|here]].&lt;br /&gt;
Choose your &#039;uber&#039; makefile (I&#039;ll use the &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt; file here) and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  gdv$ ln -s uber-i386.make bsd/gdv.make&lt;br /&gt;
  gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once there is an uber makefile now set you are ready to use the new build system.  To build the entirety of Gaussian type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make build-tools &amp;amp;&amp;amp; make -j 6 util.a &amp;amp;&amp;amp; make util.a &amp;amp;&amp;amp; make -j 6 exe &amp;amp;&amp;amp; make exe 2&amp;gt;&amp;amp;1 | tee make.log&lt;br /&gt;
 [... lots of output ]&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The number 6 in this example instructs make to run six parallel threads while building.  You can use different numbers depending on how many processors the system you&#039;re building on has, how loaded it is, and so on.  I find that building in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; directory with a relatively unloaded cx1 login node, I can build Gaussian in about 15 minutes.  You&#039;ll notice that after each parallel invocation of make I have a serial invocation at the same time for the same target.  This is because sometimes the parallel make loses track of where it is and doesn&#039;t fully make a target.  The serial invocation should always correct this.&lt;br /&gt;
Once Gaussian is built (and you can always check by seeing that &amp;lt;code&amp;gt;make exe&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;Nothing to be done for: `exe&#039;&amp;lt;/code&amp;gt;) you can also build a Linda version by typing &amp;lt;code&amp;gt;make linda&amp;lt;/code&amp;gt;.  You will need the 8.2 version of the Linda compiler in your path; I suggest this is made into a module.&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory of your freshly checked out repository, type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ ../pillage.sh /home/gaussian-devel/gaussiandvh13_pgi_118/gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for example) wait a while and when the prompt returns you should have a fully populated and up-to-date set of binaries.  &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; touches all the imported libraries and executables so they are newer than the source code.  This means that if you type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make&lt;br /&gt;
 ln -sf browse arc&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
only some trivial things get made.&lt;br /&gt;
&lt;br /&gt;
It&#039;s up to you to make sure that any development you do uses a consistent compiler, Linda compiler, etc, to the pillaged binaries.&lt;br /&gt;
&lt;br /&gt;
== Doing it yourself ==&lt;br /&gt;
&lt;br /&gt;
I did try to make a version of &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; that linked to executables instead of copying them, and you may feel tempted to try the same.  The main problem that you need to overcome is that if the libraries you are linking to are older than their corresponding &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will try to update them.  If the libraries are not yours this will simply fail and cause make to exit.  However, if the symbolically linked libraries are yours they will be updated, which is probably not what you want!&lt;br /&gt;
If you really need to save space there are some easier things you can do.  Starting from an empty repository, run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; and make the build tools as above.  Then copy an appropriate util.a from somewhere to your &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory (do not use &amp;lt;code&amp;gt;cp -p&amp;lt;/code&amp;gt;).  Finally, use make to build only the links you are planning to alter, e.g. &amp;lt;code&amp;gt;make l510.exe&amp;lt;/code&amp;gt;.  You should also alter the Makefile so that the mystuff target lists only these links.  This saves space by not having any of the other links&#039; libraries or executables.  You will also not have any &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files for the util  subroutines; as long as the util.a file is newer than all of the util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will not try to make them.  If, however, even one util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; file becomes newer than util.a make will make &#039;&#039;&#039;all&#039;&#039;&#039; of the util &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files!&lt;br /&gt;
Now you can use the &amp;lt;code&amp;gt;%subst&amp;lt;/code&amp;gt; keyword to Gaussian to tell it to pick up the appropriate links from this directory.&lt;br /&gt;
&lt;br /&gt;
== Developing ==&lt;br /&gt;
&lt;br /&gt;
However you have built the binaries developing in the new system is very simple.  Edit the files you need to change, type &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;make Linda&amp;lt;/code&amp;gt; from the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.   You can also type make inside a link subdirectory, which will build just that link&#039;s executable. The makefile knows about Gaussian&#039;s dependencies, so for example if you change a subroutine in &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; then both &amp;lt;code&amp;gt;l510.exe&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;l1003.exe&amp;lt;/code&amp;gt; will be re-linked (because &amp;lt;code&amp;gt;l1003&amp;lt;/code&amp;gt; depends on &amp;lt;code&amp;gt;l510.a&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
By default the makefile checks everything to see if it&#039;s up-to-date.  As there are nearly 12,000 files in this layout this can take a few seconds, longer if the filesystem is being stressed.  I find that with a hot cache on &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; make takes less than a second to check everything.  With a cold cache on &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; it can take some tens of seconds.  If you want to get make to only check specific executables edit the Makefile in &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt;, uncomment the &amp;quot;mystuff&amp;quot; line, and change it appropriately.  Note, however, that all the util files are always checked.  The makefile is a tracked file in the repository, so please make sure you don&#039;t check in these trivial changes.&lt;br /&gt;
&lt;br /&gt;
You do not need to edit the makefile if you add, move, or delete subroutines.&lt;br /&gt;
&lt;br /&gt;
== Importing your own code ==&lt;br /&gt;
&lt;br /&gt;
If your code is in the old layout, i.e. it&#039;s all monolithic links and utilities just as in the official Gaussian distribution tarball, then use the  &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;  script.  First, check out the version of the development code that was the basis of your code.  Let&#039;s assume your code is based on the H10 code and has not merged in changes for H11, H12P, etc.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script assumes that you&#039;ve got a &amp;lt;code&amp;gt;gau-fsplit&amp;lt;/code&amp;gt; command in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  If you haven&#039;t, you can create one by building the build-tools, as explained above, and making sure this directory appears, however temporarily, in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  Or, you can point your path to the pre-built binaries in &amp;lt;code&amp;gt;/home/gaussian-devel&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now change directory to be above the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory of your own code.  Run the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, with an argument of the directory you want the new style to appear in (it should not exist):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ cd /path/to/my-code&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv&lt;br /&gt;
 my-code$ PATH=$PATH:/home/gaussian-devel/gaussiandvh10_pgi_105/gdv /tmp/testrepo/old-to-new.sh new-style&lt;br /&gt;
 [...some output...]&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv   new-style&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now remove the gdv directory in the newly checked out working directory and replace it with the one from new-style.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 my-code$ cd /tmp/testrepo&lt;br /&gt;
 testrepo$ rm -fr gdv&lt;br /&gt;
 testrepo$ cp -pr /path/to/mycode/new-style/gdv .&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now you&#039;re ready to use commands like &amp;lt;code&amp;gt;git status&amp;lt;/code&amp;gt; to see what you&#039;ve changed compared to H10, &amp;lt;code&amp;gt;git commit -a&amp;lt;/code&amp;gt; to check in your changes, &amp;lt;code&amp;gt;git merge h13&amp;lt;/code&amp;gt; to merge in changes up to version H13 (for example).&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have the entire Gaussian source code in your directory you can get &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; to work by making sure there&#039;s a (possibly empty) file in &amp;lt;code&amp;gt;gdv/bsd/mdl1.F&amp;lt;/code&amp;gt;.  There will be a few warnings but it will split out any files it can find in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
If, on the other hand, your code layout is just a few subroutines already split out, then you should just copy them to the appropriate place in the working directory.&lt;br /&gt;
&lt;br /&gt;
This might seem like a pain but you&#039;ll only have to do it once for each version of the code you have!&lt;br /&gt;
&lt;br /&gt;
== The makefile ==&lt;br /&gt;
&lt;br /&gt;
In modifying the Gassian build system I have attempted to balance two competing needs.  The first is a strong desire to modify as little as possible of Gaussian&#039;s original makefiles.  This is so that when we receive newer versions of Gaussian, with their inevitable changes to the makefiles, our modifications can be trivially merged in.  The second is to have a build system that works nicely with the new file layout, which is necessary for the version control system.  The compromise that I have chosen is to have a new Makefile in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory that understand such things as how to build libraries from the split util and link files, and which executables depend on which libraries, while relying on the existing Gaussian makefiles for details such as compiler invocation and flags.&lt;br /&gt;
&lt;br /&gt;
Sadly it was not possible to use the existing Gaussian makefile without modifying it slightly.  This modified version of &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; is called &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.  In it the rules to make most of the libraries and executables are commented out, and a few fixes for other problems are added.  If you wish to compile on another platform you will need to make an uber makefile for that platform.  Base this off the differences between &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you want to add a new link you will need to add it to the Makefile, and possibly to the &amp;lt;code&amp;gt;uber-*&amp;lt;/code&amp;gt; makefile.&lt;br /&gt;
&lt;br /&gt;
== Tools and tricks ==&lt;br /&gt;
&lt;br /&gt;
If you aren&#039;t already using these tools, you should be.&lt;br /&gt;
&lt;br /&gt;
=== Tags ===&lt;br /&gt;
&lt;br /&gt;
One complaint that might arise in going from monolithic link files to split files is that finding the definitions of subroutines and functions becomes much more difficult.  So, if you are editing &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; and are in the MCSCF deck you might come to the line that calls the Davids subroutine.  Finding where this subroutine is defined used to be as simple as searching for &#039;e Davids&#039; (assuming it&#039;s a subroutine, and that there is only one space between subroutine and Davids, and that it&#039;s in &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, etc).  How are you to find it now?&lt;br /&gt;
&lt;br /&gt;
The answer is to use &#039;&#039;&#039;tags&#039;&#039;&#039;.  These have been around for a few decades and are extremely useful.  Firstly you must create a tags file, or files.  For vi/vim you do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv$ ctags *.F */*.F */*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for Emacs substitute etags for ctags).  If you want to create a tags file in one of the link subdirectories just use:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv/l510$ ctags *.F ../*/*.F ../*/*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a ctags (or etags) file in the current directory.  Now, start vi (or Emacs) and edit &amp;lt;code&amp;gt;l510/mcscf.F&amp;lt;/code&amp;gt;.  Find the line that calls the Davids subroutine and position the cursor over the word Davids.  Press &amp;lt;code&amp;gt;Ctrl-]&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-.&amp;lt;/code&amp;gt;) and you will be immediately taken to the definition of that subroutine, even if it’s in another file.  Press &amp;lt;code&amp;gt;Ctrl-T&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-*&amp;lt;/code&amp;gt;) and you&#039;ll be taken back to where you were.  These tags stack, that is you can go into a subroutine, and from there go into another one, and so on, and still be able to back out to the beginning.&lt;br /&gt;
&lt;br /&gt;
You can also start vi (vim really) with the &amp;lt;code&amp;gt;-t &amp;lt;tag&amp;gt;&amp;lt;/code&amp;gt; option to jump immediately to a particular tag.  I don&#039;t know if emacs can do this, as I lost the will to live while browsing the &#039;info&#039; documentation.&lt;br /&gt;
&lt;br /&gt;
Editors other than vi and Emacs also support tags; check the documentation.  If your editor doesn&#039;t support tags it&#039;s just not good enough, sorry.&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
Screen is a terminal multiplexer.  If you wish to have multiple terminals open on a remote system you&#039;re probably accustomed to opening multiple SSH windows from your local system.  An alternative is to use &amp;lt;code&amp;gt;screen&amp;lt;/code&amp;gt;.  It allows you to have multiple windows, each with its own history and possibly executing commands, and switch between them with some simple keypresses.  It also preserves the state of these windows when your connection to screen drops, allowing you to reconnect later.&lt;br /&gt;
&lt;br /&gt;
It&#039;s a bit beyond the scope of this page, if you want to learn more check out the various web resources or it, such as http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=378302</id>
		<title>Resgrp:comp-photo-version control-local-dev-master</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=378302"/>
		<updated>2013-11-21T16:52:02Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will show the current state of the group&#039;s master dev repository &amp;lt;code&amp;gt;/home/gaussian-devel/repositories/local-dev-master&amp;lt;/code&amp;gt;.&lt;br /&gt;
It will document what code is currently considered to be accepted as ready to use.&lt;br /&gt;
&lt;br /&gt;
The format is explained [[#Formatting|here]].  You don&#039;t have to describe each revision, just&lt;br /&gt;
whatever the tip is at the time, and whatever might be (or have been) made into a&lt;br /&gt;
compiled version.&lt;br /&gt;
==The revisions==&lt;br /&gt;
The most recent revision (which should be the tip) should always be on top.  Note&lt;br /&gt;
that the &amp;quot;tip&amp;quot; tag may appear incorrectly below.  Also note that the local revision&lt;br /&gt;
numbers (e.g. 56 in changeset:   56:e359f0e1aa5c) may differ in other repositories.  If&lt;br /&gt;
in doubt, use the hex number.&lt;br /&gt;
&lt;br /&gt;
===changeset:   92:be0e7e296f2f===&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Nov 17 22:44:39 2013 +0000&lt;br /&gt;
 summary:     Local development merged with H32&lt;br /&gt;
&lt;br /&gt;
Local development merged with H32&lt;br /&gt;
&lt;br /&gt;
This entailed quite a bit of editing with the onifrq code, as it &lt;br /&gt;
appears some of these changes have been migrated to H32, with&lt;br /&gt;
Gaussian Inc changes as well. I kept as much as possible of the H32&lt;br /&gt;
code, as this is what&#039;s already been accepted by Gau Inc.&lt;br /&gt;
&lt;br /&gt;
===changeset:   73:923d6c51169a===&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Fri Jan 18 17:11:08 2013 +0000&lt;br /&gt;
 summary:     Fixed bug where ONIOM jobs would fail with:&lt;br /&gt;
&lt;br /&gt;
Updated version fixing a bug where ONIOM 2nd derivative jobs would fail&lt;br /&gt;
with a message like:&lt;br /&gt;
 ONIOM: calculating second derivatives.&lt;br /&gt;
 NInts&amp;lt;0 in InToWP.&lt;br /&gt;
 Error termination via Lnk1e in /home/gaussian-devel/versions/rev-a7f8ac5c6a00-i386-pg12.9/gdv/l120.exe at Fri Jan 11 18:06:43 2013.&lt;br /&gt;
&lt;br /&gt;
===changeset:   72:a7f8ac5c6a00===&lt;br /&gt;
 parent:      70:f87f732e26fb&lt;br /&gt;
 parent:      71:69b842c84566&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Nov 21 14:12:01 2012 +0000&lt;br /&gt;
 summary:     Merged in more updates to makefiles (h23)&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: see revision [[#changeset:   73:923d6c51169a|73:923d6c51169a]].&lt;br /&gt;
&lt;br /&gt;
This revision contains the [[Resgrg:comp-photo-version control-codes#Shaopeng|Shaopeng matrix element code]], the [[Resgrg:comp-photo-version control-codes#Seamfollowing|seam following code]],&lt;br /&gt;
and the [[Resgrg:comp-photo-version control-codes#ONIOM Freq|ONIOM frequency analysis code]].  They are all merged to be compatible with H23.&lt;br /&gt;
&lt;br /&gt;
I have also added into the repository test jobs for each of these local changes.  These are stored in&lt;br /&gt;
an upper directory called &amp;lt;code&amp;gt;local-tests&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
The merge of the three features.  Based off H23.&lt;br /&gt;
===changeset:   55:f6c5e2290dc4===&lt;br /&gt;
 parent:      54:0c83655a3822&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:55:17 2012 +0100&lt;br /&gt;
 summary:     Merged olddirect code to H23&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
Simon&#039;s updates and fixes for the semi-direct matrix element code.&lt;br /&gt;
Based off H23.&lt;br /&gt;
===changeset:   53:c7f36daff923===&lt;br /&gt;
 parent:      52:e11a2fc5b5a8&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 12:38:05 2012 +0100&lt;br /&gt;
 summary:     Shaopeng + seamfollowing, merged to H23.&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
The Shaopeng code and seamfollowing code as below, updated to H23.&lt;br /&gt;
===changeset:   51:dcd851f8dc57===&lt;br /&gt;
 parent:      50:c0a9f878ea3e&lt;br /&gt;
 parent:      39:c90162c4fbe6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Tue Oct 09 22:15:18 2012 +0100&lt;br /&gt;
 summary:     Updated seamfollowing code to H21&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
This is the imported seam following code updated to H21.&lt;br /&gt;
===changeset:   49:bda0e1259a36===&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Jul 02 15:04:35 2012 +0100&lt;br /&gt;
 summary:     Large modification and cleanup of Shaopeng code.  Below for details.&lt;br /&gt;
&lt;br /&gt;
This contains the [[Resgrg:comp-photo-version control-codes#Shaopeng|Shaopeng matrix element code]]&lt;br /&gt;
with most of Simon&#039;s modifications&lt;br /&gt;
and bug fixes in place.  It&#039;s based off version H21&lt;br /&gt;
===changeset:   41:c8a317a36a4e===&lt;br /&gt;
 tag:         h23&lt;br /&gt;
 parent:      40:cfd3ea6fcdff&lt;br /&gt;
 parent:      25:7a8a763281d4&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:45:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H23&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H23.&lt;br /&gt;
&lt;br /&gt;
===changeset:   39:c90162c4fbe6===&lt;br /&gt;
 tag:         h21&lt;br /&gt;
 parent:      38:ef0c2dff2d79&lt;br /&gt;
 parent:      20:dd575870f775&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:44:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H21&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H21.&lt;br /&gt;
===changeset:   37:e972407aab01===&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      36:9d36f9fe483b&lt;br /&gt;
 parent:      17:770721638a7a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:43:06 2012 +0100&lt;br /&gt;
 summary:     Merged in H13&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H13.&lt;br /&gt;
===changeset:   35:10679662e3a3===&lt;br /&gt;
 tag:         h12p&lt;br /&gt;
 parent:      34:3ce1603d2c6c&lt;br /&gt;
 parent:      16:427978d67ed6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:42:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H12p&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H12p.&lt;br /&gt;
===changeset:   33:a0e0a314db85===&lt;br /&gt;
 tag:         h11&lt;br /&gt;
 parent:      32:3732a6888cc4&lt;br /&gt;
 parent:      15:27066b86194e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:49 2012 +0100&lt;br /&gt;
 summary:     Merged in H11&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H11.&lt;br /&gt;
===changeset:   31:7d8a337a7324===&lt;br /&gt;
 tag:         h10&lt;br /&gt;
 parent:      30:86c2a0b6f977&lt;br /&gt;
 parent:      14:62f983246ba7&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H10&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H10.&lt;br /&gt;
===changeset:   29:56fa127c847c===&lt;br /&gt;
 tag:         h08&lt;br /&gt;
 parent:      28:877924b27ee3&lt;br /&gt;
 parent:      13:903ac662c7a2&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:38:04 2012 +0100&lt;br /&gt;
 summary:     Merged in H08&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H08.&lt;br /&gt;
===changeset:   27:a05e10e365c2===&lt;br /&gt;
 tag:         h01&lt;br /&gt;
 parent:      -1:000000000000&lt;br /&gt;
 parent:      12:ae8da988f728&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:35:05 2012 +0100&lt;br /&gt;
 summary:     Fixed bug where code compiled with PGI &amp;gt;= 12 would fail with thread error.&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H01.&lt;br /&gt;
&lt;br /&gt;
==Formatting==&lt;br /&gt;
The format is:&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
Text explaining what this revision contains,&lt;br /&gt;
e.g. all of the below plus merged up to H23&lt;br /&gt;
&lt;br /&gt;
In raw form that&#039;s:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
  tag:         tip&lt;br /&gt;
  parent:      55:f6c5e2290dc4&lt;br /&gt;
  parent:      53:c7f36daff923&lt;br /&gt;
  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
  date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
  summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
 &lt;br /&gt;
 Text explaining what this revision contains,&lt;br /&gt;
 e.g. all of the below plus merged up to H23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the output from &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; with the changeset line made into a header, a space&lt;br /&gt;
added to the start of each following line, and more&lt;br /&gt;
explanatory text.  &#039;&#039;&#039;NB, it&#039;s important to add more explanation!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_new_gdv&amp;diff=326310</id>
		<title>Resgrp:comp-photo-version control new gdv</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_new_gdv&amp;diff=326310"/>
		<updated>2013-03-06T12:45:19Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This page will explain how to import a new version of gdv into the version control system.  For general help on&lt;br /&gt;
the version control system look [[Resgrp:comp-photo-version control|here]].&lt;br /&gt;
&lt;br /&gt;
==How to import a new version==&lt;br /&gt;
&lt;br /&gt;
I&#039;ll assume you&#039;ve got a tarball from Gaussian, in their usual format.&lt;br /&gt;
&lt;br /&gt;
First, get a up to date copy of the &amp;lt;code&amp;gt;gaussian-inc-versions&amp;lt;/code&amp;gt; repository.  Either use &amp;lt;code&amp;gt;hg clone&amp;lt;/code&amp;gt; to&lt;br /&gt;
get a new copy or &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; an existing repository.  Make sure it&#039;s updated to the latest&lt;br /&gt;
version &#039;&#039;on the raw branch&#039;&#039; (using &amp;lt;code&amp;gt;hg update raw&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;hg update -C raw&amp;lt;/code&amp;gt; if necessary.&lt;br /&gt;
&lt;br /&gt;
Next, untar the tarball somewhere and process it using the old-to-new.sh script in the repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 gdv  new-to-old.sh  old-to-new.sh  pillage.sh&lt;br /&gt;
 $ mkdir ../h29&lt;br /&gt;
 $ cd ../h29&lt;br /&gt;
 $ tar zxvf /work/scliffor/gaussian/gdvh29p.tgz&lt;br /&gt;
 $ ls&lt;br /&gt;
 gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(As ever, when using new-to-old.sh, you&#039;ll need to make sure you have a &amp;lt;code&amp;gt;gau-fsplit&amp;lt;/code&amp;gt; in your path.  I usually&lt;br /&gt;
just copy the binary from the latest compiled version to my &amp;lt;code&amp;gt;~/bin&amp;lt;/code&amp;gt; directory.)&lt;br /&gt;
&lt;br /&gt;
Now convert the code to our new [[Resgrp:comp-photo-new gdv layout|format]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ../gaussian-inc-versions/old-to-new.sh new-style&lt;br /&gt;
 doing gdv/allxc.inc&lt;br /&gt;
 doing gdv/amber98.prm&lt;br /&gt;
 doing gdv/amber.prm&lt;br /&gt;
 doing gdv/archlib.F&lt;br /&gt;
 doing gdv/arctmp.F&lt;br /&gt;
 doing gdv/basis&lt;br /&gt;
 doing gdv/blas-generic.F&lt;br /&gt;
 doing gdv/bsd&lt;br /&gt;
 ...&lt;br /&gt;
 doing gdv/view&lt;br /&gt;
 doing gdv/vuind.inc&lt;br /&gt;
 doing gdv/wrappers.F&lt;br /&gt;
 doing gdv/wrmat.F&lt;br /&gt;
 doing gdv/xcind.inc&lt;br /&gt;
 $ ls new-style/gdv/&lt;br /&gt;
 allxc.inc       commonz.inc         ertgen.inc   l1002  l1112  l302  l405  l701  l904              mdarch      rwfcopy.F&lt;br /&gt;
 amber98.prm     copychk.F           fffcom.inc   l1003  l112   l303  l502  l702  l905              mdl1        rwfdump.F&lt;br /&gt;
 amber.prm       cphfutil            fhello.F     l1004  l113   l305  l503  l703  l906              mdutil      separ.inc&lt;br /&gt;
 archlib         crdparams.inc       filecom.inc  l101   l114   l306  l504  l705  l908              mm2.prm     tests&lt;br /&gt;
 arctmp.F        crendx.F            flddsc.inc   l1014  l115   l307  l506  l709  l909              mm.F        trajgen.F&lt;br /&gt;
 basis           cubegen.F           fldloc.inc   l102   l116   l308  l508  l715  l913              newzmatF    uff.prm&lt;br /&gt;
 blas-generic.F  cubman.F            formchk.F    l103   l117   l309  l509  l716  l914              ntran.inc   unfchk.F&lt;br /&gt;
 bsd             Default.Route.save  freqchk.F    l105   l118   l310  l510  l717  l915              oplsaa.prm  utilam&lt;br /&gt;
 c86dv.F         demofc.F            freqmem.F    l106   l120   l311  l511  l718  l916              osutil      util.hlp&lt;br /&gt;
 chkchk.F        dftba.prm           gauopt.F     l107   l121   l314  l601  l801  l918              pluck.F     utilnz&lt;br /&gt;
 chkmove.F       dftbpar.prm         gauoptl.F    l108   l122   l315  l602  l802  l920              prparm.inc  view&lt;br /&gt;
 cktoig.F        dinautil            gautraj.F    l109   l123   l316  l604  l804  l921              putil       vuind.inc&lt;br /&gt;
 commonb2.inc    doc                 gdrgen.F     l110   l124   l317  l607  l809  l922              putil.hlp   wrappers&lt;br /&gt;
 commonb.inc     dreiding.prm        ghelp.F      l1101  l125   l318  l608  l810  l923              qppar.inc   wrmat.F&lt;br /&gt;
 commonlab.inc   dummy.F             ghelp.hlp    l1102  l126   l319  l609  l811  l924              qpstat.inc  xcind.inc&lt;br /&gt;
 commonlp2.inc   dummy-link.F        grate.F      l111   l127   l320  l610  l901  l930              rdmat.F&lt;br /&gt;
 commonmol2.inc  dummy-links.F       ham506.F     l1110  l202   l401  l611  l902  l9999             reform.F&lt;br /&gt;
 commonmol.inc   dummy-narch.F       l1           l1111  l301   l402  l612  l903  lapack-generic.F  repall.inc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It&#039;s worth having a look here to make sure nothing looks too odd.  This looks OK, so we press on.  Change back to the&lt;br /&gt;
&amp;lt;code&amp;gt;gaussian-inc-versions&amp;lt;/code&amp;gt; directory, delete the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory, and replace it with the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt;&lt;br /&gt;
directory you just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ cd ../gaussian-inc-versions&lt;br /&gt;
 $ rm -fr gdv&lt;br /&gt;
 $ cp -pr ../h29/new-style/gdv/ .&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have the new code, in our format, in the repository.  Our job now is to prepare a commit that will correctly represent the changes&lt;br /&gt;
that have been made by Gaussian.&lt;br /&gt;
&lt;br /&gt;
The first task is to check that our ignore filter isn&#039;t hiding any changes we want to include.  We can do this with &amp;lt;code&amp;gt;hg stat -i&amp;lt;/code&amp;gt;.&lt;br /&gt;
If you do this in this case, you&#039;ll see that the only things being ignored are the log files of test jobs, which we don&#039;t keep in the&lt;br /&gt;
repository.  Sometimes you&#039;ll see that Gaussian have added a library files (a .a file).  If this happens add that particular file now&lt;br /&gt;
using &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Next we check the output of &amp;lt;code&amp;gt;hg stat -u&amp;lt;/code&amp;gt;, which shows unknown (new) files.  Firstly, we&#039;re checking here to see if there are&lt;br /&gt;
any files that &#039;&#039;aren&#039;t&#039;&#039; being ignored that should.  Examples include executables or compiled routines for which we have the source,&lt;br /&gt;
Gaussian outputs such as &amp;lt;code&amp;gt;.log&amp;lt;/code or &amp;lt;code&amp;gt;.chk&amp;lt;/code&amp;gt; files, temporary files (such as Emacs &amp;lt;code&amp;gt;filename~&amp;lt;/code&amp;gt; files), and&lt;br /&gt;
so on.  Anything that can be recreated from other things in the gdv directory is probably ignorable.  Add suitable lines to the &lt;br /&gt;
&amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file as appropriate, or just delete the file if you feel an ignore entry is not needed.&lt;br /&gt;
&lt;br /&gt;
In the output of &amp;lt;code&amp;gt;hg stat -u&amp;lt;/code&amp;gt; in this case you&#039;ll notice that the &amp;lt;code&amp;gt;test000.com&amp;lt;/code&amp;gt; files have all been renamed to &amp;lt;code&amp;gt;test0000.com&amp;lt;/code&amp;gt; files.  Mercurial initially reports this as a deletion (of &amp;lt;code&amp;gt;test000.com&amp;lt;/code&amp;gt;) and addition&lt;br /&gt;
(of &amp;lt;code&amp;gt;test0000.com&amp;lt;/code&amp;gt;).  We can get Mercurial to recognise these as renames&amp;lt;ref&amp;gt;You may be wondering why we care about renames.&lt;br /&gt;
Simply put, if changes from Gaussian that include a rename or a copy must be merged with your own changes to those files&lt;br /&gt;
(or vice versa) that it helps mercurial to know about the renames and copies.  Otherwise for a rename it only sees a file being deleted&lt;br /&gt;
and another file being created.&amp;lt;/ref&amp;gt; instead by doing this command (the&lt;br /&gt;
&amp;lt;code&amp;gt;-n&amp;lt;/code&amp;gt; flag makes &amp;lt;code&amp;gt;addremove&amp;lt;/code&amp;gt; do a dry-run.  We&#039;ll do the tests subdirectory separately, as it&#039;s probably&lt;br /&gt;
going to be fairly straightfoward.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg addremove -s 50 -n gdv/tests | less&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-s N&amp;lt;/code&amp;gt; instructs Mercurial to compare files and report renames where the contents differ by no less than N%.&lt;br /&gt;
If you set N too low then you&#039;ll see many false positives, too high and you may miss renames.  Note that the percentage&lt;br /&gt;
is based on the number of lines changed, so changes of even a few characters to a small file can produce quite low&lt;br /&gt;
similarity percentages.&lt;br /&gt;
If you leave &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; off it will still report those that are 100% the same.  In this case you&#039;ll see (after a while)&lt;br /&gt;
a huge list of lines like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 recording removal of gdv/tests/com/test370.com as rename to gdv/tests/com/test0370.com (100% similar)&lt;br /&gt;
 ...&lt;br /&gt;
 recording removal of gdv/tests/test983d-m-ref.cube as rename to gdv/tests/test0983d-m-ref.cube (83% similar)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you have to engage your knowledge of Gaussian!  In almost every instance here in the &amp;lt;code&amp;gt;tests&amp;lt;/code&amp;gt; directory&lt;br /&gt;
it&#039;s clear that these are genuine renames, with some minor modifications.  If in doubt, suspend the &amp;lt;code&amp;gt;addremove&amp;lt;/code&amp;gt;&lt;br /&gt;
command and do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg cat gdv/tests/test983d-m-ref.cube | diff - gdv/tests/test0983d-m-ref.cube | less&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which will show the nature of the changes.  Here you&#039;ll see that for reasons that probably only make sense to someone not using&lt;br /&gt;
version control, Gaussian have very slightly altered some of the values in this &amp;lt;code&amp;gt;.cube&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
You can play with the &amp;lt;code&amp;gt;-s N&amp;lt;/code&amp;gt; parameter until you get a list that is only correct renames, with no false positives&lt;br /&gt;
(if there are some false positives they can be undone before the commit, false negatives can also be added in later).  When you&#039;re happy&lt;br /&gt;
run the &amp;lt;code&amp;gt;addremove&amp;lt;/code&amp;gt; command without the &amp;lt;code&amp;gt;-n&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
I decided to go with &amp;lt;code&amp;gt;-s 50&amp;lt;/code&amp;gt;.  Once the command finishes (and it can take quite a while, particularly for low values&lt;br /&gt;
of N) you can check what&#039;s been done with &amp;lt;code&amp;gt;hg stat -a -C&amp;lt;/code&amp;gt;, which shows files that have been added, and additionally, whether&lt;br /&gt;
they are marked as copies.  If they are copies they will appear like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg stat -a -C&lt;br /&gt;
 A gdv/tests/check-of&lt;br /&gt;
 A gdv/tests/ckelap&lt;br /&gt;
 A gdv/tests/com/test0000.com&lt;br /&gt;
   gdv/tests/com/test000.com&lt;br /&gt;
 A gdv/tests/com/test0001.com&lt;br /&gt;
   gdv/tests/com/test001.com&lt;br /&gt;
 ...&lt;br /&gt;
 A gdv/tests/com/test1036.com&lt;br /&gt;
   gdv/tests/com/test872.com&lt;br /&gt;
 A gdv/tests/com/test1037.com&lt;br /&gt;
   gdv/tests/com/test872.com&lt;br /&gt;
 A gdv/tests/com/test1038.com&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
which shows &amp;lt;code&amp;gt;gdv/tests/com/test0000.com&amp;lt;/code&amp;gt; has been marked as a copy of &amp;lt;code&amp;gt;gdv/tests/com/test000.com&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
Note that &amp;lt;code&amp;gt;gdv/tests/com/test1036.com&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;gdv/tests/com/test1037.com&amp;lt;/code&amp;gt; have been marked as copies of &amp;lt;code&amp;gt;gdv/tests/com/test872.com&amp;lt;/code&amp;gt;, which has already been marked as the origin of &amp;lt;code&amp;gt;gdv/tests/com/test0872.com&amp;lt;/code&amp;gt;.&lt;br /&gt;
In certain circumstances this might be legitimate, with one file being renamed and copied (or just copied) but in this&lt;br /&gt;
case, using &amp;lt;code&amp;gt;hg diff&amp;lt;/code&amp;gt; I decide that however it&#039;s arisen, I don&#039;t want to record it.  I remove the adds and then redo them, without&lt;br /&gt;
marking them as renames:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg revert gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 $ hg stat gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 ? gdv/tests/com/test1036.com&lt;br /&gt;
 ? gdv/tests/com/test1037.com&lt;br /&gt;
 $ hg add gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 $ hg stat -C gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 A gdv/tests/com/test1036.com&lt;br /&gt;
 A gdv/tests/com/test1037.com&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now apply this same methodology to the remaining unknown files.  We are trying to get to a situation where the output of&lt;br /&gt;
&amp;lt;code&amp;gt;hgstat -du&amp;lt;/code&amp;gt; is empty.  The &amp;lt;code&amp;gt;-u&amp;lt;/code&amp;gt; flag shows files that have appeared in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory&lt;br /&gt;
but are unknown to mercurial; these are files added or renamed by Gaussian.  The &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; flag shows files&lt;br /&gt;
that are known to mercurial but are no longer in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;hg addremove&amp;lt;/code&amp;gt; on the&lt;br /&gt;
&amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory it will try re-add things in &amp;lt;code&amp;gt;tests&amp;lt;/code&amp;gt;, so be careful.  There&#039;s no harm in re-adding&lt;br /&gt;
files you&#039;ve already added, but you don&#039;t want to add files you&#039;ve manually removed from the list (for example,&lt;br /&gt;
&amp;lt;code&amp;gt;hg addremove -s 50 gdv&amp;lt;/code&amp;gt; will re-mark &amp;lt;code&amp;gt;gdv/tests/com/test1036.com&amp;lt;/code&amp;gt; as a copy of&lt;br /&gt;
&amp;lt;code&amp;gt;gdv/tests/com/test872.com&amp;lt;/code&amp;gt; again.  Avoid this by using the &amp;lt;code&amp;gt;-X&amp;lt;/code&amp;gt; flag to add remove:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg addremove -s 40 -n -X &#039;glob:gdv/tests/**&#039; gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If I use the above command I get a long list of files being removed and added and then at the end of list of files that&lt;br /&gt;
are being recorded as renames.  It&#039;s worth checking the list of additions and deletions, particularly scripts in the&lt;br /&gt;
&amp;lt;code&amp;gt;bsd&amp;lt;/code&amp;gt;  directory. In this case there are some scripts, but they all check out OK.  The list of renames is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 recording removal of gdv/l718/quairc.F as rename to gdv/dinautil/quairc.F (100% similar)&lt;br /&gt;
 recording removal of gdv/l718/quarot.F as rename to gdv/dinautil/quarot.F (100% similar)&lt;br /&gt;
 recording removal of gdv/l718/rotirc.F as rename to gdv/dinautil/rotirc.F (100% similar)&lt;br /&gt;
 recording removal of gdv/l120/getlfo.F as rename to gdv/utilam/getlfo.F (100% similar)&lt;br /&gt;
 recording removal of gdv/mdutil/lshift1.F as rename to gdv/mdutil/lshft1.F (73% similar)&lt;br /&gt;
 recording removal of gdv/l718/difrot.F as rename to gdv/dinautil/difrot.F (97% similar)&lt;br /&gt;
 recording removal of gdv/utilam/iiabs.F as rename to gdv/utilam/ivabs.F (82% similar)&lt;br /&gt;
 recording removal of gdv/l1/decotp.F as rename to gdv/l1/decjob.F (77% similar)&lt;br /&gt;
 recording removal of gdv/l1/decotp.F as rename to gdv/l1/decmth.F (47% similar)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this is where some of your Gaussian intuition comes in handy.  Moving files from link subdirectories&lt;br /&gt;
to utility subdirectories is a common and expected thing.  If we inspect the &amp;lt;code&amp;gt;gdv/utilam/iiabs.F&amp;lt;/code&amp;gt; to&lt;br /&gt;
&amp;lt;code&amp;gt;gdv/utilam/ivabs.F&amp;lt;/code&amp;gt; rename we see that the files are the same apart from two one character changes.&lt;br /&gt;
Inspecting the final two renames shows that the file &amp;lt;code&amp;gt;gdv/l1/decotp.F&amp;lt;/code&amp;gt; is indeed being split&lt;br /&gt;
into two new files. Therefore I go ahead with the command without the &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
The final task before we go ahead and commit this changeset is to check the makefile for&lt;br /&gt;
any new targets.  If these correspond to new executables we will need to add them to the&lt;br /&gt;
&amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg diff gdv/bsd/i386.make | less&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
shows us that there are two new links:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 @@ -212,7 +212,7 @@&lt;br /&gt;
          l105.exe    l106.exe    l107.exe    l108.exe    l109.exe \&lt;br /&gt;
          l110.exe    l111.exe    l112.exe    l113.exe    l114.exe    l115.exe \&lt;br /&gt;
          l116.exe    l117.exe    l118.exe    l120.exe    l121.exe \&lt;br /&gt;
 -        l122.exe    l123.exe    l124.exe    l125.exe    l202.exe&lt;br /&gt;
 +        l122.exe    l123.exe    l124.exe    l125.exe    l126.exe    l127.exe    l202.exe&lt;br /&gt;
 &lt;br /&gt;
  exe3:    l301.exe    l302.exe    l303.exe    l305.exe    l306.exe \&lt;br /&gt;
          l307.exe    l308.exe    l309.exe    l310.exe    l311.exe \ &lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and two new utilities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 @@ -597,6 +597,12 @@&lt;br /&gt;
  unfchk: unfchk.o&lt;br /&gt;
         $(RUNF77) $(FFLAGS) -o unfchk unfchk.o $(EXTOBJ) $(EXTRAS) $(GAULIB) $(LIBS)&lt;br /&gt;
 &lt;br /&gt;
 +gdrgen: gdrgen.o&lt;br /&gt;
 +       $(RUNF77) $(FFLAGS) -o gdrgen gdrgen.o $(EXTOBJ) $(EXTRAS) $(GAULIB) $(LIBS)&lt;br /&gt;
 +&lt;br /&gt;
 +trajgen: trajgen.o&lt;br /&gt;
 +       $(RUNF77) $(FFLAGS) -o trajgen trajgen.o $(EXTOBJ) $(EXTRAS) $(GAULIB) $(LIBS)&lt;br /&gt;
 +&lt;br /&gt;
  rdmat: rdmat.o&lt;br /&gt;
         $(RUNF77) $(FFLAGS) -o rdmat rdmat.o $(EXTOBJ) $(EXTRAS) $(GAULIB) $(LIBS)&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The links are detected by a pattern in the HG ignore file a we must add the two new utilities,&lt;br /&gt;
so that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg diff .hgignore&lt;br /&gt;
 diff -r 8db6c9367c60 .hgignore&lt;br /&gt;
 --- a/.hgignore Thu Aug 02 11:17:35 2012 +0100&lt;br /&gt;
 +++ b/.hgignore Mon Mar 04 17:58:09 2013 +0000&lt;br /&gt;
 @@ -32,6 +32,7 @@&lt;br /&gt;
  gdv/gauopt&lt;br /&gt;
  gdv/gauoptl&lt;br /&gt;
  gdv/gautraj&lt;br /&gt;
 +gdv/gdrgen&lt;br /&gt;
  gdv/gdv&lt;br /&gt;
  gdv/gdvlb&lt;br /&gt;
  gdv/ghelp&lt;br /&gt;
 @@ -46,5 +47,6 @@&lt;br /&gt;
  gdv/rwfdump&lt;br /&gt;
  gdv/tags&lt;br /&gt;
  gdv/testrt&lt;br /&gt;
 +gdv/trajgen&lt;br /&gt;
  gdv/unfchk&lt;br /&gt;
  gdv/wrmat&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This then,represents Gaussian as it came from Gaussian Inc converted to our new format.&lt;br /&gt;
Once you are satisfied commit the revision with &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;.  There is a preferred&lt;br /&gt;
format for the&lt;br /&gt;
log message for these raw branch commits; look at one of the previous commits using&lt;br /&gt;
&amp;lt;code&amp;gt;hg log -v --rev N | less&amp;lt;/code&amp;gt; for an example.  The log message I will use for &lt;br /&gt;
this particular commit is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 Import of Gaussian version H29p.  See below for details.&lt;br /&gt;
 &lt;br /&gt;
 rm -fr gdv&lt;br /&gt;
 cp -pr ../h29p/new-style/gdv .&lt;br /&gt;
 hg addremove -s 50 gdv/tests&lt;br /&gt;
 hg revert gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 hg add gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 hg addremove -s 40 -X &#039;glob:gdv/tests/**&#039; gdv&lt;br /&gt;
&lt;br /&gt;
 and added gdrgen and trajgen to .hgignore.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The idea is that someone should be able to replicate what you&#039;ve done &lt;br /&gt;
just by referring to the log message.&lt;br /&gt;
&lt;br /&gt;
Congratulations! You&#039;ve just added a revision to the raw branch.&lt;br /&gt;
Now tag it with the version identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg tag h29p-raw&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we must merge this version into our local branch, which represents&lt;br /&gt;
a compilable version of Gaussian in our new format. generally this only&lt;br /&gt;
requires changes to our local make files, however these changes can&lt;br /&gt;
require considerable effort.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg up local&lt;br /&gt;
 1995 files updated, 0 files merged, 1228 files removed, 0 files unresolved&lt;br /&gt;
 Added tags for local versions&lt;br /&gt;
 $ hg merge raw&lt;br /&gt;
 merging .hgignore&lt;br /&gt;
 merging .hgtags&lt;br /&gt;
 4 files to edit&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point this guide will get a little hazy because I used vim&lt;br /&gt;
and you may be using some other editor.  After you type&lt;br /&gt;
&amp;lt;code&amp;gt;hg merge raw&amp;lt;/code&amp;gt; you may be presented with a graphical merge&lt;br /&gt;
tool, a text based merge tool, a particular mode of your favourite text editor,&lt;br /&gt;
a particular mode of a hated text editor, or indeed, nothing. You can customise&lt;br /&gt;
the tool that is used if you want. For the purposes of this guide quit out of the&lt;br /&gt;
tool or editor without making any changes. If you are using vim use the&lt;br /&gt;
&amp;lt;code&amp;gt;:cq&amp;lt;/code&amp;gt; command which will cause vim to return an error to mercurial&lt;br /&gt;
which tells it that the merge is not finished. Again for the purposes of this guide&lt;br /&gt;
run &amp;lt;code&amp;gt;hg resolve -a -u&amp;lt;/code&amp;gt;&lt;br /&gt;
to mark all the conflicting files&lt;br /&gt;
as unresolved.&lt;br /&gt;
&lt;br /&gt;
You should now be able to see:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg resolve -l&lt;br /&gt;
 U .hgignore&lt;br /&gt;
 U .hgtags&lt;br /&gt;
 U gdv/bsd/uber-i386.make&lt;br /&gt;
 U gdv/bsd/uber-sandyb.make&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now resolve these four files.  First &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg resolve .hgignore&lt;br /&gt;
 merging .hgignore&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will return immediately having automatically merged the files and&lt;br /&gt;
produced no conflicts.  Easy enough.  If you examine the file you will see&lt;br /&gt;
that our two new executables have been added. Next:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg resolve .hgtags&lt;br /&gt;
 merging .hgtags&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For me this command starts vimdiff with windows showing the tags file as&lt;br /&gt;
it exists in the two-parent revisions of the merge plus another window&lt;br /&gt;
where I can edit the final merged version; this window will have the title&lt;br /&gt;
&amp;lt;code&amp;gt;gdv/bsd/.hgtags&amp;lt;/code&amp;gt;, the others will contain words like &amp;quot;base,&lt;br /&gt;
other, and orig&amp;quot;. Although the tags file&lt;br /&gt;
will generally look after itself I like to keep things neat so I&lt;br /&gt;
edit the file so that the knew tag, h29p, exists in the final version.&lt;br /&gt;
&lt;br /&gt;
now to the more difficult files:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg resolve gdv/bsd/uber-i386.make&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
again for me this opens up vimdiff.  Here we have some work to do&lt;br /&gt;
because &amp;lt;code&amp;gt;gdv/bsd/uber-i386.make&amp;lt;/code&amp;gt; has been marked as a&lt;br /&gt;
copy of &amp;lt;code&amp;gt;gdv/bsd/i386.make&amp;lt;/code&amp;gt;, which inevitably is changed&lt;br /&gt;
with every new version of Gaussian.  I&#039;ll go through this carefully here&lt;br /&gt;
the generally you&#039;ll have to use your own experience with make and&lt;br /&gt;
Gaussian to guide you through the process.  If necessary you can quit&lt;br /&gt;
out of the merge tool (use &amp;lt;code&amp;gt;:cq&amp;lt;/code&amp;gt; for vim based editors.&lt;br /&gt;
This marks the file as unresolved) and examine the changes to&lt;br /&gt;
&amp;lt;code&amp;gt;gdv/bsd/i386.make&amp;lt;/code&amp;gt; using &amp;lt;code&amp;gt;hg diff&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The first difference I see involves &amp;lt;code&amp;gt;INCDIRX&amp;lt;/code&amp;gt;.  However,&lt;br /&gt;
inspection shows that this has not changed in the new version of&lt;br /&gt;
&amp;lt;code&amp;gt;gdv/bsd/i386.make&amp;lt;/code&amp;gt;. The next change is to the definition&lt;br /&gt;
of &amp;lt;code&amp;gt;DIMENSX&amp;lt;/code&amp;gt;.  Here we see that Gaussian have added a&lt;br /&gt;
flag &amp;quot;&amp;lt;code&amp;gt;-DSTUPID_ATLAS&amp;lt;/code&amp;gt;&amp;quot;, changed the expansion of&lt;br /&gt;
&amp;quot;&amp;lt;code&amp;gt;-DDEFMAXCOORDINFO&amp;lt;/code&amp;gt;&amp;quot; from 16 to 32, and changed&lt;br /&gt;
&amp;quot;&amp;lt;code&amp;gt; -DSETCORE_OK&amp;lt;/code&amp;gt;&amp;quot; to &amp;quot;&amp;lt;code&amp;gt; -DSETCDMP_OK&amp;lt;/code&amp;gt;&amp;quot;. These&lt;br /&gt;
are legitimate changes that I add to our local makefile.&lt;br /&gt;
&lt;br /&gt;
The next part we come to is the part of the local makefile that says&lt;br /&gt;
output from set-mflags here.  This is a series of compiler and other&lt;br /&gt;
flags that are emitted by Gaussian utility during the normal build phase.&lt;br /&gt;
We have to capture those flags directly into the makefile.  To do this&lt;br /&gt;
you will need to do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ cd gdv&lt;br /&gt;
 $ ln -s uber-i386.make bsd/gdv.make&lt;br /&gt;
 $ make build-tools&lt;br /&gt;
 $ PATH=$PATH:.:./bsd gdvroot=/tmp/scliffor/repos/gaussian-inc-versions/ bsd/set-mflags&lt;br /&gt;
 GAUDIM=2500 CSIZE=2097152 CSIZEW=128 OPTOI= MMODEL=&#039;-mcmodel=medium&#039; SPECFLAG= NKSEC=-DDEFKSEC=256 I8FLAG=-i8 R8FLAG=-r8 I8CPP1=-DI64 I8CPP2=-DP64 I8CPP3=-DPACK64 I8CPP4=-DUSE_I2 MACHTY=k8-64 GAULIBU=util.a BLAS1=bsd/libf77blas-amd64.a BLAS2=bsd/libatlas-amd64.a&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
that last line is space separated and not terminated with a newline.&lt;br /&gt;
If you paste it into a file and replace the spaces with newlines you&#039;ll&lt;br /&gt;
see that nothing has changed.&lt;br /&gt;
&lt;br /&gt;
The next changes that we care about come in the definition of make targets&lt;br /&gt;
&amp;lt;code&amp;gt;exe1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;UTILLIST&amp;lt;/code&amp;gt;,&lt;br /&gt;
as we noticed previously Gaussian have added two new links and two new executables&lt;br /&gt;
&amp;lt;code&amp;gt;l126.exe&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;l127.exe&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt; gdrgen&amp;lt;/code&amp;gt;,&lt;br /&gt;
and &amp;lt;code&amp;gt;trajgen&amp;lt;/code&amp;gt;.  Further down we must include the commands needed&lt;br /&gt;
to make the two new executables.&lt;br /&gt;
&lt;br /&gt;
Then there is a change to the commands needed to make &amp;lt;code&amp;gt;gau-cpp&amp;lt;/code&amp;gt;&lt;br /&gt;
and finally there are some alterations to the lists of subroutines that need&lt;br /&gt;
special optimisation flags.  I include all of these changes.&lt;br /&gt;
&lt;br /&gt;
when you&#039;re done save the merged file and quit the merge tool.  If the&lt;br /&gt;
merge tool or editor that you are using exits with a success code then&lt;br /&gt;
mercurial will mark the file as resolved.&lt;br /&gt;
&lt;br /&gt;
Do the same for the &amp;lt;code&amp;gt;gdv/bsd/uber-sandyb.make&amp;lt;/code&amp;gt;.  The changes will be&lt;br /&gt;
pretty much the same.&lt;br /&gt;
&lt;br /&gt;
Because there are new executables targets we must add them to our master&lt;br /&gt;
Makefile, &amp;lt;code&amp;gt;gdv/Makefile&amp;lt;/code&amp;gt;.  edit this file and you will see&lt;br /&gt;
that the declarations of the targets mirrors the&lt;br /&gt;
&amp;lt;code&amp;gt;gdb/bsd/*.make&amp;lt;/code&amp;gt; files.  Add &amp;lt;code&amp;gt;l126.exe&amp;lt;/code&amp;gt;,&lt;br /&gt;
&amp;lt;code&amp;gt;l127.exe&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;gdrgen&amp;lt;/code&amp;gt;,&lt;br /&gt;
and &amp;lt;code&amp;gt;trajgen&amp;lt;/code&amp;gt; to the file. Further down, after the part of&lt;br /&gt;
the makefile that looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 .INTERMEDIATE: unfchk.o&lt;br /&gt;
 unfchk: unfchk.o $(GAULIB)&lt;br /&gt;
     $(RM) $@&lt;br /&gt;
     $(MAKE) -f $(GAU_DIR)/bsd/gdv.make MAKE=&#039;$(MAKE)&#039; $(EXTRAMAKEFLAGS) $@&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
copy these five lines (including the blank one) and the change all&lt;br /&gt;
occurrences of &amp;lt;code&amp;gt;unfchk&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;gdrgen&amp;lt;/code&amp;gt;. Repeat for&lt;br /&gt;
&amp;lt;code&amp;gt;trajgen&amp;lt;/code&amp;gt;.  Finally find the lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 .SECONDARY: $(filter-out $(ml125.o), $(patsubst %.F, %.o, $(wildcard l125/*.F)))&lt;br /&gt;
 l125.a: $(filter-out $(ml125.o), $(patsubst %.F, %.o, $(wildcard l125/*.F)))&lt;br /&gt;
     $(AR) rv $@ $?&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
copy them (again including the blank line), replacing &amp;lt;code&amp;gt;l125&amp;lt;/code&amp;gt;&lt;br /&gt;
with &amp;lt;code&amp;gt;l126&amp;lt;/code&amp;gt;.  Repeat for &amp;lt;code&amp;gt;l127&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After this we are hopefully left with the new version of Gaussian&lt;br /&gt;
in our new format with our local makefiles to build that new format.&lt;br /&gt;
The best way to test this is to build it!  I did this and it builds&lt;br /&gt;
successfully.  Now run the test suite (yeah right).&lt;br /&gt;
&lt;br /&gt;
A quick check with &amp;lt;code&amp;gt;hg stat -u&amp;lt;/code&amp;gt; will usually show some&lt;br /&gt;
&amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; files.  These are usually left behind by the merge&lt;br /&gt;
process, and can be safely removed.    If anything else shows up you must decide whether&lt;br /&gt;
to add it to the &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file or delete it.&lt;br /&gt;
You are now ready to commit this revision, so do so with an appropriate&lt;br /&gt;
log message, and tag it (&amp;lt;code&amp;gt;hg tag h29p-local&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
And now we&#039;re ready for the final merge.  Update to the default branch&lt;br /&gt;
and do the merge:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg update default&lt;br /&gt;
 $ hg merge local&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is very much the same as the previous merge from raw to local.&lt;br /&gt;
What you&#039;re aiming for on the default branch is a version of Gaussian&lt;br /&gt;
that will build and run efficiently on the group&#039;s local systems&lt;br /&gt;
(namely CX1).  This means that the makefiles should contain the necessary&lt;br /&gt;
optimisations for the CX1 architecture.  It may also mean that you&lt;br /&gt;
may have to make changes to the code to fix runtime or compile time&lt;br /&gt;
bugs.  For instance, when we started using a new version of the PGI&lt;br /&gt;
compiler it exposed a bug in Gaussian that prevented any jobs using&lt;br /&gt;
more than one processor.&lt;br /&gt;
&lt;br /&gt;
I have made some changes to the compiler flags of both of the&lt;br /&gt;
&amp;lt;code&amp;gt;uber-*&amp;lt;/code&amp;gt; makefiles.&lt;br /&gt;
&lt;br /&gt;
It&#039;s worth compiling the code again at this point and running a few&lt;br /&gt;
test jobs.  You can use these compiled executables in the&lt;br /&gt;
&amp;lt;code&amp;gt;/home/gaussian-devel/versions&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
Once you are satisfied that the code is fine push your changes back&lt;br /&gt;
to the master repository (no harm in making a backup of the master&lt;br /&gt;
beforehand).  In the &amp;lt;code&amp;gt;local-dev-master&amp;lt;/code&amp;gt; repository pull the&lt;br /&gt;
changes from the &amp;lt;code&amp;gt;gaussian-inc-versions&amp;lt;/code&amp;gt; repository and let&lt;br /&gt;
people know that the changes are now available.  They can pull and the&lt;br /&gt;
merge the changes as I&#039;ve described here.&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_new_gdv&amp;diff=325754</id>
		<title>Resgrp:comp-photo-version control new gdv</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_new_gdv&amp;diff=325754"/>
		<updated>2013-03-04T18:52:26Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This page will explain how to import a new version of gdv into the version control system.  For general help on&lt;br /&gt;
the version control system look [[Resgrp:comp-photo-version control|here]].&lt;br /&gt;
&lt;br /&gt;
==How to import a new version==&lt;br /&gt;
&lt;br /&gt;
I&#039;ll assume you&#039;ve got a tarball from Gaussian, in their usual format.&lt;br /&gt;
&lt;br /&gt;
First, get a up to date copy of the &amp;lt;code&amp;gt;gaussian-inc-versions&amp;lt;/code&amp;gt; repository.  Either use &amp;lt;code&amp;gt;hg clone&amp;lt;/code&amp;gt; to&lt;br /&gt;
get a new copy or &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; an existing repository.  Make sure it&#039;s updated to the latest&lt;br /&gt;
version &#039;&#039;on the raw branch&#039;&#039; (using &amp;lt;code&amp;gt;hg update raw&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;hg update -C raw&amp;lt;/code&amp;gt; if necessary.&lt;br /&gt;
&lt;br /&gt;
Next, untar the tarball somewhere and process it using the old-to-new.sh script in the repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 gdv  new-to-old.sh  old-to-new.sh  pillage.sh&lt;br /&gt;
 $ mkdir ../h29&lt;br /&gt;
 $ cd ../h29&lt;br /&gt;
 $ tar zxvf /work/scliffor/gaussian/gdvh29p.tgz&lt;br /&gt;
 $ ls&lt;br /&gt;
 gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(As ever, when using new-to-old.sh, you&#039;ll need to make sure you have a &amp;lt;code&amp;gt;gau-fsplit&amp;lt;/code&amp;gt; in your path.  I usually&lt;br /&gt;
just copy the binary from the latest compiled version to my &amp;lt;code&amp;gt;~/bin&amp;lt;/code&amp;gt; directory.)&lt;br /&gt;
&lt;br /&gt;
Now convert the code to our new [[Resgrp:comp-photo-new gdv layout|format]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ../gaussian-inc-versions/old-to-new.sh new-style&lt;br /&gt;
 doing gdv/allxc.inc&lt;br /&gt;
 doing gdv/amber98.prm&lt;br /&gt;
 doing gdv/amber.prm&lt;br /&gt;
 doing gdv/archlib.F&lt;br /&gt;
 doing gdv/arctmp.F&lt;br /&gt;
 doing gdv/basis&lt;br /&gt;
 doing gdv/blas-generic.F&lt;br /&gt;
 doing gdv/bsd&lt;br /&gt;
 ...&lt;br /&gt;
 doing gdv/view&lt;br /&gt;
 doing gdv/vuind.inc&lt;br /&gt;
 doing gdv/wrappers.F&lt;br /&gt;
 doing gdv/wrmat.F&lt;br /&gt;
 doing gdv/xcind.inc&lt;br /&gt;
 $ ls new-style/gdv/&lt;br /&gt;
 allxc.inc       commonz.inc         ertgen.inc   l1002  l1112  l302  l405  l701  l904              mdarch      rwfcopy.F&lt;br /&gt;
 amber98.prm     copychk.F           fffcom.inc   l1003  l112   l303  l502  l702  l905              mdl1        rwfdump.F&lt;br /&gt;
 amber.prm       cphfutil            fhello.F     l1004  l113   l305  l503  l703  l906              mdutil      separ.inc&lt;br /&gt;
 archlib         crdparams.inc       filecom.inc  l101   l114   l306  l504  l705  l908              mm2.prm     tests&lt;br /&gt;
 arctmp.F        crendx.F            flddsc.inc   l1014  l115   l307  l506  l709  l909              mm.F        trajgen.F&lt;br /&gt;
 basis           cubegen.F           fldloc.inc   l102   l116   l308  l508  l715  l913              newzmatF    uff.prm&lt;br /&gt;
 blas-generic.F  cubman.F            formchk.F    l103   l117   l309  l509  l716  l914              ntran.inc   unfchk.F&lt;br /&gt;
 bsd             Default.Route.save  freqchk.F    l105   l118   l310  l510  l717  l915              oplsaa.prm  utilam&lt;br /&gt;
 c86dv.F         demofc.F            freqmem.F    l106   l120   l311  l511  l718  l916              osutil      util.hlp&lt;br /&gt;
 chkchk.F        dftba.prm           gauopt.F     l107   l121   l314  l601  l801  l918              pluck.F     utilnz&lt;br /&gt;
 chkmove.F       dftbpar.prm         gauoptl.F    l108   l122   l315  l602  l802  l920              prparm.inc  view&lt;br /&gt;
 cktoig.F        dinautil            gautraj.F    l109   l123   l316  l604  l804  l921              putil       vuind.inc&lt;br /&gt;
 commonb2.inc    doc                 gdrgen.F     l110   l124   l317  l607  l809  l922              putil.hlp   wrappers&lt;br /&gt;
 commonb.inc     dreiding.prm        ghelp.F      l1101  l125   l318  l608  l810  l923              qppar.inc   wrmat.F&lt;br /&gt;
 commonlab.inc   dummy.F             ghelp.hlp    l1102  l126   l319  l609  l811  l924              qpstat.inc  xcind.inc&lt;br /&gt;
 commonlp2.inc   dummy-link.F        grate.F      l111   l127   l320  l610  l901  l930              rdmat.F&lt;br /&gt;
 commonmol2.inc  dummy-links.F       ham506.F     l1110  l202   l401  l611  l902  l9999             reform.F&lt;br /&gt;
 commonmol.inc   dummy-narch.F       l1           l1111  l301   l402  l612  l903  lapack-generic.F  repall.inc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It&#039;s worth having a look here to make sure nothing looks too odd.  This looks OK, so we press on.  Change back to the&lt;br /&gt;
&amp;lt;code&amp;gt;gaussian-inc-versions&amp;lt;/code&amp;gt; directory, delete the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory, and replace it with the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt;&lt;br /&gt;
directory you just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ cd ../gaussian-inc-versions&lt;br /&gt;
 $ rm -fr gdv&lt;br /&gt;
 $ cp -pr ../h29/new-style/gdv/ .&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have the new code, in our format, in the repository.  Our job now is to prepare a commit that will correctly represent the changes&lt;br /&gt;
that have been made by Gaussian.&lt;br /&gt;
&lt;br /&gt;
The first task is to check that our ignore filter isn&#039;t hiding any changes we want to include.  We can do this with &amp;lt;code&amp;gt;hg stat -i&amp;lt;/code&amp;gt;.&lt;br /&gt;
If you do this in this case, you&#039;ll see that the only things being ignored are the log files of test jobs, which we don&#039;t keep in the&lt;br /&gt;
repository.  Sometimes you&#039;ll see that Gaussian have added a library files (a .a file).  If this happens add that particular file now&lt;br /&gt;
using &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Next we check the output of &amp;lt;code&amp;gt;hg stat -u&amp;lt;/code&amp;gt;, which shows unknown (new) files.  Firstly, we&#039;re checking here to see if there are&lt;br /&gt;
any files that &#039;&#039;aren&#039;t&#039;&#039; being ignored that should.  Examples include executables or compiled routines for which we have the source,&lt;br /&gt;
Gaussian outputs such as &amp;lt;code&amp;gt;.log&amp;lt;/code or &amp;lt;code&amp;gt;.chk&amp;lt;/code&amp;gt; files, temporary files (such as Emacs &amp;lt;code&amp;gt;filename~&amp;lt;/code&amp;gt; files), and&lt;br /&gt;
so on.  Anything that can be recreated from other things in the gdv directory is probably ignorable.  Add suitable lines to the &lt;br /&gt;
&amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file as appropriate, or just delete the file if you feel an ignore entry is not needed.&lt;br /&gt;
&lt;br /&gt;
In the output of &amp;lt;code&amp;gt;hg stat -u&amp;lt;/code&amp;gt; in this case you&#039;ll notice that the &amp;lt;code&amp;gt;test000.com&amp;lt;/code&amp;gt; files have all been renamed to &amp;lt;code&amp;gt;test0000.com&amp;lt;/code&amp;gt; files.  Mercurial initially reports this as a deletion (of &amp;lt;code&amp;gt;test000.com&amp;lt;/code&amp;gt;) and addition&lt;br /&gt;
(of &amp;lt;code&amp;gt;test0000.com&amp;lt;/code&amp;gt;).  We can get Mercurial to recognise these as renames&amp;lt;ref&amp;gt;You may be wondering why we care about renames.&lt;br /&gt;
Simply put, if changes from Gaussian that include a rename or a copy must be merged with your own changes to those files&lt;br /&gt;
(or vice versa) that it helps mercurial to know about the renames and copies.  Otherwise for a rename it only sees a file being deleted&lt;br /&gt;
and another file being created.&amp;lt;/ref&amp;gt; instead by doing this command (the&lt;br /&gt;
&amp;lt;code&amp;gt;-n&amp;lt;/code&amp;gt; flag makes &amp;lt;code&amp;gt;addremove&amp;lt;/code&amp;gt; do a dry-run.  We&#039;ll do the tests subdirectory separately, as it&#039;s probably&lt;br /&gt;
going to be fairly straightfoward.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg addremove -s 50 -n gdv/tests | less&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-s N&amp;lt;/code&amp;gt; instructs Mercurial to compare files and report renames where the contents differ by no less than N%.&lt;br /&gt;
If you set N too low then you&#039;ll see many false positives, too high and you may miss renames.  Note that the percentage&lt;br /&gt;
is based on the number of lines changed, so changes of even a few characters to a small file can produce quite low&lt;br /&gt;
similarity percentages.&lt;br /&gt;
If you leave &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; off it will still report those that are 100% the same.  In this case you&#039;ll see (after a while)&lt;br /&gt;
a huge list of lines like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 recording removal of gdv/tests/com/test370.com as rename to gdv/tests/com/test0370.com (100% similar)&lt;br /&gt;
 ...&lt;br /&gt;
 recording removal of gdv/tests/test983d-m-ref.cube as rename to gdv/tests/test0983d-m-ref.cube (83% similar)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you have to engage your knowledge of Gaussian!  In almost every instance here in the &amp;lt;code&amp;gt;tests&amp;lt;/code&amp;gt; directory&lt;br /&gt;
it&#039;s clear that these are genuine renames, with some minor modifications.  If in doubt, suspend the &amp;lt;code&amp;gt;addremove&amp;lt;/code&amp;gt;&lt;br /&gt;
command and do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg cat gdv/tests/test983d-m-ref.cube | diff - gdv/tests/test0983d-m-ref.cube | less&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which will show the nature of the changes.  Here you&#039;ll see that for reasons that probably only make sense to someone not using&lt;br /&gt;
version control, Gaussian have very slightly altered some of the values in this &amp;lt;code&amp;gt;.cube&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
You can play with the &amp;lt;code&amp;gt;-s N&amp;lt;/code&amp;gt; parameter until you get a list that is only correct renames, with no false positives&lt;br /&gt;
(if there are some false positives they can be undone before the commit, false negatives can also be added in later).  When you&#039;re happy&lt;br /&gt;
run the &amp;lt;code&amp;gt;addremove&amp;lt;/code&amp;gt; command without the &amp;lt;code&amp;gt;-n&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
I decided to go with &amp;lt;code&amp;gt;-s 50&amp;lt;/code&amp;gt;.  Once the command finishes (and it can take quite a while, particularly for low values&lt;br /&gt;
of N) you can check what&#039;s been done with &amp;lt;code&amp;gt;hg stat -a -C&amp;lt;/code&amp;gt;, which shows files that have been added, and additionally, whether&lt;br /&gt;
they are marked as copies.  If they are copies they will appear like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg stat -a -C&lt;br /&gt;
 A gdv/tests/check-of&lt;br /&gt;
 A gdv/tests/ckelap&lt;br /&gt;
 A gdv/tests/com/test0000.com&lt;br /&gt;
   gdv/tests/com/test000.com&lt;br /&gt;
 A gdv/tests/com/test0001.com&lt;br /&gt;
   gdv/tests/com/test001.com&lt;br /&gt;
 ...&lt;br /&gt;
 A gdv/tests/com/test1036.com&lt;br /&gt;
   gdv/tests/com/test872.com&lt;br /&gt;
 A gdv/tests/com/test1037.com&lt;br /&gt;
   gdv/tests/com/test872.com&lt;br /&gt;
 A gdv/tests/com/test1038.com&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
which shows &amp;lt;code&amp;gt;gdv/tests/com/test0000.com&amp;lt;/code&amp;gt; has been marked as a copy of &amp;lt;code&amp;gt;gdv/tests/com/test000.com&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
Note that &amp;lt;code&amp;gt;gdv/tests/com/test1036.com&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;gdv/tests/com/test1037.com&amp;lt;/code&amp;gt; have been marked as copies of &amp;lt;code&amp;gt;gdv/tests/com/test872.com&amp;lt;/code&amp;gt;, which has already been marked as the origin of &amp;lt;code&amp;gt;gdv/tests/com/test0872.com&amp;lt;/code&amp;gt;.&lt;br /&gt;
In certain circumstances this might be legitimate, with one file being renamed and copied (or just copied) but in this&lt;br /&gt;
case, using &amp;lt;code&amp;gt;hg diff&amp;lt;/code&amp;gt; I decide that however it&#039;s arisen, I don&#039;t want to record it.  I remove the adds and then redo them, without&lt;br /&gt;
marking them as renames:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg revert gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 $ hg stat gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 ? gdv/tests/com/test1036.com&lt;br /&gt;
 ? gdv/tests/com/test1037.com&lt;br /&gt;
 $ hg add gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 $ hg stat -C gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 A gdv/tests/com/test1036.com&lt;br /&gt;
 A gdv/tests/com/test1037.com&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now apply this same methodology to the remaining unknown files.  We are trying to get to a situation where the output of&lt;br /&gt;
&amp;lt;code&amp;gt;hgstat -du&amp;lt;/code&amp;gt; is empty.  The &amp;lt;code&amp;gt;-u&amp;lt;/code&amp;gt; flag shows files that have appeared in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory&lt;br /&gt;
but are unknown to mercurial; these are files added or renamed by Gaussian.  The &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; flag shows files&lt;br /&gt;
that are known to mercurial but are no longer in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
If you run &amp;lt;code&amp;gt;hg addremove&amp;lt;/code&amp;gt; on the&lt;br /&gt;
&amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory it will try re-add things in &amp;lt;code&amp;gt;tests&amp;lt;/code&amp;gt;, so be careful.  There&#039;s no harm in re-adding&lt;br /&gt;
files you&#039;ve already added, but you don&#039;t want to add files you&#039;ve manually removed from the list (for example,&lt;br /&gt;
&amp;lt;code&amp;gt;hg addremove -s 50 gdv&amp;lt;/code&amp;gt; will re-mark &amp;lt;code&amp;gt;gdv/tests/com/test1036.com&amp;lt;/code&amp;gt; as a copy of&lt;br /&gt;
&amp;lt;code&amp;gt;gdv/tests/com/test872.com&amp;lt;/code&amp;gt; again.  Avoid this by using the &amp;lt;code&amp;gt;-X&amp;lt;/code&amp;gt; flag to add remove:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg addremove -s 40 -n -X &#039;glob:gdv/tests/**&#039; gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If I use the above command I get a long list of files being removed and added and then at the end of list of files that&lt;br /&gt;
are being recorded as renames.  It&#039;s worth checking the list of additions and deletions, particularly scripts in the&lt;br /&gt;
&amp;lt;code&amp;gt;bsd&amp;lt;/code&amp;gt;  directory. In this case there are some scripts, but they all check out OK.  The list of renames is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 recording removal of gdv/l718/quairc.F as rename to gdv/dinautil/quairc.F (100% similar)&lt;br /&gt;
 recording removal of gdv/l718/quarot.F as rename to gdv/dinautil/quarot.F (100% similar)&lt;br /&gt;
 recording removal of gdv/l718/rotirc.F as rename to gdv/dinautil/rotirc.F (100% similar)&lt;br /&gt;
 recording removal of gdv/l120/getlfo.F as rename to gdv/utilam/getlfo.F (100% similar)&lt;br /&gt;
 recording removal of gdv/mdutil/lshift1.F as rename to gdv/mdutil/lshft1.F (73% similar)&lt;br /&gt;
 recording removal of gdv/l718/difrot.F as rename to gdv/dinautil/difrot.F (97% similar)&lt;br /&gt;
 recording removal of gdv/utilam/iiabs.F as rename to gdv/utilam/ivabs.F (82% similar)&lt;br /&gt;
 recording removal of gdv/l1/decotp.F as rename to gdv/l1/decjob.F (77% similar)&lt;br /&gt;
 recording removal of gdv/l1/decotp.F as rename to gdv/l1/decmth.F (47% similar)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
this is where some of your Gaussian intuition comes in handy.  Moving files from link subdirectories&lt;br /&gt;
to utility subdirectories is a common and expected thing.  If we inspect the &amp;lt;code&amp;gt;gdv/utilam/iiabs.F&amp;lt;/code&amp;gt; to&lt;br /&gt;
&amp;lt;code&amp;gt;gdv/utilam/ivabs.F&amp;lt;/code&amp;gt; rename we see that the files are the same apart from two one character changes.&lt;br /&gt;
Inspecting the final two renames shows that the file &amp;lt;code&amp;gt;gdv/l1/decotp.F&amp;lt;/code&amp;gt; is indeed being split&lt;br /&gt;
into two new files. Therefore I go ahead with the command without the &amp;lt;code&amp;gt;-N&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
The final task before we go ahead and commit this changeset is to check the makefile for&lt;br /&gt;
any new targets.  If these correspond to new executables we will need to add them to the&lt;br /&gt;
&amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; list.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg diff gdv/bsd/i386.make | less&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
shows us that there are two new links:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 @@ -212,7 +212,7 @@&lt;br /&gt;
          l105.exe    l106.exe    l107.exe    l108.exe    l109.exe \&lt;br /&gt;
          l110.exe    l111.exe    l112.exe    l113.exe    l114.exe    l115.exe \&lt;br /&gt;
          l116.exe    l117.exe    l118.exe    l120.exe    l121.exe \&lt;br /&gt;
 -        l122.exe    l123.exe    l124.exe    l125.exe    l202.exe&lt;br /&gt;
 +        l122.exe    l123.exe    l124.exe    l125.exe    l126.exe    l127.exe    l202.exe&lt;br /&gt;
 &lt;br /&gt;
  exe3:    l301.exe    l302.exe    l303.exe    l305.exe    l306.exe \&lt;br /&gt;
          l307.exe    l308.exe    l309.exe    l310.exe    l311.exe \ &lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and two new utilities:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ...&lt;br /&gt;
 @@ -597,6 +597,12 @@&lt;br /&gt;
  unfchk: unfchk.o&lt;br /&gt;
         $(RUNF77) $(FFLAGS) -o unfchk unfchk.o $(EXTOBJ) $(EXTRAS) $(GAULIB) $(LIBS)&lt;br /&gt;
 &lt;br /&gt;
 +gdrgen: gdrgen.o&lt;br /&gt;
 +       $(RUNF77) $(FFLAGS) -o gdrgen gdrgen.o $(EXTOBJ) $(EXTRAS) $(GAULIB) $(LIBS)&lt;br /&gt;
 +&lt;br /&gt;
 +trajgen: trajgen.o&lt;br /&gt;
 +       $(RUNF77) $(FFLAGS) -o trajgen trajgen.o $(EXTOBJ) $(EXTRAS) $(GAULIB) $(LIBS)&lt;br /&gt;
 +&lt;br /&gt;
  rdmat: rdmat.o&lt;br /&gt;
         $(RUNF77) $(FFLAGS) -o rdmat rdmat.o $(EXTOBJ) $(EXTRAS) $(GAULIB) $(LIBS)&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The links are detected by a pattern in the HG ignore file a we must add the two new utilities,&lt;br /&gt;
so that:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg diff .hgignore&lt;br /&gt;
 diff -r 8db6c9367c60 .hgignore&lt;br /&gt;
 --- a/.hgignore Thu Aug 02 11:17:35 2012 +0100&lt;br /&gt;
 +++ b/.hgignore Mon Mar 04 17:58:09 2013 +0000&lt;br /&gt;
 @@ -32,6 +32,7 @@&lt;br /&gt;
  gdv/gauopt&lt;br /&gt;
  gdv/gauoptl&lt;br /&gt;
  gdv/gautraj&lt;br /&gt;
 +gdv/gdrgen&lt;br /&gt;
  gdv/gdv&lt;br /&gt;
  gdv/gdvlb&lt;br /&gt;
  gdv/ghelp&lt;br /&gt;
 @@ -46,5 +47,6 @@&lt;br /&gt;
  gdv/rwfdump&lt;br /&gt;
  gdv/tags&lt;br /&gt;
  gdv/testrt&lt;br /&gt;
 +gdv/trajgen&lt;br /&gt;
  gdv/unfchk&lt;br /&gt;
  gdv/wrmat&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This then,represents Gaussian as it came from Gaussian Inc converted to our new format.&lt;br /&gt;
Once you are satisfied commit the revision with &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;.  There is a preferred&lt;br /&gt;
format for the&lt;br /&gt;
log message for these raw branch commits; look at one of the previous commits using&lt;br /&gt;
&amp;lt;code&amp;gt;hg log -v --rev N | less&amp;lt;/code&amp;gt; for an example.  The log message I will use for &lt;br /&gt;
this particular commit is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 Import of Gaussian version H29p.  See below for details.&lt;br /&gt;
 &lt;br /&gt;
 rm -fr gdv&lt;br /&gt;
 cp -pr ../h29p/new-style/gdv .&lt;br /&gt;
 hg addremove -s 50 gdv/tests&lt;br /&gt;
 hg revert gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 hg add gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 hg addremove -s 40 -X &#039;glob:gdv/tests/**&#039; gdv&lt;br /&gt;
&lt;br /&gt;
 and added gdrgen and trajgen to .hgignore.&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The idea is that someone should be able to replicate what you&#039;ve done &lt;br /&gt;
just by referring to the log message.&lt;br /&gt;
&lt;br /&gt;
Congratulations! You&#039;ve just added a revision to the raw branch.&lt;br /&gt;
Now tag it with the version identifier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg tag h29p-raw&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next, we must merge this version into our local branch, which represents&lt;br /&gt;
a compilable version of Gaussian in our new format. generally this only&lt;br /&gt;
requires changes to our local make files, however these changes can&lt;br /&gt;
require considerable effort.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg up local&lt;br /&gt;
 1995 files updated, 0 files merged, 1228 files removed, 0 files unresolved&lt;br /&gt;
 Added tags for local versions&lt;br /&gt;
 $ hg merge raw&lt;br /&gt;
 merging .hgignore&lt;br /&gt;
 merging .hgtags&lt;br /&gt;
 4 files to edit&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
At this point this guide will get a little hazy because I used vim&lt;br /&gt;
and you may be using some other editor.  After you type&lt;br /&gt;
&amp;lt;code&amp;gt;hg merge raw&amp;lt;/code&amp;gt; you may be presented with a graphical merge&lt;br /&gt;
tool, a text based merge tool, a particular mode of your favourite text editor,&lt;br /&gt;
a particular mode of a hated text editor, or indeed, nothing. You can customise&lt;br /&gt;
the tool that is used if you want. For the purposes of this guide quit out of the&lt;br /&gt;
tool or editor without making any changes. If you are using vim use the&lt;br /&gt;
&amp;lt;code&amp;gt;:cq&amp;lt;/code&amp;gt; command which will cause vim to return an error to mercurial&lt;br /&gt;
which tells it that the merge is not finished. Again for the purposes of this guide&lt;br /&gt;
run &amp;lt;code&amp;gt;hg resolve -a -u&amp;lt;/code&amp;gt;&lt;br /&gt;
to mark all the conflicting files&lt;br /&gt;
as unresolved.&lt;br /&gt;
&lt;br /&gt;
You should now be able to see:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg resolve -l&lt;br /&gt;
 U .hgignore&lt;br /&gt;
 U .hgtags&lt;br /&gt;
 U gdv/bsd/uber-i386.make&lt;br /&gt;
 U gdv/bsd/uber-sandyb.make&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s now resolve these four files.  First &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg resolve .hgignore&lt;br /&gt;
 merging .hgignore&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Easy enough.  If you examine the file you will see that our two&lt;br /&gt;
new executables have been added. Next:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg resolve .hgtags&lt;br /&gt;
 merging .hgtags&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For me this command starts vimdiffwith windows showing the tags file as&lt;br /&gt;
it exists in the two-parent revisions of the merge plus another window&lt;br /&gt;
where I can edit the final merged version.  Although the tags file&lt;br /&gt;
will generally look after itself I like to keep things neat so I&lt;br /&gt;
edit the file so that the knew tag, h29p, exists in the final version.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_new_gdv&amp;diff=321371</id>
		<title>Resgrp:comp-photo-version control new gdv</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_new_gdv&amp;diff=321371"/>
		<updated>2013-02-27T18:59:30Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: Created page with &amp;quot;==Introduction== This page will explain how to import a new version of gdv into the version control system.  For general help on the version control system look [[Resgrp:comp-pho...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
This page will explain how to import a new version of gdv into the version control system.  For general help on&lt;br /&gt;
the version control system look [[Resgrp:comp-photo-version control|here]].&lt;br /&gt;
&lt;br /&gt;
==How to import a new version==&lt;br /&gt;
&lt;br /&gt;
I&#039;ll assume you&#039;ve got a tarball from Gaussian, in their usual format.&lt;br /&gt;
&lt;br /&gt;
First, get a up to date copy of the &amp;lt;code&amp;gt;gaussian-inc-versions&amp;lt;/code&amp;gt; repository.  Either use &amp;lt;code&amp;gt;hg clone&amp;lt;/code&amp;gt; to&lt;br /&gt;
get a new copy or &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; an existing repository.  Make sure it&#039;s updated to the latest version (using &lt;br /&gt;
&amp;lt;code&amp;gt;hg update&amp;lt;/code&amp;gt; if necessary.&lt;br /&gt;
&lt;br /&gt;
Next, untar the tarball somewhere and process it using the old-to-new.sh script in the repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ls&lt;br /&gt;
 gdv  new-to-old.sh  old-to-new.sh  pillage.sh&lt;br /&gt;
 $ mkdir ../h29&lt;br /&gt;
 $ cd ../h29&lt;br /&gt;
 $ tar zxvf /work/scliffor/gaussian/gdvh29p.tgz&lt;br /&gt;
 $ ls&lt;br /&gt;
 gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(As ever, when using new-to-old.sh, you&#039;ll need to make sure you have a &amp;lt;code&amp;gt;gau-fsplit&amp;lt;/code&amp;gt; in your path.  I usually&lt;br /&gt;
just copy the binary from the latest compiled version to my &amp;lt;code&amp;gt;~/bin&amp;lt;/code&amp;gt; directory.)&lt;br /&gt;
&lt;br /&gt;
Now convert the code to our new [[Resgrp:comp-photo-new gdv layout|format]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ ../gaussian-inc-versions/old-to-new.sh new-style&lt;br /&gt;
 doing gdv/allxc.inc&lt;br /&gt;
 doing gdv/amber98.prm&lt;br /&gt;
 doing gdv/amber.prm&lt;br /&gt;
 doing gdv/archlib.F&lt;br /&gt;
 doing gdv/arctmp.F&lt;br /&gt;
 doing gdv/basis&lt;br /&gt;
 doing gdv/blas-generic.F&lt;br /&gt;
 doing gdv/bsd&lt;br /&gt;
 ...&lt;br /&gt;
 doing gdv/view&lt;br /&gt;
 doing gdv/vuind.inc&lt;br /&gt;
 doing gdv/wrappers.F&lt;br /&gt;
 doing gdv/wrmat.F&lt;br /&gt;
 doing gdv/xcind.inc&lt;br /&gt;
 $ ls new-style/gdv/&lt;br /&gt;
 allxc.inc       commonz.inc         ertgen.inc   l1002  l1112  l302  l405  l701  l904              mdarch      rwfcopy.F&lt;br /&gt;
 amber98.prm     copychk.F           fffcom.inc   l1003  l112   l303  l502  l702  l905              mdl1        rwfdump.F&lt;br /&gt;
 amber.prm       cphfutil            fhello.F     l1004  l113   l305  l503  l703  l906              mdutil      separ.inc&lt;br /&gt;
 archlib         crdparams.inc       filecom.inc  l101   l114   l306  l504  l705  l908              mm2.prm     tests&lt;br /&gt;
 arctmp.F        crendx.F            flddsc.inc   l1014  l115   l307  l506  l709  l909              mm.F        trajgen.F&lt;br /&gt;
 basis           cubegen.F           fldloc.inc   l102   l116   l308  l508  l715  l913              newzmatF    uff.prm&lt;br /&gt;
 blas-generic.F  cubman.F            formchk.F    l103   l117   l309  l509  l716  l914              ntran.inc   unfchk.F&lt;br /&gt;
 bsd             Default.Route.save  freqchk.F    l105   l118   l310  l510  l717  l915              oplsaa.prm  utilam&lt;br /&gt;
 c86dv.F         demofc.F            freqmem.F    l106   l120   l311  l511  l718  l916              osutil      util.hlp&lt;br /&gt;
 chkchk.F        dftba.prm           gauopt.F     l107   l121   l314  l601  l801  l918              pluck.F     utilnz&lt;br /&gt;
 chkmove.F       dftbpar.prm         gauoptl.F    l108   l122   l315  l602  l802  l920              prparm.inc  view&lt;br /&gt;
 cktoig.F        dinautil            gautraj.F    l109   l123   l316  l604  l804  l921              putil       vuind.inc&lt;br /&gt;
 commonb2.inc    doc                 gdrgen.F     l110   l124   l317  l607  l809  l922              putil.hlp   wrappers&lt;br /&gt;
 commonb.inc     dreiding.prm        ghelp.F      l1101  l125   l318  l608  l810  l923              qppar.inc   wrmat.F&lt;br /&gt;
 commonlab.inc   dummy.F             ghelp.hlp    l1102  l126   l319  l609  l811  l924              qpstat.inc  xcind.inc&lt;br /&gt;
 commonlp2.inc   dummy-link.F        grate.F      l111   l127   l320  l610  l901  l930              rdmat.F&lt;br /&gt;
 commonmol2.inc  dummy-links.F       ham506.F     l1110  l202   l401  l611  l902  l9999             reform.F&lt;br /&gt;
 commonmol.inc   dummy-narch.F       l1           l1111  l301   l402  l612  l903  lapack-generic.F  repall.inc&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It&#039;s worth having a look here to make sure nothing looks too odd.  This looks OK, so we press on.  Change back to the&lt;br /&gt;
&amp;lt;code&amp;gt;gaussian-inc-versions&amp;lt;/code&amp;gt; directory, delete the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory, and replace it with the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt;&lt;br /&gt;
directory you just created.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ cd ../gaussian-inc-versions&lt;br /&gt;
 $ rm -fr gdv&lt;br /&gt;
 $ cp -pr ../h29/new-style/gdv/ .&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we have the new code, in our format, in the repository.  Our job now is to prepare a commit that will correctly represent the changes&lt;br /&gt;
that have been made by Gaussian.&lt;br /&gt;
&lt;br /&gt;
The first task is to check that our ignore filter isn&#039;t hiding any changes we want to include.  We can do this with &amp;lt;code&amp;gt;hg stat -i&amp;lt;/code&amp;gt;.&lt;br /&gt;
If you do this in this case, you&#039;ll see that the only things being ignored are the log files of test jobs, which we don&#039;t keep in the&lt;br /&gt;
repository.  Sometimes you&#039;ll see that Gaussian have added a library files (a .a file).  If this happens add that particular file now&lt;br /&gt;
using &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Next we check the output of &amp;lt;code&amp;gt;hg stat -u&amp;lt;/code&amp;gt;, which shows unknown (new) files.  Firstly, we&#039;re checking here to see if there are&lt;br /&gt;
any files that *aren&#039;t* being ignored that should.  Examples include executables or compiled routines for which we have the source,&lt;br /&gt;
Gaussian outputs such as &amp;lt;code&amp;gt;.log&amp;lt;/code or &amp;lt;code&amp;gt;.chk&amp;lt;/code&amp;gt; files, temporary files (such as Emacs &amp;lt;code&amp;gt;filename~&amp;lt;/code&amp;gt; files), and&lt;br /&gt;
so on.  Anything that can be recreated from other things in the gdv directory is probably ignorable.  Add suitable lines to the &lt;br /&gt;
&amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file as appropriate, or just delete the file if you feel an ignore entry is not needed.&lt;br /&gt;
&lt;br /&gt;
In the output of &amp;lt;code&amp;gt;hg stat -u&amp;lt;/code&amp;gt; in this case you&#039;ll notice that the &amp;lt;code&amp;gt;test000.com&amp;lt;/code&amp;gt; files have all been renamed to &amp;lt;code&amp;gt;test0000.com&amp;lt;/code&amp;gt; files.  Mercurial initially reports this as a deletion (of &amp;lt;code&amp;gt;test000.com&amp;lt;/code&amp;gt;) and addition&lt;br /&gt;
(of &amp;lt;code&amp;gt;test0000.com&amp;lt;/code&amp;gt;).  We can get Mercurial to recognise these as renames instead by doing this command (the&lt;br /&gt;
&amp;lt;code&amp;gt;-n&amp;lt;/code&amp;gt; flag makes &amp;lt;code&amp;gt;addremove&amp;lt;/code&amp;gt; do a dry-run.  We&#039;ll do the tests subdirectory separately, as it&#039;s probably&lt;br /&gt;
going to be fairly straightfoward.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg addremove -s 50 -n gdv/tests | less&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-s N&amp;lt;/code&amp;gt; instructs Mercurial to compare files and report renames where the contents differ by no less than N%.&lt;br /&gt;
If you set N too low then you&#039;ll see many false positives, too high and you may miss renames.&lt;br /&gt;
If you leave &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; off it will still report those that are 100% the same.  In this case you&#039;ll see (after a while)&lt;br /&gt;
a huge list of lines like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 recording removal of gdv/tests/com/test370.com as rename to gdv/tests/com/test0370.com (100% similar)&lt;br /&gt;
 ...&lt;br /&gt;
 recording removal of gdv/tests/test983d-m-ref.cube as rename to gdv/tests/test0983d-m-ref.cube (83% similar)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now you have to engage your knowledge of Gaussian!  In almost every instance here in the &amp;lt;code&amp;gt;tests&amp;lt;/code&amp;gt; directory&lt;br /&gt;
it&#039;s clear that these are genuine renames, with some minor modifications.  If in doubt, suspend the &amp;lt;code&amp;gt;addremove&amp;lt;/code&amp;gt;&lt;br /&gt;
command and do something like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg cat gdv/tests/test983d-m-ref.cube | diff - gdv/tests/test0983d-m-ref.cube | less&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
which will show the nature of the changes.  Here you&#039;ll see that for reasons that probably only make sense to someone not using&lt;br /&gt;
version control, Gaussian have very slightly altered some of the values in this &amp;lt;code&amp;gt;.cube&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
You can play with the &amp;lt;code&amp;gt;-s N&amp;lt;/code&amp;gt; parameter until you get a list that is only correct renames, with no false positives&lt;br /&gt;
(if there are some false positives they can be undone before the commit, false negatives can also be added in later).  When you&#039;re happy&lt;br /&gt;
run the &amp;lt;code&amp;gt;addremove&amp;lt;/code&amp;gt; command without the &amp;lt;code&amp;gt;-n&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
I decided to go with &amp;lt;code&amp;gt;-s 50&amp;lt;/code&amp;gt;.  Once the command finishes (and it can take quite a while, particularly for low values&lt;br /&gt;
of N) you can check what&#039;s been done with &amp;lt;code&amp;gt;hg stat -a -C&amp;lt;/code&amp;gt;, which shows files that have been added, and additionally, whether&lt;br /&gt;
they are marked as copies.  If they are copies they will appear like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg stat -a -C&lt;br /&gt;
 A gdv/tests/check-of&lt;br /&gt;
 A gdv/tests/ckelap&lt;br /&gt;
 A gdv/tests/com/test0000.com&lt;br /&gt;
   gdv/tests/com/test000.com&lt;br /&gt;
 A gdv/tests/com/test0001.com&lt;br /&gt;
   gdv/tests/com/test001.com&lt;br /&gt;
 ...&lt;br /&gt;
 A gdv/tests/com/test1036.com&lt;br /&gt;
   gdv/tests/com/test872.com&lt;br /&gt;
 A gdv/tests/com/test1037.com&lt;br /&gt;
   gdv/tests/com/test872.com&lt;br /&gt;
 A gdv/tests/com/test1038.com&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
which shows &amp;lt;code&amp;gt;gdv/tests/com/test0000.com&amp;lt;/code&amp;gt; has been marked as a copy of &amp;lt;code&amp;gt;gdv/tests/com/test000.com&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
Note that &amp;lt;code&amp;gt;gdv/tests/com/test1036.com&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;gdv/tests/com/test1037.com&amp;lt;/code&amp;gt; have been marked as copies of &amp;lt;code&amp;gt;gdv/tests/com/test872.com&amp;lt;/code&amp;gt;, which has already been marked as the origin of &amp;lt;code&amp;gt;gdv/tests/com/test0872.com&amp;lt;/code&amp;gt;.&lt;br /&gt;
In certain circumstances this might be legitimate, with one file being renamed and copied (or just copied) but in this&lt;br /&gt;
case, using &amp;lt;code&amp;gt;hg diff&amp;lt;/code&amp;gt; I decide that however it&#039;s arisen, I don&#039;t want to record it.  I remove the adds and then redo them, without&lt;br /&gt;
marking them as renames:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg revert gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 $ hg stat gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 ? gdv/tests/com/test1036.com&lt;br /&gt;
 ? gdv/tests/com/test1037.com&lt;br /&gt;
 $ hg add gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 $ hg stat -C gdv/tests/com/test1036.com gdv/tests/com/test1037.com&lt;br /&gt;
 A gdv/tests/com/test1036.com&lt;br /&gt;
 A gdv/tests/com/test1037.com&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We now apply this same methodology to the remaining unknown files.  If you run &amp;lt;code&amp;gt;hg addremove&amp;lt;/code&amp;gt; on the&lt;br /&gt;
&amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory it will try re-add things in &amp;lt;code&amp;gt;tests&amp;lt;/code&amp;gt;, so be careful.  There&#039;s no harm in re-adding&lt;br /&gt;
files you&#039;ve already added, but you don&#039;t want to add files you&#039;ve manually removed from the list (for example,&lt;br /&gt;
&amp;lt;code&amp;gt;hg addremove -s 50 gdv&amp;lt;/code&amp;gt; will re-mark &amp;lt;code&amp;gt;gdv/tests/com/test1036.com&amp;lt;/code&amp;gt; as a copy of&lt;br /&gt;
&amp;lt;code&amp;gt;gdv/tests/com/test872.com&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to be continued&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=321134</id>
		<title>Resgrp:comp-photo-version control</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=321134"/>
		<updated>2013-02-27T16:07:05Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: /* Added link to import new gdv page */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This document will teach you the basics of using mercurial, a distributed version control system (DVCS).  It is particularly directed towards using mercurial with the development version of Gaussian, so the examples will use Gaussian.  For more information on mercurial you can use the built-in help system &amp;lt;code&amp;gt;hg help&amp;lt;/code&amp;gt;, look at the official website: http://mercurial.selenic.com/wiki/Mercurial, or check out the official O&#039;Reilly book, the text of which is freely available at: http://hgbook.red-bean.com/.&lt;br /&gt;
&lt;br /&gt;
A version control system can sometimes seem an onerous imposition unless the user understands how it is going to help them in their work, so I&#039;ll try to briefly explain.  Version control is about tracking changes to data.  If one has a collection of files, say a distribution of Gaussian, then one is interested in changes that have been made to those files, whether from a new distribution from Gaussian or our own modifications.  We are particularly interested in cases where overlapping changes have been made.  These might be updates and bug fixes from Gaussian conflicting with our own modifications to a particular link, or it might be different researchers in a group working on the same piece of code independently.  A version control system will not only detect such cases but provide automated and safe methods for merging conflicting changes.&lt;br /&gt;
&lt;br /&gt;
Central to the idea of a VCS is the concept of a revision or changeset.  This is like a snapshot of some set of files and directories at some particular instant in their history.  A repository is where a VCS stores revisions.  So, using Gaussian as an example, some revisions in a particular repository might be the Gaussian source tree corresponding to Gaussian development versions H01, H08, H10, H11, etc.  The data that are actually kept inside the repository are the differences, or deltas, between the revisions.  This saves space compared to storing all the revisions.&lt;br /&gt;
&lt;br /&gt;
== Short version ==&lt;br /&gt;
&lt;br /&gt;
I&#039;ve made a summary version of this document [[Resgrp:comp-photo-version control short|here]].&lt;br /&gt;
I&#039;ve also made an [[Resgrp:comp-photo-version control example|example workflow]].&lt;br /&gt;
Also here is [[Resgrp:comp-photo-version control new gdv|how to import a new version of the gdv]].&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment (.hgrc)==&lt;br /&gt;
There are some one-off things you must do.  Firstly, edit your login scripts (&amp;lt;code&amp;gt;.bash_profile&amp;lt;/code&amp;gt; or similar) to include the command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 module load mercurial&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(If you&#039;re not on an IC HPC machine mercurial is available anywhere that runs Python.  It is generally available in distribution package systems, if not you can get it from http://mercurial.selenic.com/wiki/Mercurial).  Note that the Redhat provided mercurial on RHEL 5 and 6 is quite old and does not, at time of writing, support the repositories I have created.&lt;br /&gt;
&lt;br /&gt;
Next, create a file called &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; in your home directory and insert the following lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 username = Your Name &amp;lt;your@email.address&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(so for example, my &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; contains this line: &amp;lt;code&amp;gt;username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
Mercurial uses this username field to record who has changed what.  (If you&#039;re not on an IC HPC machine your version of mercurial may not&lt;br /&gt;
have the graphlog extension.  If it doesn&#039;t, don&#039;t worry, it&#039;s merely a tool for visualising changesets).&lt;br /&gt;
&lt;br /&gt;
== Checking out a repository (hg clone, hg log) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s get started and check out a repository.  Once you have loaded the mercurial module you will be able to type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussian-devel/example-gaussian-repo testrepo&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a copy of the repository at &amp;lt;code&amp;gt;/home/gaussian-devel/example-gaussian-repo&amp;lt;/code&amp;gt; and place it in a directory inside the current directory called &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt;.  You can give a full path as the second argument, or, you can leave it off altogether in which case mercurial will clone the repository into a directory named &amp;lt;code&amp;gt;example-gaussian-repo&amp;lt;/code&amp;gt;.  A note here for Imperial HPC users.  Copying a repository involves quite a bit of filesystem activity.  I have found that on cx1 this can be quite slow on the &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; filesystems.  You may wish to try these examples in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; filesystem which is a lot faster.  Be aware, however, that this raises two potentially serious problems.  The first is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is globally readable so before you clone you must make sure that your umask is set to &amp;lt;code&amp;gt;0077&amp;lt;/code&amp;gt;.  The second, of course, is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is periodically wiped.  If you plan on working in &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; there are simple ways of transferring information between repositories (&amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt;) that I will cover later.&lt;br /&gt;
&lt;br /&gt;
Now change into the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory.  Inside you will see three scripts and a &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory; also some hidden files and a hidden directory.  Inside the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory you will see the Gaussian source in the [[Resgrp:comp-photo-new gdv layout|new layout]].  The hidden &amp;lt;code&amp;gt;.hg&amp;lt;/code&amp;gt; directory inside the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory is the repository proper; you will almost never need to do anything in here.  The rest of the files and directories are called the working directory; this is where you will do your work.&lt;br /&gt;
&lt;br /&gt;
The first thing you might want to do is check the history of this repository to see past revisions that have been checked into it.  You do this with the &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log | head -20&lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 &lt;br /&gt;
 changeset:   22:6c81eb8dcbab&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      21:5b6ac3665a29&lt;br /&gt;
 parent:      11:a0c273aeeb2b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:08 2012 +0000&lt;br /&gt;
 summary:     Gaussian devel version H13 with our makefiles&lt;br /&gt;
 &lt;br /&gt;
 changeset:   21:5b6ac3665a29&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:41:40 2012 +0000&lt;br /&gt;
 summary:     Added tag h12p for changeset 0ef14d7dff56&lt;br /&gt;
 ...&lt;br /&gt;
 changeset:   1:515a93bfc3b5&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:10 2012 +0000&lt;br /&gt;
 summary:     Added tag h01-raw for changeset 073d6aa63ea7&lt;br /&gt;
 &lt;br /&gt;
 changeset:   0:073d6aa63ea7&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h01-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:09 2012 +0000&lt;br /&gt;
 summary:     Output from old-to-new.sh on version H01&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
You will see that there are various fields that may appear for each changeset.  The changeset field shows two numbers separated by a colon.  The second, longer, hexadecimal number is the unique identifier.  A particular hex identifier will always refer to the same changeset, even in different copies of the repository.  The first number is a local identifier.  These local IDs refer to particular changesets in one copy of the repository; if these changesets are present in another repository they may have a different local identifier.    You can use either identifier as an argument to &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands.  The user and date fields show who committed the change and when.  The summary field shows the first line of the log entry for that revision.  This means it is important to try to make the first line of your log entries a useful summary of what you have done!&lt;br /&gt;
&lt;br /&gt;
To see the entry for a particular revision use the &amp;lt;code&amp;gt;-r&amp;lt;/code&amp;gt; flag with a revision number, either short or long.  To see more information, including the full log entry and a complete list of all files involved in the change, use the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag, e.g.:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -r 2 -v | less&lt;br /&gt;
 changeset:   2:9f69ed4616ad&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h08-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:54:50 2012 +0000&lt;br /&gt;
 files:       gdv/archlib/arcvib.F gdv/archlib/brcpyw.F gdv/archlib/letset.F gdv/arctmp.F gdv/bsd/GauDiff_Compare.pm gdv/bsd/G&lt;br /&gt;
 ....&lt;br /&gt;
 at.F gdv/utilnz/xpndnb.F gdv/utilnz/zerock.F gdv/utilnz/zerod.F gdv/wrappers/ggeev.F gdv/wrappers/lappar.F gdv/wrappers/xgetrf.F  gdv/wrappers/xgetrs.F gdv/wrappers/ygeru.F gdv/wrappers/ytrsv.F&lt;br /&gt;
 description:&lt;br /&gt;
 Import of gdv H08.  See below for details.&lt;br /&gt;
 &lt;br /&gt;
 Result of these commands on the H01 raw rev:&lt;br /&gt;
 rm -fr gdv&lt;br /&gt;
 cp -pr h08/new-style-gdv .&lt;br /&gt;
 hg add gdv/bsd/*.a&lt;br /&gt;
 hg addremove -s 50&lt;br /&gt;
 &lt;br /&gt;
 h08/new-style is from old-to-new.sh on freshly untarred h08.tgz&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
As the log entry explains, this particular revision is the change from the H01 version of Gaussian to the H08 version, so there are a lot of changed files.  The description entry is intended to provide some human readable explanation of the changes.  When you start committing data to the repository you should aim to at least make your log entries understandable.&lt;br /&gt;
&lt;br /&gt;
As with all the commands that I will mention you can get more information by typing &amp;lt;code&amp;gt;hg help &amp;lt;command&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Committing changes (hg summary, hg status, hg diff) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make some alterations to this repository.  This is quite safe; we can&#039;t break the original repository because our copy is an entirely separate clone.  In fact, this is a very common working practice with mercurial.  As long as the filesystem isn&#039;t slow cloning a repository can be quite quick.  Indeed, cloning a repository into a destination on the same filesystem as the source makes use of hard linking which is very fast and saves space.  Therefore, it is very common to clone a repository, make some alterations to it, and then decide whether to push them back to the original repository or just delete the new clone.&lt;br /&gt;
&lt;br /&gt;
First, we want to know where it is we are starting from.  To get a quick summary you use the &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; command.  This should show something like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg summary&lt;br /&gt;
 parent: 23:1de40efd1c4b tip&lt;br /&gt;
 Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 branch: default&lt;br /&gt;
 commit: (clean)&lt;br /&gt;
 update: (current)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows, on the parent line, the revision that has been checked out into the working directory.  Below that is the summary line from the log entry for that revision.  The commit line shows if any files have been modified since the check out.  The update line shows if there are any applicable newer revisions in the repository.  In this example the output shows us that we checked out the revision with the local identifier 23, and unique identifier of 1de40efd1c4b, that we have modified nothing and that there are no appropriate newer revisions.  This checkout occurred automatically as a part of the &amp;lt;code&amp;gt;hg clone&amp;lt;/code&amp;gt; command.  You can clone without checking anything out into the working directory (say to make a backup copy of the repository) by passing the &amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; flag, or you can check out a particular revision with the &amp;lt;code&amp;gt;-u REV&amp;lt;/code&amp;gt; flag.  See &amp;lt;code&amp;gt;hg help clone&amp;lt;/code&amp;gt; for how mercurial chooses what to check out by default.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say we&#039;re adding a feature to link 510.  If you have something in mind go ahead and do it. For this example I have just added a few lines to the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, and will assume that your current working directory is &amp;lt;code&amp;gt;gdv/l510&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As you work you may be curious to know what it is you have changed.  The command to show this is &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The output shows a list of files that have been altered in some way.  Here the capital M shows that the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified.  By default &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; does not report on unchanged files.  If we wish to see how &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified we can use the &amp;lt;code&amp;gt;hg diff&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 11:07:55 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Add super new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows the output in a unified different format, refer to the man page for diff for more information.&lt;br /&gt;
&lt;br /&gt;
== Adding, copying, renaming, and deleting file (hg add, hg forget, hg mv, hg rm, hg cp) ==&lt;br /&gt;
&lt;br /&gt;
If you have created a new file then you must let mercurial know about its existence with the &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ echo &amp;quot;a new subroutine&amp;quot; &amp;gt; foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 ? gdv/l510/foo.F&lt;br /&gt;
 testrepo$ hg add foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here, I create a new file called &amp;lt;code&amp;gt;foo.F&amp;lt;/code&amp;gt;.  &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with a ?,  to indicate that it is unknown to the repository.  I then run &amp;lt;code&amp;gt;hg add foo.F&amp;lt;/code&amp;gt;, after which &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with an A.  This indicates that the file is scheduled to be added at the next commit.  If you change your mind about the file before the next commit you can use &amp;lt;code&amp;gt;hg forget&amp;lt;/code&amp;gt; to undo the add.&lt;br /&gt;
&lt;br /&gt;
If you are renaming a file, including the situation where you move the file from one directory to another (e.g. from l510 to utilam) then you may use the &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; command.  This will actually perform the move just like the normal &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; command.  If you&#039;ve already moved the file you can give &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; the &amp;lt;code&amp;gt;-A&amp;lt;/code&amp;gt; flag to record the rename after the fact.  Similarly, the &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt; command removes files from the working directory and records this fact in the repository, and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; copies a file.&lt;br /&gt;
&lt;br /&gt;
It is important to realise that these commands act on the working directory immediately but only affect the repository when they are committed.  Also, they do not affect the repository&#039;s previous history, so removing a file and then committing that change does not affect that file&#039;s existence in previous revisions in the repository.  However, &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; create a relationship between the source and destination files.  This becomes useful when merging in changes from somewhere else.  So for example, above I have made changes to &amp;lt;code&amp;gt;l510/a1tdep.F&amp;lt;/code&amp;gt;.  Let&#039;s say that someone else has decided to make this into a utility routine and has done the command &amp;lt;code&amp;gt;hg mv l510/a1tdep.F utilam/a1tdep.F&amp;lt;/code&amp;gt;.  If I choose to merge my changes with this other person&#039;s, mercurial will correctly apply the changes &#039;&#039;&#039;and&#039;&#039;&#039; move the file.  If instead of &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; they had used &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; then my changes would be applied to both files.  This means that you should only use &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; when it is appropriate that changes that are recorded before the copy are applied to both files.  Note that this does not mean that changes to the source file are forever applied to the destination file; this will only occur when merging a revision that does not contain a copy with a revision that does.  In general, you can expect mercurial to do the right thing.&lt;br /&gt;
&lt;br /&gt;
== Committing the changes (hg commit, hg tip) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt; (like many &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands, &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commit has an alias, in this case &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;.  I tend to use &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;) command creates a new revision and records the differences between the entire working directory and the parent revision (as shown on the parent line of &amp;lt;code&amp;gt;hg summary).  This will be the same as the output from &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;.  When you run the command mercurial will open a text editor.  If you wish to specify which editor is used add an &amp;lt;code&amp;gt;editor=vim&amp;lt;/code&amp;gt; (for example) line to the &amp;lt;code&amp;gt;[ui]&amp;lt;/code&amp;gt; part of your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file.  The editor will start with a couple of empty lines and then some lines beginning with &amp;quot;&amp;lt;code&amp;gt;HG:&amp;lt;/code&amp;gt;&amp;quot;.  These are there to give you helpful reminders of what you&#039;ve changed while you write your log message and will be ignored by mercurial when you commit.  If you close the editor without writing anything, or of the editor quits with an error, mercurial will abort the commit.  So for our current example:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci&lt;br /&gt;
 ... [opens vim]&lt;br /&gt;
 HG: Enter commit message.  Lines beginning with &#039;HG:&#039; are removed.&lt;br /&gt;
 HG: Leave message empty to abort commit.&lt;br /&gt;
 HG: --&lt;br /&gt;
 HG: user: Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 HG: branch &#039;default&#039;&lt;br /&gt;
 HG: added gdv/l510/foo.F&lt;br /&gt;
 HG: changed gdv/l510/a1tdep.F&lt;br /&gt;
 ~&lt;br /&gt;
 ~&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For short messages you can skip the editor step by passing the &amp;lt;code&amp;gt;-m &amp;quot;Log message here&amp;quot;&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
Understanding what you are doing here is essential to knowing what to write in the log and, importantly, when to commit.  There are two schools of thought.  When you commit you are creating a new revision in your local repository.  Since it is your repository, and as I have previously mentioned, it is very simple to create new repositories, you should commit whenever you feel like it and feel free to write cryptic log messages that only you will understand.  On the other hand, you are engaged in a collaborative exercise with other people: creating what will be a single version of Gaussian that contains yours and others&#039; modifications and Gaussian&#039;s updates.  Therefore, you should only commit when your code satisfies pre-agreed group requirements, and your log message should be detailed and comprehensible to anybody who reads it, even 50 years in the future.  The correct approach, of course, is to do both.&lt;br /&gt;
&lt;br /&gt;
Mercurial is a distributed version control system which means that each repository is the responsibility of its owner who can feel free to commit as frequently (or infrequently) as needed.  Sometimes adding a feature or removing a bug might take weeks, and you might feel that there is no point taking snapshots of the code until it works.  Other modifications might proceed incrementally with naturally defined stopping points between the start and the end.  Committing at these points makes perfect sense: not only does it leave a history of the modification, it provides checkpoints, versions of the code that you can retreat to without having to start again.  The log messages may tersely explain what has happened since the last revision (and note there is no point listing modified, added, etc, files as this information is stored in the commit anyway) or they may contain detailed essays on how a bug arose and the steps you have taken to fix it.  Information in the logs is searchable and should be thought of as both an aide memoir for yourself and a journal entry for others.&lt;br /&gt;
&lt;br /&gt;
When the time comes to merge your changes into other people&#039;s repositories, you might start thinking about the quality of your commit.  Does the code compile?  Does it run the test suite?  Can it run any test?  Have you committed a test that checks the code you have added or altered?  The group may decide that revisions that are being shared must answer yes to some or all of these questions.  You may decide that some or all of your revisions must pass these quality checks.  Or, you may be satisfied with noting in the log entry what this particular revision can or can&#039;t do (such as compile or run).&lt;br /&gt;
&lt;br /&gt;
It should be said though, that if you ever think &amp;quot;perhaps I should check in at this point&amp;quot;, then go for it.  Revisions live in the history of your repository forever (although see &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;), but when you transfer them to other people&#039;s repositories multiple revisions can be collapsed into one, or fixed in other ways.&lt;br /&gt;
&lt;br /&gt;
Returning to our example I enter a simple message.  Since &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; only shows the first line of any log entry by default it is a good idea to make this line a summary of the rest of the message.  I close the editor and the commit is done.&lt;br /&gt;
&lt;br /&gt;
We can see the results in the repository with an &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command (the &amp;lt;code&amp;gt;-l 2&amp;lt;/code&amp;gt; flag shows the last two revisions):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -l 2&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 summary:     A test message.&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Alternatively we can use the &amp;lt;code&amp;gt;hg tip&amp;lt;/code&amp;gt; command to show the most recently added repository, whether by ourselves, or by pulling from another repository (see later).&lt;br /&gt;
&lt;br /&gt;
== Fixing mistakes (hg revert, hg rollback) ==&lt;br /&gt;
&lt;br /&gt;
You can return one or more files, or the entire repository, to the state they were in when you last checked them out with in the &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; command.  Let&#039;s make an ill-advised alteration to our now committed change to &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ sed -i &#039;s/super/super duper/&#039; a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 13ecff0136c2 gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 17:23:42 2012 +0000&lt;br /&gt;
 @@ -27,7 +27,7 @@&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
  c&lt;br /&gt;
 -c     Add super new feature&lt;br /&gt;
 +c     Add super duper new feature&lt;br /&gt;
  c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ? gdv/l510/a1tdep.F.orig&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 testrepo$ rm a1tdep.*&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ! gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I use revert to undo the modifications to a file.  Notice that &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; leaves a copy of the modified file in &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt;.  This shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as an unknown file (&amp;quot;?&amp;quot;).  Also notice that while trying to delete the .orig file I have accidentally deleted &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, which now shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as a missing file (&amp;quot;!&amp;quot;).  I can revert this mistake too:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 testrepo$ ls a1tdep.F&lt;br /&gt;
 a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; can also be used to cancel scheduled adds, removes, copies, and renames.&lt;br /&gt;
&lt;br /&gt;
If you have just committed a revision and then change your mind you may be able to undo the effect with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;.  Doing this for our example gives us:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg rollback&lt;br /&gt;
 repository tip rolled back to revision 23 (undo commit)&lt;br /&gt;
 working directory now based on revision 23&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This removes the revision we just checked in from the repository but does not alter the current working directory.  If we choose, we could now use &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; to restore these to their revision 23 state.  There are two important caveats with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;: it can only remove the last checked in revision, and that it is usually pointless to rollback a revision that has already been pushed or pulled (see later) into somebody else&#039;s repository, as we can only affect our repository.  For the purposes of this example, I will once more check in the changes I have made:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci -m &#039;A test message&#039;&lt;br /&gt;
 testrepo$ hg tip&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:38:52 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Collaboration (hg incoming, hg pull, hg outgoing, hg push, hg update, hg parent) ==&lt;br /&gt;
&lt;br /&gt;
The tools described are already quite useful, and form the basis of the very earliest revision control systems.  The benefits of being able to detect what you&#039;ve changed, and how you&#039;ve changed it, being able to undo the changes selectively, and being able to take a snapshot of your work at any point of your choosing should be apparent.  The true power, however, of a modern version control system is how it mediates different streams of changes, particularly those from other users.  Note that a DVCS does not solve problems of merging and so on, but provides you, the user, with tools to solve them.&lt;br /&gt;
&lt;br /&gt;
Revisions in the repository form a directed acyclic graph (DAG).  Every revision apart from the first has at least one parent revision and may have zero or more child revisions.  A revision with no children is called a &#039;&#039;head&#039;&#039;.  Generally development takes place at a head of the repository: checking in a new revision onto a head creates and consumes a head.  However, it is possible to add a child to any revision, possibly creating a new head.  This is known as a branch, and may be named or unnamed.  A revision with children may still be a branch head if it has no children on its branch.&lt;br /&gt;
&lt;br /&gt;
There are various ways of managing branches.  You can have a few repositories with many branches, named and unnamed.  Or you can have many repositories with largely unbranched graphs; it&#039;s up to you.  Since mercurial uses heads as the default targets for some of its operations the latter approach is probably best for beginners as it makes operations within each repository simpler.&lt;br /&gt;
&lt;br /&gt;
This is probably best illustrated with an example.  I&#039;ll make a copy of the original repository, make a different change, and then merge the changes.  Change directory out of the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussiandevel/example-gaussian-repo testmerge&lt;br /&gt;
 updating to branch default&lt;br /&gt;
 13427 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we go into the new repository and make some modifications.  This time I alter the files &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;a2tdep.F&amp;lt;/code&amp;gt;, and add a file &amp;lt;code&amp;gt;bar.F&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 …[alterations to a1tdep.F, a2tdep.F, and bar.F]...&lt;br /&gt;
 testmerge$ hg add gdv/l510/bar.F&lt;br /&gt;
 testmerge$ hg diff&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Some new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a2tdep.F&lt;br /&gt;
 --- a/gdv/l510/a2tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a2tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -16,6 +16,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **DETERMINE IF WE RUN THE TIMEDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Super duper feature here too&lt;br /&gt;
 +c&lt;br /&gt;
        LenTst=0&lt;br /&gt;
        CALL FILEIO(11,jTDep,LenTst,0,0)&lt;br /&gt;
        IF (LenTst.EQ.0.OR.iopv.NE.23)RETURN&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/bar.F&lt;br /&gt;
 --- /dev/null   Thu Jan 01 00:00:00 1970 +0000&lt;br /&gt;
 +++ b/gdv/l510/bar.F    Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -0,0 +1,1 @@&lt;br /&gt;
 +Stuff in here&lt;br /&gt;
 testmerge$&lt;br /&gt;
 testmerge$ hg ci -m &#039;Added second new feature&#039;&lt;br /&gt;
 testmerge$ hg log -l 2&lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The situation now is that we have two repositories where there are revisions whose parent is revision 23 (23:1de40efd1c4b, in fact).  This sort of scenario might arise because we have been working on two different features in two different repositories, or it may be that two users have been working separately.  At some point you may wish to merge the work.  It&#039;s up to you when and how you do this: you may wish to merge in bug fixes quite frequently, and incorporate brand-new features much less frequently.  You can of course clone another repository in which to do the merge so that if it isn&#039;t satisfactory you can just delete the repository.&lt;br /&gt;
&lt;br /&gt;
First we must pull the revisions from one repository to another.  We use the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pull&amp;lt;/code&amp;gt; commands to do this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg incoming ../testrepo&lt;br /&gt;
 comparing with ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testmerge$ hg pull ../testrepo&lt;br /&gt;
 pulling from ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 adding changesets&lt;br /&gt;
 adding manifests&lt;br /&gt;
 adding file changes&lt;br /&gt;
 added 1 changesets with 2 changes to 2 files (+1 heads)&lt;br /&gt;
 (run &#039;hg heads&#039; to see heads, &#039;hg merge&#039; to merge)&lt;br /&gt;
 testmerge$ hg log -l 3&lt;br /&gt;
 changeset:   25:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 &lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command takes another repository as its argument and shows a list of revisions that are not present in the current repository.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command brings those revisions over into the current repository.  The &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command shows changeset 25 in the testmerge repository corresponds to number 24 in the original &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository.  Note the long ID is the same in both cases.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command reports that it has created a new head.  We can see this clearly with the &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt; command (from the graphlog extension). The &amp;lt;code&amp;gt;-r 23:&amp;lt;/code&amp;gt; flag tells &amp;lt;code&amp;gt;glog&amp;lt;/code&amp;gt; to show revisions 23 and greater, for clarity:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -r 23:&lt;br /&gt;
 o  changeset:   25:13ecff0136c2&lt;br /&gt;
 |  tag:         tip&lt;br /&gt;
 |  parent:      23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 |  summary:     A test message&lt;br /&gt;
 |&lt;br /&gt;
 | @  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; command can also be used to copy revisions from one repository to another.  It works much as you would expect, except that by default it does not permit the creation of new heads in the destination repository.  The idea is that you tend to pull into your own repository, where you&#039;re expected to know what you&#039;re doing, while you might be pushing into someone else&#039;s repository, where creating a new head might cause confusion.  &amp;lt;code&amp;gt;hg outgoing&amp;lt;/code&amp;gt; is the corresponding analogue to the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
In our example we now have a situation where we have two heads.  This can arise from revisions being created in different repositories and then pulled together, as shown.  Alternatively you can just create new heads in one repository.  A disadvantage of the single repository technique is that if you decide branch is going nowhere and elect not to merge or proceed with it, it still remains in your repository.  With multiple repositories you can just delete the offending repository.&lt;br /&gt;
&lt;br /&gt;
== Merging two sets of changes (hg merge, hg resolve) ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say that I decide that these two features will work together and I want to merge the two branches.  I can use the &amp;lt;code&amp;gt;hg up&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;hg update&amp;lt;/code&amp;gt;) command to update the current working directory to a particular revision in the repository.  If no revision is specified it will update to the current branch head.  The revision updated to becomes the parent (as shown by &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg parent&amp;lt;/code&amp;gt;) of the working directory.  If there are modified files in the working directory the update may attempt a merge.  The revision of the working directory when you start to merge is called the base of the merge.  This is important if the two revisions you are merging are on different branches, because the newly merged revision will stay on the base branch.  Note that the &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command does not update the working directory, so in this case it will still be at revision 24.  Let&#039;s update to revision 25 and then merge the changes from revision 24:&lt;br /&gt;
&lt;br /&gt;
[Which revision to merge from: in general you merge changes into whatever is your current baseline.  So, if you&#039;re merging the latest updates from Gaussian (from H10 to H11 for example) into your code, you update to your code and merge in the H11 revision.  If you&#039;re merging in your changes into the soon to be sent to Gaussian group development version you&#039;d start with that and merge in the revision(s) containing your changes]&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg up 25&lt;br /&gt;
 3 files updated, 0 files merged, 1 files removed, 0 files unresolved&lt;br /&gt;
 testmerge$ hg merge 24&lt;br /&gt;
 merging gdv/l510/a1tdep.F&lt;br /&gt;
 warning: conflicts during merge.&lt;br /&gt;
 merging gdv/l510/a1tdep.F failed!&lt;br /&gt;
 2 files updated, 0 files merged, 0 files removed, 1 files unresolved&lt;br /&gt;
 use &#039;hg resolve&#039; to retry unresolved file merges or &#039;hg update -C .&#039; to abandon&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The software automatically brings in the changes to foo.F, bar.F, and a2tdep.F (as &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; will show).  However, in our contrived example &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; is subject to changes from both revisions.  Mercurial will attempt to merge automatically, and in this case it fails.  If you edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; you will see it contains the lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 =======&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
which were inserted during the failed merge.  There is also an &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt; file created as a result of the failed merge.  As the output from &amp;lt;code&amp;gt;hg merge&amp;lt;/code&amp;gt; says you can either now resolve this failed merge or use &amp;lt;code&amp;gt;hg update -C&amp;lt;/code&amp;gt; to undo it (the &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; file will remain).&lt;br /&gt;
&lt;br /&gt;
Since we want to resolve the merge we should edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; so that it works.  At a bare minimum we will have to remove the “&amp;lt;code&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&amp;lt;/code&amp;gt;”, “&amp;lt;code&amp;gt;=======&amp;lt;/code&amp;gt;”, and “&amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&amp;lt;/code&amp;gt;” marker lines.  In a more complex situation we might have to completely rewrite this and other files.  This is what I mean when I say that mercurial only provides tools to do merging.  Even a completely successful merge, from mercurial&#039;s point of view, may be completely bogus code.&lt;br /&gt;
&lt;br /&gt;
There are tools available to make this task easier.  For example I use &amp;lt;code&amp;gt;vimdiff&amp;lt;/code&amp;gt;, a part of the popular &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; package.  To enable this I have altered my &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file to look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 merge = vimdiff&lt;br /&gt;
 username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
 &lt;br /&gt;
 [merge-tools]&lt;br /&gt;
 vimdiff.executable = vim&lt;br /&gt;
 vimdiff.args = -d $base $local $output $other +close +close&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
as per http://mercurial.selenic.com/wiki/MergingWithVim.  The page http://mercurial.selenic.com/wiki/MergeProgram contains instructions for other tools, including Emacs, and graphical tools.  If you edit your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file in this way then you now can type &amp;lt;code&amp;gt;hg resolve --all&amp;lt;/code&amp;gt; to run your chosen tool on all unresolved files.  Note that by default if your chosen tool exits without an error then &amp;lt;code&amp;gt;hg resolve&amp;lt;/code&amp;gt; will regard that file as resolved.  To cause &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; to exit with an error use &amp;lt;code&amp;gt;:cq&amp;lt;/code&amp;gt;.  See &amp;lt;code&amp;gt;hg help resolve&amp;lt;/code&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
In the example my resolution is to have the relevant lines in &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 c&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have resolved all the files that mercurial thinks need fixing you should check that the final merged result makes sense.  Checking that it compiles, or runs tests appropriate to both of the original revisions, for example.  When you are satisfied, you should check in the merged revision:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg ci -m &#039;Merged super and duper features&#039;&lt;br /&gt;
 &lt;br /&gt;
 testmerge$ hg tip&lt;br /&gt;
 &lt;br /&gt;
 changeset:   26:857f81e59d66&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      25:13ecff0136c2&lt;br /&gt;
 parent:      24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 13:10:52 2012 +0000&lt;br /&gt;
 summary:     Merged super and new features&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 testmerge$&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the new revision has &#039;&#039;two&#039;&#039; parent revisions; a merge always consumes a head.  This is clear from the output of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -l 4&lt;br /&gt;
 o    changeset:   26:857f81e59d66&lt;br /&gt;
 |\   tag:         tip&lt;br /&gt;
 | |  parent:      25:13ecff0136c2&lt;br /&gt;
 | |  parent:      24:457db23c0b1a&lt;br /&gt;
 | |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 | |  date:        Thu Jan 26 13:10:52 2012 +0000&lt;br /&gt;
 | |  summary:     Merged super and new features&lt;br /&gt;
 | |&lt;br /&gt;
 | o  changeset:   25:13ecff0136c2&lt;br /&gt;
 | |  parent:      23:1de40efd1c4b&lt;br /&gt;
 | |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 | |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 | |  summary:     A test message&lt;br /&gt;
 | |&lt;br /&gt;
 o |  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another example of merging here?  Perhaps Lee&#039;s code merging in changes on official version.&lt;br /&gt;
&lt;br /&gt;
== Tags and named branches (hg tag, hg tags, hg branch, hg branches) ==&lt;br /&gt;
&lt;br /&gt;
It is often useful to give a name to a particular revision.  This might be a changeset that corresponds to a given version of the code, or it might simply be a revision that marks a particular milestone.  In the &amp;lt;code&amp;gt;example-gaussian-repo&amp;lt;/code&amp;gt; you have probably noticed there are revisions in the history with descriptions like &amp;quot;Added tag h13 for changeset 6c81eb8dcbab&amp;quot;.  These are revisions corresponding to particular versions of the Gaussian development version, such as H01, H10, H13, etc.  You can see a list of the tags in a repository by doing:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg tags&lt;br /&gt;
 tip                               26:857f81e59d66&lt;br /&gt;
 h13                               22:6c81eb8dcbab&lt;br /&gt;
 h12p                              20:0ef14d7dff56&lt;br /&gt;
 h11                               18:7daba638a830&lt;br /&gt;
 h10                               16:e1d0af4e84d9&lt;br /&gt;
 h08                               14:656073c38db9&lt;br /&gt;
 h01                               12:737d1720e79a&lt;br /&gt;
 h13-raw                           10:b039f5c274e2&lt;br /&gt;
 h12p-raw                           8:522a8fe79d22&lt;br /&gt;
 h11-raw                            6:a28b789a9555&lt;br /&gt;
 h10-raw                            4:356081dab79d&lt;br /&gt;
 h08-raw                            2:9f69ed4616ad&lt;br /&gt;
 h01-raw                            0:073d6aa63ea7&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(the &amp;lt;code&amp;gt;tip&amp;lt;/code&amp;gt; tag is automatically assigned to the most recently checked in revision).  You may use a tag name anywhere where you might use a revision number, so for example, to check out the changeset corresponding to the official Gaussian development release H10, you would type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg up h10&lt;br /&gt;
 13887 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(this will look different if you have unchecked-in modifications in your working directory).  You could also pass h10 to the &amp;lt;code&amp;gt;hg clone -u&amp;lt;/code&amp;gt; flag, and so on.&lt;br /&gt;
You tag a revision with the &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt; command.  Issue it in a working directory and it will tag the revision that is the parent of the working directory.  Tags become part of the repository, that is they are shared during &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt;, so choose wisely.  If you&#039;d like to have tags that are only part of the local repository, use the &amp;lt;code&amp;gt;-l&amp;lt;/code&amp;gt; flag to &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Tags are stored in an &amp;lt;code&amp;gt;.hgtags&amp;lt;/code&amp;gt; file in the root directory of the repository.  Running &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt; alters this file and then commits the change to the repository.  Sometimes you can see conflicts in this file during merges.  I normally just resolve them by keeping as much information in the merged file as possible.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg branches&amp;lt;/code&amp;gt; command can be used to show the named branches in the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg branches&lt;br /&gt;
 default                       24:13ecff0136c2&lt;br /&gt;
 raw                           11:a0c273aeeb2b (inactive)&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I have two named branches, raw and default (the default branch is, er, the default).  If you examine the full output of &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt;, which is quite long and I won&#039;t reproduce it here, you&#039;ll see, starting at the bottom, revisions 0 to 11 are all in the raw branch.  I have created and named this branch to contain the official Gaussian development code as processed by the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, without any of our makefiles or other alterations.  The default branch branches off from revision 1 and starts at revision 12.  Its descendants, revisions 12 to 23, are also in the default branch.  These were created by starting at revision 1, adding our makefiles and modifications to the build system, renaming this branch to the default branch, and then committing revision 12.  I tagged revision 12 as &amp;quot;H01&amp;quot;, which created revision 13.  I then merged revision 3, fixed the conflicts, and committed revision 14, and so on.  A more detailed guide on how to import a new official version of gdv exists in LINKY.&lt;br /&gt;
&lt;br /&gt;
You can use branch names just like tags wherever mercurial expects a revision identifier.  If you use a branch name mercurial will attempt to give you the revision that is most appropriate, this will usually be the newest head on that branch.&lt;br /&gt;
&lt;br /&gt;
To create a new branch you type &amp;lt;code&amp;gt;hg branch &amp;lt;branchname&amp;gt;&amp;lt;/code&amp;gt;.  This will take effect when you commit the working directory.  As I&#039;ve previously mentioned a simpler alternative to having branches, named or otherwise, in your repository is to have multiple repositories.&lt;br /&gt;
&lt;br /&gt;
== Ignoring files ==&lt;br /&gt;
&lt;br /&gt;
You may be wondering how the system will work when you start compiling files.  Won&#039;t all the &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.exe&amp;lt;/code&amp;gt; files start showing up in the output to &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;?  The answer is that they will not, because I&#039;ve told mercurial to ignore such files.  This information is stored in the &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file in the root of the repository.  It&#039;s quite long but it starts like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 syntax: glob&lt;br /&gt;
 gdv.make&lt;br /&gt;
 *.o&lt;br /&gt;
 *.lo&lt;br /&gt;
 *.a&lt;br /&gt;
 *.exe&lt;br /&gt;
 *.exel&lt;br /&gt;
 .*.swp&lt;br /&gt;
 *~&lt;br /&gt;
 *.log&lt;br /&gt;
 *.log.gz&lt;br /&gt;
 *.chk&lt;br /&gt;
 gdv/arc&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Any file that matches either the shell patterns or the file names in &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; is ignored by mercurial.  This means it does not show up to &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt;, and so on will ignore it unless it is explicitly mentioned on the command line.  So &amp;lt;code&amp;gt;hg add gdv&amp;lt;/code&amp;gt; will add all non-ignored files in the gdv directory, while &amp;lt;code&amp;gt;hg add gdv/*&amp;lt;/code&amp;gt; will add all the files in the gdv directory.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file is tracked, so please only commit changes to it if you think they will be useful to everyone.&lt;br /&gt;
== Other commands ==&lt;br /&gt;
&lt;br /&gt;
There are quite a few other commands available to mercurial, I will cover just a few here, if you&#039;re interested in becoming a power user refer to the documentation I have mentioned.&lt;br /&gt;
&lt;br /&gt;
=== hg addremove ===&lt;br /&gt;
You can use this command when you have large numbers of files to add and remove.  It also includes the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; flag to attempt to detect when files have been moved or copied.  Using this flag does require some subtlety, as it&#039;s not helpful to mark files as moved or copied unless they have been.  Also note that it is possible to inadvertently include ignored files in a mass &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg addremove&amp;lt;/code&amp;gt;; check what&#039;s being added before you commit.&lt;br /&gt;
&lt;br /&gt;
=== hg grep and hg locate ===&lt;br /&gt;
Similar to the standard UNIX grep and locate commands, but cognisant of the mercurial repository.&lt;br /&gt;
&lt;br /&gt;
=== hg init ===&lt;br /&gt;
Creates a new mercurial repository in the current directory&lt;br /&gt;
&lt;br /&gt;
=== hg serve ===&lt;br /&gt;
This starts a mini web server serving information about the repository.  I would strongly recommend you do not use this while working on the Gaussian development version as it would be all too easy to allow any user on the system to view all of the files in your repository.  I only mention it here because some of the other documentation may refer to it.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=296920</id>
		<title>Resgrp:comp-photo-version control-local-dev-master</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=296920"/>
		<updated>2013-01-21T13:59:41Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will show the current state of the group&#039;s master dev repository &amp;lt;code&amp;gt;/home/gaussian-devel/repositories/local-dev-master&amp;lt;/code&amp;gt;.&lt;br /&gt;
It will document what code is currently considered to be accepted as ready to use.&lt;br /&gt;
&lt;br /&gt;
The format is explained [[#Formatting|here]].  You don&#039;t have to describe each revision, just&lt;br /&gt;
whatever the tip is at the time, and whatever might be (or have been) made into a&lt;br /&gt;
compiled version.&lt;br /&gt;
==The revisions==&lt;br /&gt;
The most recent revision (which should be the tip) should always be on top.  Note&lt;br /&gt;
that the &amp;quot;tip&amp;quot; tag may appear incorrectly below.  Also note that the local revision&lt;br /&gt;
numbers (e.g. 56 in changeset:   56:e359f0e1aa5c) may differ in other repositories.  If&lt;br /&gt;
in doubt, use the hex number.&lt;br /&gt;
&lt;br /&gt;
===changeset:   73:923d6c51169a===&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Fri Jan 18 17:11:08 2013 +0000&lt;br /&gt;
 summary:     Fixed bug where ONIOM jobs would fail with:&lt;br /&gt;
&lt;br /&gt;
Updated version fixing a bug where ONIOM 2nd derivative jobs would fail&lt;br /&gt;
with a message like:&lt;br /&gt;
 ONIOM: calculating second derivatives.&lt;br /&gt;
 NInts&amp;lt;0 in InToWP.&lt;br /&gt;
 Error termination via Lnk1e in /home/gaussian-devel/versions/rev-a7f8ac5c6a00-i386-pg12.9/gdv/l120.exe at Fri Jan 11 18:06:43 2013.&lt;br /&gt;
&lt;br /&gt;
===changeset:   72:a7f8ac5c6a00===&lt;br /&gt;
 parent:      70:f87f732e26fb&lt;br /&gt;
 parent:      71:69b842c84566&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Nov 21 14:12:01 2012 +0000&lt;br /&gt;
 summary:     Merged in more updates to makefiles (h23)&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: see revision [[#changeset:   73:923d6c51169a|73:923d6c51169a]].&lt;br /&gt;
&lt;br /&gt;
This revision contains the [[Resgrg:comp-photo-version control-codes#Shaopeng|Shaopeng matrix element code]], the [[Resgrg:comp-photo-version control-codes#Seamfollowing|seam following code]],&lt;br /&gt;
and the [[Resgrg:comp-photo-version control-codes#ONIOM Freq|ONIOM frequency analysis code]].  They are all merged to be compatible with H23.&lt;br /&gt;
&lt;br /&gt;
I have also added into the repository test jobs for each of these local changes.  These are stored in&lt;br /&gt;
an upper directory called &amp;lt;code&amp;gt;local-tests&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
The merge of the three features.  Based off H23.&lt;br /&gt;
===changeset:   55:f6c5e2290dc4===&lt;br /&gt;
 parent:      54:0c83655a3822&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:55:17 2012 +0100&lt;br /&gt;
 summary:     Merged olddirect code to H23&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
Simon&#039;s updates and fixes for the semi-direct matrix element code.&lt;br /&gt;
Based off H23.&lt;br /&gt;
===changeset:   53:c7f36daff923===&lt;br /&gt;
 parent:      52:e11a2fc5b5a8&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 12:38:05 2012 +0100&lt;br /&gt;
 summary:     Shaopeng + seamfollowing, merged to H23.&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
The Shaopeng code and seamfollowing code as below, updated to H23.&lt;br /&gt;
===changeset:   51:dcd851f8dc57===&lt;br /&gt;
 parent:      50:c0a9f878ea3e&lt;br /&gt;
 parent:      39:c90162c4fbe6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Tue Oct 09 22:15:18 2012 +0100&lt;br /&gt;
 summary:     Updated seamfollowing code to H21&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
This is the imported seam following code updated to H21.&lt;br /&gt;
===changeset:   49:bda0e1259a36===&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Jul 02 15:04:35 2012 +0100&lt;br /&gt;
 summary:     Large modification and cleanup of Shaopeng code.  Below for details.&lt;br /&gt;
&lt;br /&gt;
This contains the [[Resgrg:comp-photo-version control-codes#Shaopeng|Shaopeng matrix element code]]&lt;br /&gt;
with most of Simon&#039;s modifications&lt;br /&gt;
and bug fixes in place.  It&#039;s based off version H21&lt;br /&gt;
===changeset:   41:c8a317a36a4e===&lt;br /&gt;
 tag:         h23&lt;br /&gt;
 parent:      40:cfd3ea6fcdff&lt;br /&gt;
 parent:      25:7a8a763281d4&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:45:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H23&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H23.&lt;br /&gt;
&lt;br /&gt;
===changeset:   39:c90162c4fbe6===&lt;br /&gt;
 tag:         h21&lt;br /&gt;
 parent:      38:ef0c2dff2d79&lt;br /&gt;
 parent:      20:dd575870f775&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:44:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H21&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H21.&lt;br /&gt;
===changeset:   37:e972407aab01===&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      36:9d36f9fe483b&lt;br /&gt;
 parent:      17:770721638a7a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:43:06 2012 +0100&lt;br /&gt;
 summary:     Merged in H13&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H13.&lt;br /&gt;
===changeset:   35:10679662e3a3===&lt;br /&gt;
 tag:         h12p&lt;br /&gt;
 parent:      34:3ce1603d2c6c&lt;br /&gt;
 parent:      16:427978d67ed6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:42:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H12p&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H12p.&lt;br /&gt;
===changeset:   33:a0e0a314db85===&lt;br /&gt;
 tag:         h11&lt;br /&gt;
 parent:      32:3732a6888cc4&lt;br /&gt;
 parent:      15:27066b86194e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:49 2012 +0100&lt;br /&gt;
 summary:     Merged in H11&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H11.&lt;br /&gt;
===changeset:   31:7d8a337a7324===&lt;br /&gt;
 tag:         h10&lt;br /&gt;
 parent:      30:86c2a0b6f977&lt;br /&gt;
 parent:      14:62f983246ba7&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H10&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H10.&lt;br /&gt;
===changeset:   29:56fa127c847c===&lt;br /&gt;
 tag:         h08&lt;br /&gt;
 parent:      28:877924b27ee3&lt;br /&gt;
 parent:      13:903ac662c7a2&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:38:04 2012 +0100&lt;br /&gt;
 summary:     Merged in H08&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H08.&lt;br /&gt;
===changeset:   27:a05e10e365c2===&lt;br /&gt;
 tag:         h01&lt;br /&gt;
 parent:      -1:000000000000&lt;br /&gt;
 parent:      12:ae8da988f728&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:35:05 2012 +0100&lt;br /&gt;
 summary:     Fixed bug where code compiled with PGI &amp;gt;= 12 would fail with thread error.&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H01.&lt;br /&gt;
&lt;br /&gt;
==Formatting==&lt;br /&gt;
The format is:&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
Text explaining what this revision contains,&lt;br /&gt;
e.g. all of the below plus merged up to H23&lt;br /&gt;
&lt;br /&gt;
In raw form that&#039;s:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
  tag:         tip&lt;br /&gt;
  parent:      55:f6c5e2290dc4&lt;br /&gt;
  parent:      53:c7f36daff923&lt;br /&gt;
  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
  date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
  summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
 &lt;br /&gt;
 Text explaining what this revision contains,&lt;br /&gt;
 e.g. all of the below plus merged up to H23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the output from &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; with the changeset line made into a header, a space&lt;br /&gt;
added to the start of each following line, and more&lt;br /&gt;
explanatory text.  &#039;&#039;&#039;NB, it&#039;s important to add more explanation!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=296919</id>
		<title>Resgrp:comp-photo-version control-local-dev-master</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=296919"/>
		<updated>2013-01-21T13:58:51Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will show the current state of the group&#039;s master dev repository &amp;lt;code&amp;gt;/home/gaussian-devel/repositories/local-dev-master&amp;lt;/code&amp;gt;.&lt;br /&gt;
It will document what code is currently considered to be accepted as ready to use.&lt;br /&gt;
&lt;br /&gt;
The format is explained [[#Formatting|here]].  You don&#039;t have to describe each revision, just&lt;br /&gt;
whatever the tip is at the time, and whatever might be (or have been) made into a&lt;br /&gt;
compiled version.&lt;br /&gt;
==The revisions==&lt;br /&gt;
The most recent revision (which should be the tip) should always be on top.  Note&lt;br /&gt;
that the &amp;quot;tip&amp;quot; tag may appear incorrectly below.  Also note that the local revision&lt;br /&gt;
numbers (e.g. 56 in changeset:   56:e359f0e1aa5c) may differ in other repositories.  If&lt;br /&gt;
in doubt, use the hex number.&lt;br /&gt;
&lt;br /&gt;
===changeset:   73:923d6c51169a===&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Fri Jan 18 17:11:08 2013 +0000&lt;br /&gt;
 summary:     Fixed bug where ONIOM jobs would fail with:&lt;br /&gt;
&lt;br /&gt;
Updated version fixing a bug where ONIOM 2nd derivative jobs would fail&lt;br /&gt;
with a message like:&lt;br /&gt;
 ONIOM: calculating second derivatives.&lt;br /&gt;
 NInts&amp;lt;0 in InToWP.&lt;br /&gt;
 Error termination via Lnk1e in /home/gaussian-devel/versions/rev-a7f8ac5c6a00-i386-pg12.9/gdv/l120.exe at Fri Jan 11 18:06:43 2013.&lt;br /&gt;
&lt;br /&gt;
===changeset:   72:a7f8ac5c6a00===&lt;br /&gt;
 parent:      70:f87f732e26fb&lt;br /&gt;
 parent:      71:69b842c84566&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Nov 21 14:12:01 2012 +0000&lt;br /&gt;
 summary:     Merged in more updates to makefiles (h23)&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: see revision [[#changeset:   73:923d6c51169a|73:923d6c51169a]].&lt;br /&gt;
&lt;br /&gt;
This revision contains the [[Resgrg:comp-photo-version control-codes#Shaopeng|Shaopeng matrix element code]], the [[Resgrg:comp-photo-version control-codes#Seamfollowing|seam following code]],&lt;br /&gt;
and the [[Resgrg:comp-photo-version control-codes#ONIOM Freq|ONIOM frequency analysis code]].  They are all merged to be compatible with H23.&lt;br /&gt;
&lt;br /&gt;
I have also added into the repository test jobs for each of these local changes.  These are stored in&lt;br /&gt;
an upper directory called &amp;lt;code&amp;gt;local-tests&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
The merge of the three features.  Based off H23.&lt;br /&gt;
===changeset:   55:f6c5e2290dc4===&lt;br /&gt;
 parent:      54:0c83655a3822&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:55:17 2012 +0100&lt;br /&gt;
 summary:     Merged olddirect code to H23&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
Simon&#039;s updates and fixes for the semi-direct matrix element code.&lt;br /&gt;
Based off H23.&lt;br /&gt;
===changeset:   53:c7f36daff923===&lt;br /&gt;
 parent:      52:e11a2fc5b5a8&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 12:38:05 2012 +0100&lt;br /&gt;
 summary:     Shaopeng + seamfollowing, merged to H23.&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
The Shaopeng code and seamfollowing code as below, updated to H23.&lt;br /&gt;
===changeset:   51:dcd851f8dc57===&lt;br /&gt;
 parent:      50:c0a9f878ea3e&lt;br /&gt;
 parent:      39:c90162c4fbe6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Tue Oct 09 22:15:18 2012 +0100&lt;br /&gt;
 summary:     Updated seamfollowing code to H21&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
This is the imported seam following code updated to H21.&lt;br /&gt;
===changeset:   49:bda0e1259a36===&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Jul 02 15:04:35 2012 +0100&lt;br /&gt;
 summary:     Large modification and cleanup of Shaopeng code.  Below for details.&lt;br /&gt;
&lt;br /&gt;
This contains the [[Resgrg:comp-photo-version control-codes#Shaopeng|Shaopeng matrix element code]]&lt;br /&gt;
with most of Simon&#039;s modifications&lt;br /&gt;
and bug fixes in place.  It&#039;s based off version H21&lt;br /&gt;
===changeset:   41:c8a317a36a4e===&lt;br /&gt;
 tag:         h23&lt;br /&gt;
 parent:      40:cfd3ea6fcdff&lt;br /&gt;
 parent:      25:7a8a763281d4&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:45:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H23&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H23.&lt;br /&gt;
&lt;br /&gt;
===changeset:   39:c90162c4fbe6===&lt;br /&gt;
 tag:         h21&lt;br /&gt;
 parent:      38:ef0c2dff2d79&lt;br /&gt;
 parent:      20:dd575870f775&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:44:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H21&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H21.&lt;br /&gt;
===changeset:   37:e972407aab01===&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      36:9d36f9fe483b&lt;br /&gt;
 parent:      17:770721638a7a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:43:06 2012 +0100&lt;br /&gt;
 summary:     Merged in H13&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H13.&lt;br /&gt;
===changeset:   35:10679662e3a3===&lt;br /&gt;
 tag:         h12p&lt;br /&gt;
 parent:      34:3ce1603d2c6c&lt;br /&gt;
 parent:      16:427978d67ed6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:42:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H12p&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H12p.&lt;br /&gt;
===changeset:   33:a0e0a314db85===&lt;br /&gt;
 tag:         h11&lt;br /&gt;
 parent:      32:3732a6888cc4&lt;br /&gt;
 parent:      15:27066b86194e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:49 2012 +0100&lt;br /&gt;
 summary:     Merged in H11&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H11.&lt;br /&gt;
===changeset:   31:7d8a337a7324===&lt;br /&gt;
 tag:         h10&lt;br /&gt;
 parent:      30:86c2a0b6f977&lt;br /&gt;
 parent:      14:62f983246ba7&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H10&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H10.&lt;br /&gt;
===changeset:   29:56fa127c847c===&lt;br /&gt;
 tag:         h08&lt;br /&gt;
 parent:      28:877924b27ee3&lt;br /&gt;
 parent:      13:903ac662c7a2&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:38:04 2012 +0100&lt;br /&gt;
 summary:     Merged in H08&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H08.&lt;br /&gt;
===changeset:   27:a05e10e365c2===&lt;br /&gt;
 tag:         h01&lt;br /&gt;
 parent:      -1:000000000000&lt;br /&gt;
 parent:      12:ae8da988f728&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:35:05 2012 +0100&lt;br /&gt;
 summary:     Fixed bug where code compiled with PGI &amp;gt;= 12 would fail with thread error.&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H01.&lt;br /&gt;
&lt;br /&gt;
==Formatting==&lt;br /&gt;
The format is:&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
Text explaining what this revision contains,&lt;br /&gt;
e.g. all of the below plus merged up to H23&lt;br /&gt;
&lt;br /&gt;
In raw form that&#039;s:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
  tag:         tip&lt;br /&gt;
  parent:      55:f6c5e2290dc4&lt;br /&gt;
  parent:      53:c7f36daff923&lt;br /&gt;
  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
  date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
  summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
 &lt;br /&gt;
 Text explaining what this revision contains,&lt;br /&gt;
 e.g. all of the below plus merged up to H23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the output from &amp;lt;code&amp;gt;hg sum&amp;lt;/code&amp;gt; with the changeset line made into a header, a space&lt;br /&gt;
added to the start of each following line, and more&lt;br /&gt;
explanatory text.  &#039;&#039;&#039;NB, it&#039;s important to add more explanation!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=279994</id>
		<title>Resgrp:comp-photo-version control-local-dev-master</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=279994"/>
		<updated>2012-11-21T19:58:13Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will show the current state of the group&#039;s master dev repository &amp;lt;code&amp;gt;/home/gaussian-devel/repositories/local-dev-master&amp;lt;/code&amp;gt;.&lt;br /&gt;
It will document what code is currently considered to be accepted as ready to use.&lt;br /&gt;
&lt;br /&gt;
The format is explained [[#Formatting|here]].  You don&#039;t have to describe each revision, just&lt;br /&gt;
whatever the tip is at the time, and whatever might be (or have been) made into a&lt;br /&gt;
compiled version.&lt;br /&gt;
==The revisions==&lt;br /&gt;
The most recent revision (which should be the tip) should always be on top.  Note&lt;br /&gt;
that the &amp;quot;tip&amp;quot; tag may appear incorrectly below.  Also note that the local revision&lt;br /&gt;
numbers (e.g. 56 in changeset:   56:e359f0e1aa5c) may differ in other repositories.  If&lt;br /&gt;
in doubt, use the hex number.&lt;br /&gt;
&lt;br /&gt;
===changeset:   72:a7f8ac5c6a00===&lt;br /&gt;
 parent:      70:f87f732e26fb&lt;br /&gt;
 parent:      71:69b842c84566&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Nov 21 14:12:01 2012 +0000&lt;br /&gt;
 summary:     Merged in more updates to makefiles (h23)&lt;br /&gt;
&lt;br /&gt;
This revision contains the [[Resgrg:comp-photo-version control-codes#Shaopeng|Shaopeng matrix element code]], the [[Resgrg:comp-photo-version control-codes#Seamfollowing|seam following code]],&lt;br /&gt;
and the [[Resgrg:comp-photo-version control-codes#ONIOM Freq|ONIOM frequency analysis code]].  They are all merged to be compatible with H23.&lt;br /&gt;
&lt;br /&gt;
I have also added into the repository test jobs for each of these local changes.  These are stored in&lt;br /&gt;
an upper directory called &amp;lt;code&amp;gt;local-tests&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
The merge of the three features.  Based off H23.&lt;br /&gt;
===changeset:   55:f6c5e2290dc4===&lt;br /&gt;
 parent:      54:0c83655a3822&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:55:17 2012 +0100&lt;br /&gt;
 summary:     Merged olddirect code to H23&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
Simon&#039;s updates and fixes for the semi-direct matrix element code.&lt;br /&gt;
Based off H23.&lt;br /&gt;
===changeset:   53:c7f36daff923===&lt;br /&gt;
 parent:      52:e11a2fc5b5a8&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 12:38:05 2012 +0100&lt;br /&gt;
 summary:     Shaopeng + seamfollowing, merged to H23.&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
The Shaopeng code and seamfollowing code as below, updated to H23.&lt;br /&gt;
===changeset:   51:dcd851f8dc57===&lt;br /&gt;
 parent:      50:c0a9f878ea3e&lt;br /&gt;
 parent:      39:c90162c4fbe6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Tue Oct 09 22:15:18 2012 +0100&lt;br /&gt;
 summary:     Updated seamfollowing code to H21&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
This is the imported seam following code updated to H21.&lt;br /&gt;
===changeset:   49:bda0e1259a36===&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Jul 02 15:04:35 2012 +0100&lt;br /&gt;
 summary:     Large modification and cleanup of Shaopeng code.  Below for details.&lt;br /&gt;
&lt;br /&gt;
This contains the [[Resgrg:comp-photo-version control-codes#Shaopeng|Shaopeng matrix element code]]&lt;br /&gt;
with most of Simon&#039;s modifications&lt;br /&gt;
and bug fixes in place.  It&#039;s based off version H21&lt;br /&gt;
===changeset:   41:c8a317a36a4e===&lt;br /&gt;
 tag:         h23&lt;br /&gt;
 parent:      40:cfd3ea6fcdff&lt;br /&gt;
 parent:      25:7a8a763281d4&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:45:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H23&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H23.&lt;br /&gt;
&lt;br /&gt;
===changeset:   39:c90162c4fbe6===&lt;br /&gt;
 tag:         h21&lt;br /&gt;
 parent:      38:ef0c2dff2d79&lt;br /&gt;
 parent:      20:dd575870f775&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:44:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H21&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H21.&lt;br /&gt;
===changeset:   37:e972407aab01===&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      36:9d36f9fe483b&lt;br /&gt;
 parent:      17:770721638a7a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:43:06 2012 +0100&lt;br /&gt;
 summary:     Merged in H13&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H13.&lt;br /&gt;
===changeset:   35:10679662e3a3===&lt;br /&gt;
 tag:         h12p&lt;br /&gt;
 parent:      34:3ce1603d2c6c&lt;br /&gt;
 parent:      16:427978d67ed6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:42:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H12p&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H12p.&lt;br /&gt;
===changeset:   33:a0e0a314db85===&lt;br /&gt;
 tag:         h11&lt;br /&gt;
 parent:      32:3732a6888cc4&lt;br /&gt;
 parent:      15:27066b86194e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:49 2012 +0100&lt;br /&gt;
 summary:     Merged in H11&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H11.&lt;br /&gt;
===changeset:   31:7d8a337a7324===&lt;br /&gt;
 tag:         h10&lt;br /&gt;
 parent:      30:86c2a0b6f977&lt;br /&gt;
 parent:      14:62f983246ba7&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H10&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H10.&lt;br /&gt;
===changeset:   29:56fa127c847c===&lt;br /&gt;
 tag:         h08&lt;br /&gt;
 parent:      28:877924b27ee3&lt;br /&gt;
 parent:      13:903ac662c7a2&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:38:04 2012 +0100&lt;br /&gt;
 summary:     Merged in H08&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H08.&lt;br /&gt;
===changeset:   27:a05e10e365c2===&lt;br /&gt;
 tag:         h01&lt;br /&gt;
 parent:      -1:000000000000&lt;br /&gt;
 parent:      12:ae8da988f728&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:35:05 2012 +0100&lt;br /&gt;
 summary:     Fixed bug where code compiled with PGI &amp;gt;= 12 would fail with thread error.&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H01.&lt;br /&gt;
&lt;br /&gt;
==Formatting==&lt;br /&gt;
The format is:&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
Text explaining what this revision contains,&lt;br /&gt;
e.g. all of the below plus merged up to H23&lt;br /&gt;
&lt;br /&gt;
In raw form that&#039;s:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
  tag:         tip&lt;br /&gt;
  parent:      55:f6c5e2290dc4&lt;br /&gt;
  parent:      53:c7f36daff923&lt;br /&gt;
  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
  date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
  summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
 &lt;br /&gt;
 Text explaining what this revision contains,&lt;br /&gt;
 e.g. all of the below plus merged up to H23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the output from &amp;lt;code&amp;gt;hg sum&amp;lt;/code&amp;gt; with the changeset line made into a header, a space&lt;br /&gt;
added to the start of each following line, and more&lt;br /&gt;
explanatory text.  &#039;&#039;&#039;NB, it&#039;s important to add more explanation!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrg:comp-photo-version_control-codes&amp;diff=279987</id>
		<title>Resgrg:comp-photo-version control-codes</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrg:comp-photo-version_control-codes&amp;diff=279987"/>
		<updated>2012-11-21T19:53:56Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: Created page with &amp;quot;This page explains the local modifications made to the Gaussian code by the group.  Hopefully it&amp;#039;ll also explain how to use them as well.  ==The codes==  ===Shaopeng=== This is a...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page explains the local modifications made to the Gaussian code by the group.  Hopefully it&#039;ll also explain&lt;br /&gt;
how to use them as well.&lt;br /&gt;
&lt;br /&gt;
==The codes==&lt;br /&gt;
&lt;br /&gt;
===Shaopeng===&lt;br /&gt;
This is a replacement for the existing matrix element generator (hereafter known as the Klene code) &lt;br /&gt;
that is used for large (number of orbitals &amp;gt; 8)&lt;br /&gt;
CASSCF calculations.  If your job shows &amp;lt;code&amp;gt;SME calculated on fly&amp;lt;/code&amp;gt; then it&#039;s using this path.&lt;br /&gt;
&lt;br /&gt;
The Shaopeng code computes the same matrix elements but does it faster, and in a way that allows certain compiler&lt;br /&gt;
optimisations to be used.  The result should be an approximate 4X speedup, depending on the job and the architecture that you&#039;re running on.  This speedup comes at a cost of memory.  The algorithm is much more demanding of memory and this extra demand scales with the number of processors.&lt;br /&gt;
&lt;br /&gt;
How to use it: by default l510 will make a decision on whether to use the Klene code path or the Shaopeng based on the problem size and the amount of memory and processors allocated.  You can force one code path over the other &lt;br /&gt;
with the IOP(5/139=x) where:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Iop(5/139)&lt;br /&gt;
! Effect&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
| Default, choose code path automatically&lt;br /&gt;
|-&lt;br /&gt;
| 1&lt;br /&gt;
| Force Klene code path&lt;br /&gt;
|-&lt;br /&gt;
| 2&lt;br /&gt;
| Force Shaopeng code path&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Seamfollowing===&lt;br /&gt;
&lt;br /&gt;
Dunno&lt;br /&gt;
&lt;br /&gt;
===ONIOM Freq===&lt;br /&gt;
&lt;br /&gt;
Dunno&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=279912</id>
		<title>Resgrp:comp-photo-version control-local-dev-master</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=279912"/>
		<updated>2012-11-21T18:53:08Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will show the current state of the group&#039;s master dev repository &amp;lt;code&amp;gt;/home/gaussian-devel/repositories/local-dev-master&amp;lt;/code&amp;gt;.&lt;br /&gt;
It will document what code is currently considered to be accepted as ready to use.&lt;br /&gt;
&lt;br /&gt;
The format is explained [[#Formatting|here]].  You don&#039;t have to describe each revision, just&lt;br /&gt;
whatever the tip is at the time, and whatever might be (or have been) made into a&lt;br /&gt;
compiled version.&lt;br /&gt;
==The revisions==&lt;br /&gt;
The most recent revision (which should be the tip) should always be on top.  Note&lt;br /&gt;
that the &amp;quot;tip&amp;quot; tag may appear incorrectly below.  Also note that the local revision&lt;br /&gt;
numbers (e.g. 56 in changeset:   56:e359f0e1aa5c) may differ in other repositories.  If&lt;br /&gt;
in doubt, use the hex number.&lt;br /&gt;
&lt;br /&gt;
===changeset:   72:a7f8ac5c6a00===&lt;br /&gt;
 parent:      70:f87f732e26fb&lt;br /&gt;
 parent:      71:69b842c84566&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Nov 21 14:12:01 2012 +0000&lt;br /&gt;
 summary:     Merged in more updates to makefiles (h23)&lt;br /&gt;
&lt;br /&gt;
This revision contains the Shaopeng matrix element code, the seam following code,&lt;br /&gt;
and the ONIOM frequency analysis code.  They are all merged to be compatible with H23.&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
The merge of the three features.  Based off H23.&lt;br /&gt;
===changeset:   55:f6c5e2290dc4===&lt;br /&gt;
 parent:      54:0c83655a3822&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:55:17 2012 +0100&lt;br /&gt;
 summary:     Merged olddirect code to H23&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
Simon&#039;s updates and fixes for the semi-direct matrix element code.&lt;br /&gt;
Based off H23.&lt;br /&gt;
===changeset:   53:c7f36daff923===&lt;br /&gt;
 parent:      52:e11a2fc5b5a8&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 12:38:05 2012 +0100&lt;br /&gt;
 summary:     Shaopeng + seamfollowing, merged to H23.&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
The Shaopeng code and seamfollowing code as below, updated to H23.&lt;br /&gt;
===changeset:   51:dcd851f8dc57===&lt;br /&gt;
 parent:      50:c0a9f878ea3e&lt;br /&gt;
 parent:      39:c90162c4fbe6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Tue Oct 09 22:15:18 2012 +0100&lt;br /&gt;
 summary:     Updated seamfollowing code to H21&lt;br /&gt;
&lt;br /&gt;
DEPRECATED: Do not use, likely to crash.  See rev [[#changeset:   57:0c20d50c4185|57:0c20d50c4185]].&lt;br /&gt;
&lt;br /&gt;
This is the imported seam following code updated to H21.&lt;br /&gt;
===changeset:   49:bda0e1259a36===&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Jul 02 15:04:35 2012 +0100&lt;br /&gt;
 summary:     Large modification and cleanup of Shaopeng code.  Below for details.&lt;br /&gt;
&lt;br /&gt;
This contains the Shaopeng matrix element code with most of Simon&#039;s modifications&lt;br /&gt;
and bug fixes in place.  It&#039;s based off version H21&lt;br /&gt;
===changeset:   41:c8a317a36a4e===&lt;br /&gt;
 tag:         h23&lt;br /&gt;
 parent:      40:cfd3ea6fcdff&lt;br /&gt;
 parent:      25:7a8a763281d4&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:45:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H23&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H23.&lt;br /&gt;
&lt;br /&gt;
===changeset:   39:c90162c4fbe6===&lt;br /&gt;
 tag:         h21&lt;br /&gt;
 parent:      38:ef0c2dff2d79&lt;br /&gt;
 parent:      20:dd575870f775&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:44:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H21&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H21.&lt;br /&gt;
===changeset:   37:e972407aab01===&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      36:9d36f9fe483b&lt;br /&gt;
 parent:      17:770721638a7a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:43:06 2012 +0100&lt;br /&gt;
 summary:     Merged in H13&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H13.&lt;br /&gt;
===changeset:   35:10679662e3a3===&lt;br /&gt;
 tag:         h12p&lt;br /&gt;
 parent:      34:3ce1603d2c6c&lt;br /&gt;
 parent:      16:427978d67ed6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:42:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H12p&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H12p.&lt;br /&gt;
===changeset:   33:a0e0a314db85===&lt;br /&gt;
 tag:         h11&lt;br /&gt;
 parent:      32:3732a6888cc4&lt;br /&gt;
 parent:      15:27066b86194e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:49 2012 +0100&lt;br /&gt;
 summary:     Merged in H11&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H11.&lt;br /&gt;
===changeset:   31:7d8a337a7324===&lt;br /&gt;
 tag:         h10&lt;br /&gt;
 parent:      30:86c2a0b6f977&lt;br /&gt;
 parent:      14:62f983246ba7&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H10&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H10.&lt;br /&gt;
===changeset:   29:56fa127c847c===&lt;br /&gt;
 tag:         h08&lt;br /&gt;
 parent:      28:877924b27ee3&lt;br /&gt;
 parent:      13:903ac662c7a2&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:38:04 2012 +0100&lt;br /&gt;
 summary:     Merged in H08&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H08.&lt;br /&gt;
===changeset:   27:a05e10e365c2===&lt;br /&gt;
 tag:         h01&lt;br /&gt;
 parent:      -1:000000000000&lt;br /&gt;
 parent:      12:ae8da988f728&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:35:05 2012 +0100&lt;br /&gt;
 summary:     Fixed bug where code compiled with PGI &amp;gt;= 12 would fail with thread error.&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H01.&lt;br /&gt;
&lt;br /&gt;
==Formatting==&lt;br /&gt;
The format is:&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
Text explaining what this revision contains,&lt;br /&gt;
e.g. all of the below plus merged up to H23&lt;br /&gt;
&lt;br /&gt;
In raw form that&#039;s:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
  tag:         tip&lt;br /&gt;
  parent:      55:f6c5e2290dc4&lt;br /&gt;
  parent:      53:c7f36daff923&lt;br /&gt;
  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
  date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
  summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
 &lt;br /&gt;
 Text explaining what this revision contains,&lt;br /&gt;
 e.g. all of the below plus merged up to H23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the output from &amp;lt;code&amp;gt;hg sum&amp;lt;/code&amp;gt; with the changeset line made into a header, a space&lt;br /&gt;
added to the start of each following line, and more&lt;br /&gt;
explanatory text.  &#039;&#039;&#039;NB, it&#039;s important to add more explanation!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=257927</id>
		<title>Resgrp:comp-photo-version control-local-dev-master</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=257927"/>
		<updated>2012-10-11T11:49:32Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will show the current state of the group&#039;s master dev repository &amp;lt;code&amp;gt;/home/gaussian-devel/repositories/local-dev-master&amp;lt;/code&amp;gt;.&lt;br /&gt;
It will document what code is currently considered to be accepted as ready to use.&lt;br /&gt;
&lt;br /&gt;
The format is explained [[#Formatting|here]].  You don&#039;t have to describe each revision, just&lt;br /&gt;
whatever the tip is at the time, and whatever might be (or have been) made into a&lt;br /&gt;
compiled version.&lt;br /&gt;
==The revisions==&lt;br /&gt;
The most recent revision (which should be the tip) should always be on top.  Note&lt;br /&gt;
that the &amp;quot;tip&amp;quot; tag may appear incorrectly below.  Also note that the local revision&lt;br /&gt;
numbers (e.g. 56 in changeset:   56:e359f0e1aa5c) may differ in other repositories.  If&lt;br /&gt;
in doubt, use the hex number.&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
The merge of the three features.  Based off H23.&lt;br /&gt;
===changeset:   55:f6c5e2290dc4===&lt;br /&gt;
 parent:      54:0c83655a3822&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:55:17 2012 +0100&lt;br /&gt;
 summary:     Merged olddirect code to H23&lt;br /&gt;
&lt;br /&gt;
Simon&#039;s updates and fixes for the semi-direct matrix element code.&lt;br /&gt;
Based off H23.&lt;br /&gt;
===changeset:   53:c7f36daff923===&lt;br /&gt;
 parent:      52:e11a2fc5b5a8&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 12:38:05 2012 +0100&lt;br /&gt;
 summary:     Shaopeng + seamfollowing, merged to H23.&lt;br /&gt;
&lt;br /&gt;
The Shaopeng code and seamfollowing code as below, updated to H23.&lt;br /&gt;
===changeset:   51:dcd851f8dc57===&lt;br /&gt;
 parent:      50:c0a9f878ea3e&lt;br /&gt;
 parent:      39:c90162c4fbe6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Tue Oct 09 22:15:18 2012 +0100&lt;br /&gt;
 summary:     Updated seamfollowing code to H21&lt;br /&gt;
&lt;br /&gt;
This is the imported seam following code updated to H21.&lt;br /&gt;
===changeset:   49:bda0e1259a36===&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Jul 02 15:04:35 2012 +0100&lt;br /&gt;
 summary:     Large modification and cleanup of Shaopeng code.  Below for details.&lt;br /&gt;
&lt;br /&gt;
This contains the Shaopeng matrix element code with most of Simon&#039;s modifications&lt;br /&gt;
and bug fixes in place.  It&#039;s based off version H21&lt;br /&gt;
===changeset:   41:c8a317a36a4e===&lt;br /&gt;
 tag:         h23&lt;br /&gt;
 parent:      40:cfd3ea6fcdff&lt;br /&gt;
 parent:      25:7a8a763281d4&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:45:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H23&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H23.&lt;br /&gt;
&lt;br /&gt;
===changeset:   39:c90162c4fbe6===&lt;br /&gt;
 tag:         h21&lt;br /&gt;
 parent:      38:ef0c2dff2d79&lt;br /&gt;
 parent:      20:dd575870f775&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:44:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H21&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H21.&lt;br /&gt;
===changeset:   37:e972407aab01===&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      36:9d36f9fe483b&lt;br /&gt;
 parent:      17:770721638a7a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:43:06 2012 +0100&lt;br /&gt;
 summary:     Merged in H13&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H13.&lt;br /&gt;
===changeset:   35:10679662e3a3===&lt;br /&gt;
 tag:         h12p&lt;br /&gt;
 parent:      34:3ce1603d2c6c&lt;br /&gt;
 parent:      16:427978d67ed6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:42:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H12p&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H12p.&lt;br /&gt;
===changeset:   33:a0e0a314db85===&lt;br /&gt;
 tag:         h11&lt;br /&gt;
 parent:      32:3732a6888cc4&lt;br /&gt;
 parent:      15:27066b86194e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:49 2012 +0100&lt;br /&gt;
 summary:     Merged in H11&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H11.&lt;br /&gt;
===changeset:   31:7d8a337a7324===&lt;br /&gt;
 tag:         h10&lt;br /&gt;
 parent:      30:86c2a0b6f977&lt;br /&gt;
 parent:      14:62f983246ba7&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H10&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H10.&lt;br /&gt;
===changeset:   29:56fa127c847c===&lt;br /&gt;
 tag:         h08&lt;br /&gt;
 parent:      28:877924b27ee3&lt;br /&gt;
 parent:      13:903ac662c7a2&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:38:04 2012 +0100&lt;br /&gt;
 summary:     Merged in H08&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H08.&lt;br /&gt;
===changeset:   27:a05e10e365c2===&lt;br /&gt;
 tag:         h01&lt;br /&gt;
 parent:      -1:000000000000&lt;br /&gt;
 parent:      12:ae8da988f728&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:35:05 2012 +0100&lt;br /&gt;
 summary:     Fixed bug where code compiled with PGI &amp;gt;= 12 would fail with thread error.&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H01.&lt;br /&gt;
&lt;br /&gt;
==Formatting==&lt;br /&gt;
The format is:&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
Text explaining what this revision contains,&lt;br /&gt;
e.g. all of the below plus merged up to H23&lt;br /&gt;
&lt;br /&gt;
In raw form that&#039;s:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
  tag:         tip&lt;br /&gt;
  parent:      55:f6c5e2290dc4&lt;br /&gt;
  parent:      53:c7f36daff923&lt;br /&gt;
  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
  date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
  summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
 &lt;br /&gt;
 Text explaining what this revision contains,&lt;br /&gt;
 e.g. all of the below plus merged up to H23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the output from &amp;lt;code&amp;gt;hg sum&amp;lt;/code&amp;gt; with the changeset line made into a header, a space&lt;br /&gt;
added to the start of each following line, and more&lt;br /&gt;
explanatory text.  &#039;&#039;&#039;NB, it&#039;s important to add more explanation!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo&amp;diff=257923</id>
		<title>Resgrp:comp-photo</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo&amp;diff=257923"/>
		<updated>2012-10-11T11:48:16Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: /* Codes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Computational Photochemistry Research Group Wiki, Imperial College London =&lt;br /&gt;
&lt;br /&gt;
A place to write something about computing facilities (e.g. CX1),&lt;br /&gt;
documenting codes (Gaussian + dynamics; latest versions)&lt;br /&gt;
and example input files.&lt;br /&gt;
-[[User:Mjbear|Mjbear]] 16:16, 17 October 2008 (BST)&lt;br /&gt;
&lt;br /&gt;
Please amend and update this! Log in using your IC account.&lt;br /&gt;
&lt;br /&gt;
== Computing Resources ==&lt;br /&gt;
=== [[Resgrp:comp-photo-hpc|Using College HPC to run Gaussian: CX1]] ===&lt;br /&gt;
===== [[Resgrp:comp-photo-hpc-ax1|- AX1 / AX2 ]] =====&lt;br /&gt;
=== [[Resgrp:comp-photo-owncomp|Group-managed computers]] ===&lt;br /&gt;
=== [[Resgrp:utilities|Utilities]] ===&lt;br /&gt;
&lt;br /&gt;
== Codes ==&lt;br /&gt;
=== [[Resgrp:comp-photo-gaussian|Gaussian versions]] ===&lt;br /&gt;
===== [[Resgrp:comp-photo-gaussian_problems|- known problems ]] =====&lt;br /&gt;
===Developing Gaussian===&lt;br /&gt;
There&#039;s a new regime!&lt;br /&gt;
====[[Resgrp:comp-photo-version control-local-dev-master|Local development versions]]====&lt;br /&gt;
A page explaining what is in the local development repository.  Currently rather sparse,&lt;br /&gt;
you are encouraged to be much more verbose.&lt;br /&gt;
====[[Resgrp:comp-photo-version control|Using Mercurial]]====&lt;br /&gt;
A rather long manual on why and how to use the mercurial version control system,&lt;br /&gt;
somewhat tailored to Gaussian development.&lt;br /&gt;
====[[Resgrp:comp-photo-version control short|Quick guide to Mercurial]]====&lt;br /&gt;
A short version of the above.&lt;br /&gt;
====[[Resgrp:comp-photo-version control example|Example workflows]]====&lt;br /&gt;
A couple of examples of how one would use mercurial to develop Gaussian&lt;br /&gt;
====[[Resgrp:comp-photo-new gdv layout|The new layout]]====&lt;br /&gt;
An explanation of the new layout of the Gaussian source code necessitated&lt;br /&gt;
by version control.  Plus some tips and tricks.&lt;br /&gt;
=== [[Resgrp:comp-photo-dyn|MCTDH (DD-vMCG)]] ===&lt;br /&gt;
=== [[Resgrp:comp-photo-onthefly|Direct CAS/RAS]] ===&lt;br /&gt;
&lt;br /&gt;
== Example Calculations / Tutorials ==&lt;br /&gt;
=== [[Resgrp:comp-photo-benzene-tutorial|Benzene CASSCF tutorial (G03)]] ===&lt;br /&gt;
=== [[Resgrp:comp-photo-CHD|Seam calculations of CHD]] ===&lt;br /&gt;
===== [[Resgrp:comp-photo-seam|- Current Seam Frequency Code ]] =====&lt;br /&gt;
=== [[Resgrp:comp-photo/sh|Surface Hopping]] ===&lt;br /&gt;
&lt;br /&gt;
=== [[Resgrp:comp-photo/VB|Valence-Bond analysis]] ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[Resgrp:comp-photo-visualise|GaussView, visualisation etc]] ===&lt;br /&gt;
&lt;br /&gt;
=== [[ONIOM]] ===&lt;br /&gt;
&lt;br /&gt;
== Calculations ==&lt;br /&gt;
=== [[Resgrp:comp-photo-calculations|Examples]] ===&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo&amp;diff=257913</id>
		<title>Resgrp:comp-photo</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo&amp;diff=257913"/>
		<updated>2012-10-11T11:41:35Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: /* Codes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Computational Photochemistry Research Group Wiki, Imperial College London =&lt;br /&gt;
&lt;br /&gt;
A place to write something about computing facilities (e.g. CX1),&lt;br /&gt;
documenting codes (Gaussian + dynamics; latest versions)&lt;br /&gt;
and example input files.&lt;br /&gt;
-[[User:Mjbear|Mjbear]] 16:16, 17 October 2008 (BST)&lt;br /&gt;
&lt;br /&gt;
Please amend and update this! Log in using your IC account.&lt;br /&gt;
&lt;br /&gt;
== Computing Resources ==&lt;br /&gt;
=== [[Resgrp:comp-photo-hpc|Using College HPC to run Gaussian: CX1]] ===&lt;br /&gt;
===== [[Resgrp:comp-photo-hpc-ax1|- AX1 / AX2 ]] =====&lt;br /&gt;
=== [[Resgrp:comp-photo-owncomp|Group-managed computers]] ===&lt;br /&gt;
=== [[Resgrp:utilities|Utilities]] ===&lt;br /&gt;
&lt;br /&gt;
== Codes ==&lt;br /&gt;
=== [[Resgrp:comp-photo-gaussian|Gaussian versions]] ===&lt;br /&gt;
===== [[Resgrp:comp-photo-gaussian_problems|- known problems ]] =====&lt;br /&gt;
===Developing Gaussian===&lt;br /&gt;
There&#039;s a new regime!&lt;br /&gt;
====[[Resgrp:comp-photo-version control|Using Mercurial]]====&lt;br /&gt;
A rather long manual on why and how to use the mercurial version control system,&lt;br /&gt;
somewhat tailored to Gaussian development.&lt;br /&gt;
====[[Resgrp:comp-photo-version control short|Quick guide to Mercurial]]====&lt;br /&gt;
A short version of the above.&lt;br /&gt;
====[[Resgrp:comp-photo-version control example|Example workflows]]====&lt;br /&gt;
A couple of examples of how one would use mercurial to develop Gaussian&lt;br /&gt;
====[[Resgrp:comp-photo-new gdv layout|The new layout]]====&lt;br /&gt;
An explanation of the new layout of the Gaussian source code necessitated&lt;br /&gt;
by version control.  Plus some tips and tricks.&lt;br /&gt;
=== [[Resgrp:comp-photo-dyn|MCTDH (DD-vMCG)]] ===&lt;br /&gt;
=== [[Resgrp:comp-photo-onthefly|Direct CAS/RAS]] ===&lt;br /&gt;
&lt;br /&gt;
== Example Calculations / Tutorials ==&lt;br /&gt;
=== [[Resgrp:comp-photo-benzene-tutorial|Benzene CASSCF tutorial (G03)]] ===&lt;br /&gt;
=== [[Resgrp:comp-photo-CHD|Seam calculations of CHD]] ===&lt;br /&gt;
===== [[Resgrp:comp-photo-seam|- Current Seam Frequency Code ]] =====&lt;br /&gt;
=== [[Resgrp:comp-photo/sh|Surface Hopping]] ===&lt;br /&gt;
&lt;br /&gt;
=== [[Resgrp:comp-photo/VB|Valence-Bond analysis]] ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[Resgrp:comp-photo-visualise|GaussView, visualisation etc]] ===&lt;br /&gt;
&lt;br /&gt;
=== [[ONIOM]] ===&lt;br /&gt;
&lt;br /&gt;
== Calculations ==&lt;br /&gt;
=== [[Resgrp:comp-photo-calculations|Examples]] ===&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo&amp;diff=257912</id>
		<title>Resgrp:comp-photo</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo&amp;diff=257912"/>
		<updated>2012-10-11T11:41:00Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: /* Codes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Computational Photochemistry Research Group Wiki, Imperial College London =&lt;br /&gt;
&lt;br /&gt;
A place to write something about computing facilities (e.g. CX1),&lt;br /&gt;
documenting codes (Gaussian + dynamics; latest versions)&lt;br /&gt;
and example input files.&lt;br /&gt;
-[[User:Mjbear|Mjbear]] 16:16, 17 October 2008 (BST)&lt;br /&gt;
&lt;br /&gt;
Please amend and update this! Log in using your IC account.&lt;br /&gt;
&lt;br /&gt;
== Computing Resources ==&lt;br /&gt;
=== [[Resgrp:comp-photo-hpc|Using College HPC to run Gaussian: CX1]] ===&lt;br /&gt;
===== [[Resgrp:comp-photo-hpc-ax1|- AX1 / AX2 ]] =====&lt;br /&gt;
=== [[Resgrp:comp-photo-owncomp|Group-managed computers]] ===&lt;br /&gt;
=== [[Resgrp:utilities|Utilities]] ===&lt;br /&gt;
&lt;br /&gt;
== Codes ==&lt;br /&gt;
=== [[Resgrp:comp-photo-gaussian|Gaussian versions]] ===&lt;br /&gt;
===Developing Gaussian===&lt;br /&gt;
There&#039;s a new regime!&lt;br /&gt;
====[[Resgrp:comp-photo-version control|Using Mercurial]]====&lt;br /&gt;
A rather long manual on why and how to use the mercurial version control system,&lt;br /&gt;
somewhat tailored to Gaussian development.&lt;br /&gt;
====[[Resgrp:comp-photo-version control short|Quick guide to Mercurial]]====&lt;br /&gt;
A short version of the above.&lt;br /&gt;
====[[Resgrp:comp-photo-version control example|Example workflows]]====&lt;br /&gt;
A couple of examples of how one would use mercurial to develop Gaussian&lt;br /&gt;
====[[Resgrp:comp-photo-new gdv layout|The new layout]]====&lt;br /&gt;
An explanation of the new layout of the Gaussian source code necessitated&lt;br /&gt;
by version control.  Plus some tips and tricks.&lt;br /&gt;
===== [[Resgrp:comp-photo-gaussian_problems|- known problems ]] =====&lt;br /&gt;
=== [[Resgrp:comp-photo-dyn|MCTDH (DD-vMCG)]] ===&lt;br /&gt;
=== [[Resgrp:comp-photo-onthefly|Direct CAS/RAS]] ===&lt;br /&gt;
&lt;br /&gt;
== Example Calculations / Tutorials ==&lt;br /&gt;
=== [[Resgrp:comp-photo-benzene-tutorial|Benzene CASSCF tutorial (G03)]] ===&lt;br /&gt;
=== [[Resgrp:comp-photo-CHD|Seam calculations of CHD]] ===&lt;br /&gt;
===== [[Resgrp:comp-photo-seam|- Current Seam Frequency Code ]] =====&lt;br /&gt;
=== [[Resgrp:comp-photo/sh|Surface Hopping]] ===&lt;br /&gt;
&lt;br /&gt;
=== [[Resgrp:comp-photo/VB|Valence-Bond analysis]] ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== [[Resgrp:comp-photo-visualise|GaussView, visualisation etc]] ===&lt;br /&gt;
&lt;br /&gt;
=== [[ONIOM]] ===&lt;br /&gt;
&lt;br /&gt;
== Calculations ==&lt;br /&gt;
=== [[Resgrp:comp-photo-calculations|Examples]] ===&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=257886</id>
		<title>Resgrp:comp-photo-version control-local-dev-master</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control-local-dev-master&amp;diff=257886"/>
		<updated>2012-10-11T11:26:44Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: Created page with &amp;quot;This page will show the current state of the group&amp;#039;s master dev repository (local-dev-master). It will document what code is currently considered to be accepted as ready to use. ...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will show the current state of the group&#039;s master dev repository (local-dev-master).&lt;br /&gt;
It will document what code is currently considered to be accepted as ready to use.&lt;br /&gt;
&lt;br /&gt;
The format is explained [[#Formatting|here]].  You don&#039;t have to describe each revision, just&lt;br /&gt;
whatever the tip is at the time, and whatever might be (or have been) made into a&lt;br /&gt;
compiled version.&lt;br /&gt;
==The revisions==&lt;br /&gt;
The most recent revision (which should be the tip) should always be on top.  Note&lt;br /&gt;
that the &amp;quot;tip&amp;quot; tag may appear incorrectly below.  Also note that the local revision&lt;br /&gt;
numbers (e.g. 56 in changeset:   56:e359f0e1aa5c) may differ in other repositories.  If&lt;br /&gt;
in doubt, use the hex number.&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
The merge of the three features.  Based off H23.&lt;br /&gt;
===changeset:   55:f6c5e2290dc4===&lt;br /&gt;
 parent:      54:0c83655a3822&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:55:17 2012 +0100&lt;br /&gt;
 summary:     Merged olddirect code to H23&lt;br /&gt;
&lt;br /&gt;
Simon&#039;s updates and fixes for the semi-direct matrix element code.&lt;br /&gt;
Based off H23.&lt;br /&gt;
===changeset:   53:c7f36daff923===&lt;br /&gt;
 parent:      52:e11a2fc5b5a8&lt;br /&gt;
 parent:      41:c8a317a36a4e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 12:38:05 2012 +0100&lt;br /&gt;
 summary:     Shaopeng + seamfollowing, merged to H23.&lt;br /&gt;
&lt;br /&gt;
The Shaopeng code and seamfollowing code as below, updated to H23.&lt;br /&gt;
===changeset:   51:dcd851f8dc57===&lt;br /&gt;
 parent:      50:c0a9f878ea3e&lt;br /&gt;
 parent:      39:c90162c4fbe6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Tue Oct 09 22:15:18 2012 +0100&lt;br /&gt;
 summary:     Updated seamfollowing code to H21&lt;br /&gt;
&lt;br /&gt;
This is the imported seam following code updated to H21.&lt;br /&gt;
===changeset:   49:bda0e1259a36===&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Jul 02 15:04:35 2012 +0100&lt;br /&gt;
 summary:     Large modification and cleanup of Shaopeng code.  Below for details.&lt;br /&gt;
&lt;br /&gt;
This contains the Shaopeng matrix element code with most of Simon&#039;s modifications&lt;br /&gt;
and bug fixes in place.  It&#039;s based off version H21&lt;br /&gt;
===changeset:   41:c8a317a36a4e===&lt;br /&gt;
 tag:         h23&lt;br /&gt;
 parent:      40:cfd3ea6fcdff&lt;br /&gt;
 parent:      25:7a8a763281d4&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:45:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H23&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H23.&lt;br /&gt;
&lt;br /&gt;
===changeset:   39:c90162c4fbe6===&lt;br /&gt;
 tag:         h21&lt;br /&gt;
 parent:      38:ef0c2dff2d79&lt;br /&gt;
 parent:      20:dd575870f775&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:44:00 2012 +0100&lt;br /&gt;
 summary:     Merged in H21&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H21.&lt;br /&gt;
===changeset:   37:e972407aab01===&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      36:9d36f9fe483b&lt;br /&gt;
 parent:      17:770721638a7a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:43:06 2012 +0100&lt;br /&gt;
 summary:     Merged in H13&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H13.&lt;br /&gt;
===changeset:   35:10679662e3a3===&lt;br /&gt;
 tag:         h12p&lt;br /&gt;
 parent:      34:3ce1603d2c6c&lt;br /&gt;
 parent:      16:427978d67ed6&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:42:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H12p&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H12p.&lt;br /&gt;
===changeset:   33:a0e0a314db85===&lt;br /&gt;
 tag:         h11&lt;br /&gt;
 parent:      32:3732a6888cc4&lt;br /&gt;
 parent:      15:27066b86194e&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:49 2012 +0100&lt;br /&gt;
 summary:     Merged in H11&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H11.&lt;br /&gt;
===changeset:   31:7d8a337a7324===&lt;br /&gt;
 tag:         h10&lt;br /&gt;
 parent:      30:86c2a0b6f977&lt;br /&gt;
 parent:      14:62f983246ba7&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:39:11 2012 +0100&lt;br /&gt;
 summary:     Merged in H10&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H10.&lt;br /&gt;
===changeset:   29:56fa127c847c===&lt;br /&gt;
 tag:         h08&lt;br /&gt;
 parent:      28:877924b27ee3&lt;br /&gt;
 parent:      13:903ac662c7a2&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:38:04 2012 +0100&lt;br /&gt;
 summary:     Merged in H08&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H08.&lt;br /&gt;
===changeset:   27:a05e10e365c2===&lt;br /&gt;
 tag:         h01&lt;br /&gt;
 parent:      -1:000000000000&lt;br /&gt;
 parent:      12:ae8da988f728&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Mon Oct 08 17:35:05 2012 +0100&lt;br /&gt;
 summary:     Fixed bug where code compiled with PGI &amp;gt;= 12 would fail with thread error.&lt;br /&gt;
&lt;br /&gt;
This is official Gaussian version H01.&lt;br /&gt;
&lt;br /&gt;
==Formatting==&lt;br /&gt;
The format is:&lt;br /&gt;
&lt;br /&gt;
===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      55:f6c5e2290dc4&lt;br /&gt;
 parent:      53:c7f36daff923&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
 summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
&lt;br /&gt;
Text explaining what this revision contains,&lt;br /&gt;
e.g. all of the below plus merged up to H23&lt;br /&gt;
&lt;br /&gt;
In raw form that&#039;s:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 ===changeset:   56:e359f0e1aa5c===&lt;br /&gt;
  tag:         tip&lt;br /&gt;
  parent:      55:f6c5e2290dc4&lt;br /&gt;
  parent:      53:c7f36daff923&lt;br /&gt;
  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
  date:        Wed Oct 10 14:56:24 2012 +0100&lt;br /&gt;
  summary:     Merged Shaopeng, seamfollowing, olddirect (H23)&lt;br /&gt;
 &lt;br /&gt;
 Text explaining what this revision contains,&lt;br /&gt;
 e.g. all of the below plus merged up to H23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the output from &amp;lt;code&amp;gt;hg sum&amp;lt;/code&amp;gt; with the changeset line made into a header, a space&lt;br /&gt;
added to the start of each following line, and more&lt;br /&gt;
explanatory text.  &#039;&#039;&#039;NB, it&#039;s important to add more explanation!&#039;&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_example&amp;diff=257864</id>
		<title>Resgrp:comp-photo-version control example</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_example&amp;diff=257864"/>
		<updated>2012-10-11T10:48:50Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: Created page with &amp;quot;This is an example of how one might use mercurial to work on the gaussian code.  ==Adding a feature you&amp;#039;ve already coded== &amp;#039;&amp;#039;&amp;#039;You&amp;#039;ve got a set of changes that constitute some nea...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is an example of how one might use mercurial to work on the gaussian code.&lt;br /&gt;
&lt;br /&gt;
==Adding a feature you&#039;ve already coded==&lt;br /&gt;
&#039;&#039;&#039;You&#039;ve got a set of changes that constitute some neat feature or bug fix, and you&#039;&#039;&#039;&lt;br /&gt;
&#039;&#039;&#039;want to get it checked into a repository.  It&#039;s based off some older version of Gaussian and&#039;&#039;&#039;&lt;br /&gt;
&#039;&#039;&#039;you want to bring it up to date with the latest version.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
First, check out a clone of the gaussian-inc-versions repository.  We&#039;ll use&lt;br /&gt;
&amp;lt;code&amp;gt;-u h21&amp;lt;/code&amp;gt; to check out a working directory with a buildable and&lt;br /&gt;
locally bug-fixed H21 release in it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg clone -u h21 /home/gaussian-devel/repositories/gaussian-inc-versions myrepo&lt;br /&gt;
 13578 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 $ cd myrepo&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The repository only goes as far back as H01 (at the moment), so if you&#039;re based off a different&lt;br /&gt;
release you&#039;ll have to either update it manually to h01 or work out how&lt;br /&gt;
to import your earlier release into a mercurial repository.&lt;br /&gt;
&lt;br /&gt;
Now copy your own code over the code in the working directory.  Obviously routines for&lt;br /&gt;
L510 go in the l510 directory and so on.  Util files go in either utilam, utilnz, osutil, putil, etc.  You can see what files you&#039;ve added or altered using &amp;lt;code&amp;gt;hg stat&amp;lt;/code&amp;gt;.  If your&lt;br /&gt;
change requires that you &#039;&#039;remove&#039;&#039; files use &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt; rather than regular &amp;lt;code&amp;gt;rm&amp;lt;/code&amp;gt;.&lt;br /&gt;
Once you&#039;re content that all your code is in the working directory you can do a:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg addremove&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will mark to be added any files that you&#039;ve added.  Check you&#039;re not adding things like&lt;br /&gt;
test jobs (we need these somewhere else -- where?), temporary files, etc.&lt;br /&gt;
&lt;br /&gt;
Now check in your code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg commit&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An editor will open and you can write a useful log message detailing what this code does.&lt;br /&gt;
Be as verbose as you like, but make the first line be a useful summary.  Now this repository holds&lt;br /&gt;
your feature.  Only your repository has this change; you may decide to work on it some more,&lt;br /&gt;
or throw it away by deleting the repository.  You may also want to update&lt;br /&gt;
your code to the latest Gaussian version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg merge h23&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg merge&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
to update to the latest version, whatever that is.&lt;br /&gt;
&lt;br /&gt;
Once the merge is done and you&#039;ve resolved any conflicts commit again, noting in&lt;br /&gt;
your log message that you&#039;ve updated to a particular version:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg commit -m &#039;Updated my feature to H23&#039;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, you can share these changes with your other repositories (to combine your features)&lt;br /&gt;
or with other people.  You can also pull them into a local-dev-master (see below) repository&lt;br /&gt;
to merge in other local group features.&lt;br /&gt;
&lt;br /&gt;
==Getting a version to code something new into==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You&#039;ve been told to grab the latest local development changeset and code in something new.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Start by cloning the latest development repository:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 $ hg clone /home/gaussian-devel/repositories/local-dev-master&lt;br /&gt;
 updating to branch default&lt;br /&gt;
 13722 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create a clone of the repository in the current directory with the name&lt;br /&gt;
&#039;local-dev-master&#039;.  You can override this if you want.&lt;br /&gt;
&lt;br /&gt;
Use &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg sum&amp;lt;/code&amp;gt; and check out [[Resgrp:comp-photo-version control-local-dev-master|the wiki page documenting code in this repository]] to get an idea of what&lt;br /&gt;
you&#039;re starting from.  Generally this repository will hold features and bug fixes that the&lt;br /&gt;
group deems ready for prime time usage; code here is probably intended to go to Gaussian, Inc.&lt;br /&gt;
and is the correct starting point for new features.&lt;br /&gt;
&lt;br /&gt;
As you code, commit your changes using &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt; at appropriate points.  This is&lt;br /&gt;
sort of up to you, but it would be nice if we could agree to check in code that compiles.&lt;br /&gt;
Really though, it doesn&#039;t matter too much, as we can combine sets of revisions should we need to.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=256817</id>
		<title>Resgrp:comp-photo-version control</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=256817"/>
		<updated>2012-10-08T13:25:26Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: /* Short version */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This document will teach you the basics of using mercurial, a distributed version control system (DVCS).  It is particularly directed towards using mercurial with the development version of Gaussian, so the examples will use Gaussian.  For more information on mercurial you can use the built-in help system &amp;lt;code&amp;gt;hg help&amp;lt;/code&amp;gt;, look at the official website: http://mercurial.selenic.com/wiki/Mercurial, or check out the official O&#039;Reilly book, the text of which is freely available at: http://hgbook.red-bean.com/.&lt;br /&gt;
&lt;br /&gt;
A version control system can sometimes seem an onerous imposition unless the user understands how it is going to help them in their work, so I&#039;ll try to briefly explain.  Version control is about tracking changes to data.  If one has a collection of files, say a distribution of Gaussian, then one is interested in changes that have been made to those files, whether from a new distribution from Gaussian or our own modifications.  We are particularly interested in cases where overlapping changes have been made.  These might be updates and bug fixes from Gaussian conflicting with our own modifications to a particular link, or it might be different researchers in a group working on the same piece of code independently.  A version control system will not only detect such cases but provide automated and safe methods for merging conflicting changes.&lt;br /&gt;
&lt;br /&gt;
Central to the idea of a VCS is the concept of a revision or changeset.  This is like a snapshot of some set of files and directories at some particular instant in their history.  A repository is where a VCS stores revisions.  So, using Gaussian as an example, some revisions in a particular repository might be the Gaussian source tree corresponding to Gaussian development versions H01, H08, H10, H11, etc.  The data that are actually kept inside the repository are the differences, or deltas, between the revisions.  This saves space compared to storing all the revisions.&lt;br /&gt;
&lt;br /&gt;
== Short version ==&lt;br /&gt;
&lt;br /&gt;
I&#039;ve made a summary version of this document [[Resgrp:comp-photo-version control short|here]].&lt;br /&gt;
I&#039;ve also made an [[Resgrp:comp-photo-version control example|example workflow]].&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment (.hgrc)==&lt;br /&gt;
There are some one-off things you must do.  Firstly, edit your login scripts (&amp;lt;code&amp;gt;.bash_profile&amp;lt;/code&amp;gt; or similar) to include the command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 module load mercurial&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(If you&#039;re not on an IC HPC machine mercurial is available anywhere that runs Python.  It is generally available in distribution package systems, if not you can get it from http://mercurial.selenic.com/wiki/Mercurial).  Note that the Redhat provided mercurial on RHEL 5 and 6 is quite old and does not, at time of writing, support the repositories I have created.&lt;br /&gt;
&lt;br /&gt;
Next, create a file called &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; in your home directory and insert the following lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 username = Your Name &amp;lt;your@email.address&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(so for example, my &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; contains this line: &amp;lt;code&amp;gt;username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
Mercurial uses this username field to record who has changed what.  (If you&#039;re not on an IC HPC machine your version of mercurial may not&lt;br /&gt;
have the graphlog extension.  If it doesn&#039;t, don&#039;t worry, it&#039;s merely a tool for visualising changesets).&lt;br /&gt;
&lt;br /&gt;
== Checking out a repository (hg clone, hg log) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s get started and check out a repository.  Once you have loaded the mercurial module you will be able to type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussian-devel/example-gaussian-repo testrepo&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a copy of the repository at &amp;lt;code&amp;gt;/home/gaussian-devel/example-gaussian-repo&amp;lt;/code&amp;gt; and place it in a directory inside the current directory called &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt;.  You can give a full path as the second argument, or, you can leave it off altogether in which case mercurial will clone the repository into a directory named &amp;lt;code&amp;gt;example-gaussian-repo&amp;lt;/code&amp;gt;.  A note here for Imperial HPC users.  Copying a repository involves quite a bit of filesystem activity.  I have found that on cx1 this can be quite slow on the &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; filesystems.  You may wish to try these examples in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; filesystem which is a lot faster.  Be aware, however, that this raises two potentially serious problems.  The first is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is globally readable so before you clone you must make sure that your umask is set to &amp;lt;code&amp;gt;0077&amp;lt;/code&amp;gt;.  The second, of course, is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is periodically wiped.  If you plan on working in &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; there are simple ways of transferring information between repositories (&amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt;) that I will cover later.&lt;br /&gt;
&lt;br /&gt;
Now change into the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory.  Inside you will see three scripts and a &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory; also some hidden files and a hidden directory.  Inside the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory you will see the Gaussian source in the [[Resgrp:comp-photo-new gdv layout|new layout]].  The hidden &amp;lt;code&amp;gt;.hg&amp;lt;/code&amp;gt; directory inside the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory is the repository proper; you will almost never need to do anything in here.  The rest of the files and directories are called the working directory; this is where you will do your work.&lt;br /&gt;
&lt;br /&gt;
The first thing you might want to do is check the history of this repository to see past revisions that have been checked into it.  You do this with the &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log | head -20&lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 &lt;br /&gt;
 changeset:   22:6c81eb8dcbab&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      21:5b6ac3665a29&lt;br /&gt;
 parent:      11:a0c273aeeb2b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:08 2012 +0000&lt;br /&gt;
 summary:     Gaussian devel version H13 with our makefiles&lt;br /&gt;
 &lt;br /&gt;
 changeset:   21:5b6ac3665a29&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:41:40 2012 +0000&lt;br /&gt;
 summary:     Added tag h12p for changeset 0ef14d7dff56&lt;br /&gt;
 ...&lt;br /&gt;
 changeset:   1:515a93bfc3b5&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:10 2012 +0000&lt;br /&gt;
 summary:     Added tag h01-raw for changeset 073d6aa63ea7&lt;br /&gt;
 &lt;br /&gt;
 changeset:   0:073d6aa63ea7&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h01-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:09 2012 +0000&lt;br /&gt;
 summary:     Output from old-to-new.sh on version H01&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
You will see that there are various fields that may appear for each changeset.  The changeset field shows two numbers separated by a colon.  The second, longer, hexadecimal number is the unique identifier.  A particular hex identifier will always refer to the same changeset, even in different copies of the repository.  The first number is a local identifier.  These local IDs refer to particular changesets in one copy of the repository; if these changesets are present in another repository they may have a different local identifier.    You can use either identifier as an argument to &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands.  The user and date fields show who committed the change and when.  The summary field shows the first line of the log entry for that revision.  This means it is important to try to make the first line of your log entries a useful summary of what you have done!&lt;br /&gt;
&lt;br /&gt;
To see the entry for a particular revision use the &amp;lt;code&amp;gt;-r&amp;lt;/code&amp;gt; flag with a revision number, either short or long.  To see more information, including the full log entry and a complete list of all files involved in the change, use the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag, e.g.:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -r 2 -v | less&lt;br /&gt;
 changeset:   2:9f69ed4616ad&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h08-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:54:50 2012 +0000&lt;br /&gt;
 files:       gdv/archlib/arcvib.F gdv/archlib/brcpyw.F gdv/archlib/letset.F gdv/arctmp.F gdv/bsd/GauDiff_Compare.pm gdv/bsd/G&lt;br /&gt;
 ....&lt;br /&gt;
 at.F gdv/utilnz/xpndnb.F gdv/utilnz/zerock.F gdv/utilnz/zerod.F gdv/wrappers/ggeev.F gdv/wrappers/lappar.F gdv/wrappers/xgetrf.F  gdv/wrappers/xgetrs.F gdv/wrappers/ygeru.F gdv/wrappers/ytrsv.F&lt;br /&gt;
 description:&lt;br /&gt;
 Import of gdv H08.  See below for details.&lt;br /&gt;
 &lt;br /&gt;
 Result of these commands on the H01 raw rev:&lt;br /&gt;
 rm -fr gdv&lt;br /&gt;
 cp -pr h08/new-style-gdv .&lt;br /&gt;
 hg add gdv/bsd/*.a&lt;br /&gt;
 hg addremove -s 50&lt;br /&gt;
 &lt;br /&gt;
 h08/new-style is from old-to-new.sh on freshly untarred h08.tgz&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
As the log entry explains, this particular revision is the change from the H01 version of Gaussian to the H08 version, so there are a lot of changed files.  The description entry is intended to provide some human readable explanation of the changes.  When you start committing data to the repository you should aim to at least make your log entries understandable.&lt;br /&gt;
&lt;br /&gt;
As with all the commands that I will mention you can get more information by typing &amp;lt;code&amp;gt;hg help &amp;lt;command&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Committing changes (hg summary, hg status, hg diff) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make some alterations to this repository.  This is quite safe; we can&#039;t break the original repository because our copy is an entirely separate clone.  In fact, this is a very common working practice with mercurial.  As long as the filesystem isn&#039;t slow cloning a repository can be quite quick.  Indeed, cloning a repository into a destination on the same filesystem as the source makes use of hard linking which is very fast and saves space.  Therefore, it is very common to clone a repository, make some alterations to it, and then decide whether to push them back to the original repository or just delete the new clone.&lt;br /&gt;
&lt;br /&gt;
First, we want to know where it is we are starting from.  To get a quick summary you use the &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; command.  This should show something like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg summary&lt;br /&gt;
 parent: 23:1de40efd1c4b tip&lt;br /&gt;
 Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 branch: default&lt;br /&gt;
 commit: (clean)&lt;br /&gt;
 update: (current)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows, on the parent line, the revision that has been checked out into the working directory.  Below that is the summary line from the log entry for that revision.  The commit line shows if any files have been modified since the check out.  The update line shows if there are any applicable newer revisions in the repository.  In this example the output shows us that we checked out the revision with the local identifier 23, and unique identifier of 1de40efd1c4b, that we have modified nothing and that there are no appropriate newer revisions.  This checkout occurred automatically as a part of the &amp;lt;code&amp;gt;hg clone&amp;lt;/code&amp;gt; command.  You can clone without checking anything out into the working directory (say to make a backup copy of the repository) by passing the &amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; flag, or you can check out a particular revision with the &amp;lt;code&amp;gt;-u REV&amp;lt;/code&amp;gt; flag.  See &amp;lt;code&amp;gt;hg help clone&amp;lt;/code&amp;gt; for how mercurial chooses what to check out by default.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say we&#039;re adding a feature to link 510.  If you have something in mind go ahead and do it. For this example I have just added a few lines to the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, and will assume that your current working directory is &amp;lt;code&amp;gt;gdv/l510&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As you work you may be curious to know what it is you have changed.  The command to show this is &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The output shows a list of files that have been altered in some way.  Here the capital M shows that the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified.  By default &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; does not report on unchanged files.  If we wish to see how &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified we can use the &amp;lt;code&amp;gt;hg diff&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 11:07:55 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Add super new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows the output in a unified different format, refer to the man page for diff for more information.&lt;br /&gt;
&lt;br /&gt;
== Adding, copying, renaming, and deleting file (hg add, hg forget, hg mv, hg rm, hg cp) ==&lt;br /&gt;
&lt;br /&gt;
If you have created a new file then you must let mercurial know about its existence with the &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ echo &amp;quot;a new subroutine&amp;quot; &amp;gt; foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 ? gdv/l510/foo.F&lt;br /&gt;
 testrepo$ hg add foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here, I create a new file called &amp;lt;code&amp;gt;foo.F&amp;lt;/code&amp;gt;.  &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with a ?,  to indicate that it is unknown to the repository.  I then run &amp;lt;code&amp;gt;hg add foo.F&amp;lt;/code&amp;gt;, after which &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with an A.  This indicates that the file is scheduled to be added at the next commit.  If you change your mind about the file before the next commit you can use &amp;lt;code&amp;gt;hg forget&amp;lt;/code&amp;gt; to undo the add.&lt;br /&gt;
&lt;br /&gt;
If you are renaming a file, including the situation where you move the file from one directory to another (e.g. from l510 to utilam) then you may use the &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; command.  This will actually perform the move just like the normal &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; command.  If you&#039;ve already moved the file you can give &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; the &amp;lt;code&amp;gt;-A&amp;lt;/code&amp;gt; flag to record the rename after the fact.  Similarly, the &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt; command removes files from the working directory and records this fact in the repository, and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; copies a file.&lt;br /&gt;
&lt;br /&gt;
It is important to realise that these commands act on the working directory immediately but only affect the repository when they are committed.  Also, they do not affect the repository&#039;s previous history, so removing a file and then committing that change does not affect that file&#039;s existence in previous revisions in the repository.  However, &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; create a relationship between the source and destination files.  This becomes useful when merging in changes from somewhere else.  So for example, above I have made changes to &amp;lt;code&amp;gt;l510/a1tdep.F&amp;lt;/code&amp;gt;.  Let&#039;s say that someone else has decided to make this into a utility routine and has done the command &amp;lt;code&amp;gt;hg mv l510/a1tdep.F utilam/a1tdep.F&amp;lt;/code&amp;gt;.  If I choose to merge my changes with this other person&#039;s, mercurial will correctly apply the changes &#039;&#039;&#039;and&#039;&#039;&#039; move the file.  If instead of &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; they had used &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; then my changes would be applied to both files.  This means that you should only use &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; when it is appropriate that changes that are recorded before the copy are applied to both files.  Note that this does not mean that changes to the source file are forever applied to the destination file; this will only occur when merging a revision that does not contain a copy with a revision that does.  In general, you can expect mercurial to do the right thing.&lt;br /&gt;
&lt;br /&gt;
== Committing the changes (hg commit, hg tip) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt; (like many &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands, &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commit has an alias, in this case &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;.  I tend to use &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;) command creates a new revision and records the differences between the entire working directory and the parent revision (as shown on the parent line of &amp;lt;code&amp;gt;hg summary).  This will be the same as the output from &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;.  When you run the command mercurial will open a text editor.  If you wish to specify which editor is used add an &amp;lt;code&amp;gt;editor=vim&amp;lt;/code&amp;gt; (for example) line to the &amp;lt;code&amp;gt;[ui]&amp;lt;/code&amp;gt; part of your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file.  The editor will start with a couple of empty lines and then some lines beginning with &amp;quot;&amp;lt;code&amp;gt;HG:&amp;lt;/code&amp;gt;&amp;quot;.  These are there to give you helpful reminders of what you&#039;ve changed while you write your log message and will be ignored by mercurial when you commit.  If you close the editor without writing anything, or of the editor quits with an error, mercurial will abort the commit.  So for our current example:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci&lt;br /&gt;
 ... [opens vim]&lt;br /&gt;
 HG: Enter commit message.  Lines beginning with &#039;HG:&#039; are removed.&lt;br /&gt;
 HG: Leave message empty to abort commit.&lt;br /&gt;
 HG: --&lt;br /&gt;
 HG: user: Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 HG: branch &#039;default&#039;&lt;br /&gt;
 HG: added gdv/l510/foo.F&lt;br /&gt;
 HG: changed gdv/l510/a1tdep.F&lt;br /&gt;
 ~&lt;br /&gt;
 ~&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For short messages you can skip the editor step by passing the &amp;lt;code&amp;gt;-m &amp;quot;Log message here&amp;quot;&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
Understanding what you are doing here is essential to knowing what to write in the log and, importantly, when to commit.  There are two schools of thought.  When you commit you are creating a new revision in your local repository.  Since it is your repository, and as I have previously mentioned, it is very simple to create new repositories, you should commit whenever you feel like it and feel free to write cryptic log messages that only you will understand.  On the other hand, you are engaged in a collaborative exercise with other people: creating what will be a single version of Gaussian that contains yours and others&#039; modifications and Gaussian&#039;s updates.  Therefore, you should only commit when your code satisfies pre-agreed group requirements, and your log message should be detailed and comprehensible to anybody who reads it, even 50 years in the future.  The correct approach, of course, is to do both.&lt;br /&gt;
&lt;br /&gt;
Mercurial is a distributed version control system which means that each repository is the responsibility of its owner who can feel free to commit as frequently (or infrequently) as needed.  Sometimes adding a feature or removing a bug might take weeks, and you might feel that there is no point taking snapshots of the code until it works.  Other modifications might proceed incrementally with naturally defined stopping points between the start and the end.  Committing at these points makes perfect sense: not only does it leave a history of the modification, it provides checkpoints, versions of the code that you can retreat to without having to start again.  The log messages may tersely explain what has happened since the last revision (and note there is no point listing modified, added, etc, files as this information is stored in the commit anyway) or they may contain detailed essays on how a bug arose and the steps you have taken to fix it.  Information in the logs is searchable and should be thought of as both an aide memoir for yourself and a journal entry for others.&lt;br /&gt;
&lt;br /&gt;
When the time comes to merge your changes into other people&#039;s repositories, you might start thinking about the quality of your commit.  Does the code compile?  Does it run the test suite?  Can it run any test?  Have you committed a test that checks the code you have added or altered?  The group may decide that revisions that are being shared must answer yes to some or all of these questions.  You may decide that some or all of your revisions must pass these quality checks.  Or, you may be satisfied with noting in the log entry what this particular revision can or can&#039;t do (such as compile or run).&lt;br /&gt;
&lt;br /&gt;
It should be said though, that if you ever think &amp;quot;perhaps I should check in at this point&amp;quot;, then go for it.  Revisions live in the history of your repository forever (although see &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;), but when you transfer them to other people&#039;s repositories multiple revisions can be collapsed into one, or fixed in other ways.&lt;br /&gt;
&lt;br /&gt;
Returning to our example I enter a simple message.  Since &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; only shows the first line of any log entry by default it is a good idea to make this line a summary of the rest of the message.  I close the editor and the commit is done.&lt;br /&gt;
&lt;br /&gt;
We can see the results in the repository with an &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command (the &amp;lt;code&amp;gt;-l 2&amp;lt;/code&amp;gt; flag shows the last two revisions):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -l 2&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 summary:     A test message.&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Alternatively we can use the &amp;lt;code&amp;gt;hg tip&amp;lt;/code&amp;gt; command to show the most recently added repository, whether by ourselves, or by pulling from another repository (see later).&lt;br /&gt;
&lt;br /&gt;
== Fixing mistakes (hg revert, hg rollback) ==&lt;br /&gt;
&lt;br /&gt;
You can return one or more files, or the entire repository, to the state they were in when you last checked them out with in the &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; command.  Let&#039;s make an ill-advised alteration to our now committed change to &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ sed -i &#039;s/super/super duper/&#039; a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 13ecff0136c2 gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 17:23:42 2012 +0000&lt;br /&gt;
 @@ -27,7 +27,7 @@&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
  c&lt;br /&gt;
 -c     Add super new feature&lt;br /&gt;
 +c     Add super duper new feature&lt;br /&gt;
  c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ? gdv/l510/a1tdep.F.orig&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 testrepo$ rm a1tdep.*&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ! gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I use revert to undo the modifications to a file.  Notice that &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; leaves a copy of the modified file in &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt;.  This shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as an unknown file (&amp;quot;?&amp;quot;).  Also notice that while trying to delete the .orig file I have accidentally deleted &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, which now shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as a missing file (&amp;quot;!&amp;quot;).  I can revert this mistake too:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 testrepo$ ls a1tdep.F&lt;br /&gt;
 a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; can also be used to cancel scheduled adds, removes, copies, and renames.&lt;br /&gt;
&lt;br /&gt;
If you have just committed a revision and then change your mind you may be able to undo the effect with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;.  Doing this for our example gives us:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg rollback&lt;br /&gt;
 repository tip rolled back to revision 23 (undo commit)&lt;br /&gt;
 working directory now based on revision 23&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This removes the revision we just checked in from the repository but does not alter the current working directory.  If we choose, we could now use &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; to restore these to their revision 23 state.  There are two important caveats with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;: it can only remove the last checked in revision, and that it is usually pointless to rollback a revision that has already been pushed or pulled (see later) into somebody else&#039;s repository, as we can only affect our repository.  For the purposes of this example, I will once more check in the changes I have made:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci -m &#039;A test message&#039;&lt;br /&gt;
 testrepo$ hg tip&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:38:52 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Collaboration (hg incoming, hg pull, hg outgoing, hg push, hg update, hg parent) ==&lt;br /&gt;
&lt;br /&gt;
The tools described are already quite useful, and form the basis of the very earliest revision control systems.  The benefits of being able to detect what you&#039;ve changed, and how you&#039;ve changed it, being able to undo the changes selectively, and being able to take a snapshot of your work at any point of your choosing should be apparent.  The true power, however, of a modern version control system is how it mediates different streams of changes, particularly those from other users.  Note that a DVCS does not solve problems of merging and so on, but provides you, the user, with tools to solve them.&lt;br /&gt;
&lt;br /&gt;
Revisions in the repository form a directed acyclic graph (DAG).  Every revision apart from the first has at least one parent revision and may have zero or more child revisions.  A revision with no children is called a &#039;&#039;head&#039;&#039;.  Generally development takes place at a head of the repository: checking in a new revision onto a head creates and consumes a head.  However, it is possible to add a child to any revision, possibly creating a new head.  This is known as a branch, and may be named or unnamed.  A revision with children may still be a branch head if it has no children on its branch.&lt;br /&gt;
&lt;br /&gt;
There are various ways of managing branches.  You can have a few repositories with many branches, named and unnamed.  Or you can have many repositories with largely unbranched graphs; it&#039;s up to you.  Since mercurial uses heads as the default targets for some of its operations the latter approach is probably best for beginners as it makes operations within each repository simpler.&lt;br /&gt;
&lt;br /&gt;
This is probably best illustrated with an example.  I&#039;ll make a copy of the original repository, make a different change, and then merge the changes.  Change directory out of the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussiandevel/example-gaussian-repo testmerge&lt;br /&gt;
 updating to branch default&lt;br /&gt;
 13427 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we go into the new repository and make some modifications.  This time I alter the files &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;a2tdep.F&amp;lt;/code&amp;gt;, and add a file &amp;lt;code&amp;gt;bar.F&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 …[alterations to a1tdep.F, a2tdep.F, and bar.F]...&lt;br /&gt;
 testmerge$ hg add gdv/l510/bar.F&lt;br /&gt;
 testmerge$ hg diff&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Some new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a2tdep.F&lt;br /&gt;
 --- a/gdv/l510/a2tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a2tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -16,6 +16,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **DETERMINE IF WE RUN THE TIMEDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Super duper feature here too&lt;br /&gt;
 +c&lt;br /&gt;
        LenTst=0&lt;br /&gt;
        CALL FILEIO(11,jTDep,LenTst,0,0)&lt;br /&gt;
        IF (LenTst.EQ.0.OR.iopv.NE.23)RETURN&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/bar.F&lt;br /&gt;
 --- /dev/null   Thu Jan 01 00:00:00 1970 +0000&lt;br /&gt;
 +++ b/gdv/l510/bar.F    Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -0,0 +1,1 @@&lt;br /&gt;
 +Stuff in here&lt;br /&gt;
 testmerge$&lt;br /&gt;
 testmerge$ hg ci -m &#039;Added second new feature&#039;&lt;br /&gt;
 testmerge$ hg log -l 2&lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The situation now is that we have two repositories where there are revisions whose parent is revision 23 (23:1de40efd1c4b, in fact).  This sort of scenario might arise because we have been working on two different features in two different repositories, or it may be that two users have been working separately.  At some point you may wish to merge the work.  It&#039;s up to you when and how you do this: you may wish to merge in bug fixes quite frequently, and incorporate brand-new features much less frequently.  You can of course clone another repository in which to do the merge so that if it isn&#039;t satisfactory you can just delete the repository.&lt;br /&gt;
&lt;br /&gt;
First we must pull the revisions from one repository to another.  We use the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pull&amp;lt;/code&amp;gt; commands to do this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg incoming ../testrepo&lt;br /&gt;
 comparing with ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testmerge$ hg pull ../testrepo&lt;br /&gt;
 pulling from ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 adding changesets&lt;br /&gt;
 adding manifests&lt;br /&gt;
 adding file changes&lt;br /&gt;
 added 1 changesets with 2 changes to 2 files (+1 heads)&lt;br /&gt;
 (run &#039;hg heads&#039; to see heads, &#039;hg merge&#039; to merge)&lt;br /&gt;
 testmerge$ hg log -l 3&lt;br /&gt;
 changeset:   25:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 &lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command takes another repository as its argument and shows a list of revisions that are not present in the current repository.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command brings those revisions over into the current repository.  The &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command shows changeset 25 in the testmerge repository corresponds to number 24 in the original &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository.  Note the long ID is the same in both cases.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command reports that it has created a new head.  We can see this clearly with the &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt; command (from the graphlog extension). The &amp;lt;code&amp;gt;-r 23:&amp;lt;/code&amp;gt; flag tells &amp;lt;code&amp;gt;glog&amp;lt;/code&amp;gt; to show revisions 23 and greater, for clarity:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -r 23:&lt;br /&gt;
 o  changeset:   25:13ecff0136c2&lt;br /&gt;
 |  tag:         tip&lt;br /&gt;
 |  parent:      23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 |  summary:     A test message&lt;br /&gt;
 |&lt;br /&gt;
 | @  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; command can also be used to copy revisions from one repository to another.  It works much as you would expect, except that by default it does not permit the creation of new heads in the destination repository.  The idea is that you tend to pull into your own repository, where you&#039;re expected to know what you&#039;re doing, while you might be pushing into someone else&#039;s repository, where creating a new head might cause confusion.  &amp;lt;code&amp;gt;hg outgoing&amp;lt;/code&amp;gt; is the corresponding analogue to the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
In our example we now have a situation where we have two heads.  This can arise from revisions being created in different repositories and then pulled together, as shown.  Alternatively you can just create new heads in one repository.  A disadvantage of the single repository technique is that if you decide branch is going nowhere and elect not to merge or proceed with it, it still remains in your repository.  With multiple repositories you can just delete the offending repository.&lt;br /&gt;
&lt;br /&gt;
== Merging two sets of changes (hg merge, hg resolve) ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say that I decide that these two features will work together and I want to merge the two branches.  I can use the &amp;lt;code&amp;gt;hg up&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;hg update&amp;lt;/code&amp;gt;) command to update the current working directory to a particular revision in the repository.  If no revision is specified it will update to the current branch head.  The revision updated to becomes the parent (as shown by &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg parent&amp;lt;/code&amp;gt;) of the working directory.  If there are modified files in the working directory the update may attempt a merge.  The revision of the working directory when you start to merge is called the base of the merge.  This is important if the two revisions you are merging are on different branches, because the newly merged revision will stay on the base branch.  Note that the &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command does not update the working directory, so in this case it will still be at revision 24.  Let&#039;s update to revision 25 and then merge the changes from revision 24:&lt;br /&gt;
&lt;br /&gt;
[Which revision to merge from: in general you merge changes into whatever is your current baseline.  So, if you&#039;re merging the latest updates from Gaussian (from H10 to H11 for example) into your code, you update to your code and merge in the H11 revision.  If you&#039;re merging in your changes into the soon to be sent to Gaussian group development version you&#039;d start with that and merge in the revision(s) containing your changes]&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg up 25&lt;br /&gt;
 3 files updated, 0 files merged, 1 files removed, 0 files unresolved&lt;br /&gt;
 testmerge$ hg merge 24&lt;br /&gt;
 merging gdv/l510/a1tdep.F&lt;br /&gt;
 warning: conflicts during merge.&lt;br /&gt;
 merging gdv/l510/a1tdep.F failed!&lt;br /&gt;
 2 files updated, 0 files merged, 0 files removed, 1 files unresolved&lt;br /&gt;
 use &#039;hg resolve&#039; to retry unresolved file merges or &#039;hg update -C .&#039; to abandon&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The software automatically brings in the changes to foo.F, bar.F, and a2tdep.F (as &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; will show).  However, in our contrived example &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; is subject to changes from both revisions.  Mercurial will attempt to merge automatically, and in this case it fails.  If you edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; you will see it contains the lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 =======&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
which were inserted during the failed merge.  There is also an &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt; file created as a result of the failed merge.  As the output from &amp;lt;code&amp;gt;hg merge&amp;lt;/code&amp;gt; says you can either now resolve this failed merge or use &amp;lt;code&amp;gt;hg update -C&amp;lt;/code&amp;gt; to undo it (the &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; file will remain).&lt;br /&gt;
&lt;br /&gt;
Since we want to resolve the merge we should edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; so that it works.  At a bare minimum we will have to remove the “&amp;lt;code&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&amp;lt;/code&amp;gt;”, “&amp;lt;code&amp;gt;=======&amp;lt;/code&amp;gt;”, and “&amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&amp;lt;/code&amp;gt;” marker lines.  In a more complex situation we might have to completely rewrite this and other files.  This is what I mean when I say that mercurial only provides tools to do merging.  Even a completely successful merge, from mercurial&#039;s point of view, may be completely bogus code.&lt;br /&gt;
&lt;br /&gt;
There are tools available to make this task easier.  For example I use &amp;lt;code&amp;gt;vimdiff&amp;lt;/code&amp;gt;, a part of the popular &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; package.  To enable this I have altered my &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file to look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 merge = vimdiff&lt;br /&gt;
 username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
 &lt;br /&gt;
 [merge-tools]&lt;br /&gt;
 vimdiff.executable = vim&lt;br /&gt;
 vimdiff.args = -d $base $local $output $other +close +close&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
as per http://mercurial.selenic.com/wiki/MergingWithVim.  The page http://mercurial.selenic.com/wiki/MergeProgram contains instructions for other tools, including Emacs, and graphical tools.  If you edit your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file in this way then you now can type &amp;lt;code&amp;gt;hg resolve --all&amp;lt;/code&amp;gt; to run your chosen tool on all unresolved files.  Note that by default if your chosen tool exits without an error then &amp;lt;code&amp;gt;hg resolve&amp;lt;/code&amp;gt; will regard that file as resolved.  To cause &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; to exit with an error use &amp;lt;code&amp;gt;:cq&amp;lt;/code&amp;gt;.  See &amp;lt;code&amp;gt;hg help resolve&amp;lt;/code&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
In the example my resolution is to have the relevant lines in &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 c&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have resolved all the files that mercurial thinks need fixing you should check that the final merged result makes sense.  Checking that it compiles, or runs tests appropriate to both of the original revisions, for example.  When you are satisfied, you should check in the merged revision:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg ci -m &#039;Merged super and duper features&#039;&lt;br /&gt;
 &lt;br /&gt;
 testmerge$ hg tip&lt;br /&gt;
 &lt;br /&gt;
 changeset:   26:857f81e59d66&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      25:13ecff0136c2&lt;br /&gt;
 parent:      24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 13:10:52 2012 +0000&lt;br /&gt;
 summary:     Merged super and new features&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 testmerge$&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the new revision has &#039;&#039;two&#039;&#039; parent revisions; a merge always consumes a head.  This is clear from the output of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -l 4&lt;br /&gt;
 o    changeset:   26:857f81e59d66&lt;br /&gt;
 |\   tag:         tip&lt;br /&gt;
 | |  parent:      25:13ecff0136c2&lt;br /&gt;
 | |  parent:      24:457db23c0b1a&lt;br /&gt;
 | |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 | |  date:        Thu Jan 26 13:10:52 2012 +0000&lt;br /&gt;
 | |  summary:     Merged super and new features&lt;br /&gt;
 | |&lt;br /&gt;
 | o  changeset:   25:13ecff0136c2&lt;br /&gt;
 | |  parent:      23:1de40efd1c4b&lt;br /&gt;
 | |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 | |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 | |  summary:     A test message&lt;br /&gt;
 | |&lt;br /&gt;
 o |  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another example of merging here?  Perhaps Lee&#039;s code merging in changes on official version.&lt;br /&gt;
&lt;br /&gt;
== Tags and named branches (hg tag, hg tags, hg branch, hg branches) ==&lt;br /&gt;
&lt;br /&gt;
It is often useful to give a name to a particular revision.  This might be a changeset that corresponds to a given version of the code, or it might simply be a revision that marks a particular milestone.  In the &amp;lt;code&amp;gt;example-gaussian-repo&amp;lt;/code&amp;gt; you have probably noticed there are revisions in the history with descriptions like &amp;quot;Added tag h13 for changeset 6c81eb8dcbab&amp;quot;.  These are revisions corresponding to particular versions of the Gaussian development version, such as H01, H10, H13, etc.  You can see a list of the tags in a repository by doing:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg tags&lt;br /&gt;
 tip                               26:857f81e59d66&lt;br /&gt;
 h13                               22:6c81eb8dcbab&lt;br /&gt;
 h12p                              20:0ef14d7dff56&lt;br /&gt;
 h11                               18:7daba638a830&lt;br /&gt;
 h10                               16:e1d0af4e84d9&lt;br /&gt;
 h08                               14:656073c38db9&lt;br /&gt;
 h01                               12:737d1720e79a&lt;br /&gt;
 h13-raw                           10:b039f5c274e2&lt;br /&gt;
 h12p-raw                           8:522a8fe79d22&lt;br /&gt;
 h11-raw                            6:a28b789a9555&lt;br /&gt;
 h10-raw                            4:356081dab79d&lt;br /&gt;
 h08-raw                            2:9f69ed4616ad&lt;br /&gt;
 h01-raw                            0:073d6aa63ea7&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(the &amp;lt;code&amp;gt;tip&amp;lt;/code&amp;gt; tag is automatically assigned to the most recently checked in revision).  You may use a tag name anywhere where you might use a revision number, so for example, to check out the changeset corresponding to the official Gaussian development release H10, you would type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg up h10&lt;br /&gt;
 13887 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(this will look different if you have unchecked-in modifications in your working directory).  You could also pass h10 to the &amp;lt;code&amp;gt;hg clone -u&amp;lt;/code&amp;gt; flag, and so on.&lt;br /&gt;
You tag a revision with the &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt; command.  Issue it in a working directory and it will tag the revision that is the parent of the working directory.  Tags become part of the repository, that is they are shared during &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt;, so choose wisely.  If you&#039;d like to have tags that are only part of the local repository, use the &amp;lt;code&amp;gt;-l&amp;lt;/code&amp;gt; flag to &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Tags are stored in an &amp;lt;code&amp;gt;.hgtags&amp;lt;/code&amp;gt; file in the root directory of the repository.  Running &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt; alters this file and then commits the change to the repository.  Sometimes you can see conflicts in this file during merges.  I normally just resolve them by keeping as much information in the merged file as possible.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg branches&amp;lt;/code&amp;gt; command can be used to show the named branches in the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg branches&lt;br /&gt;
 default                       24:13ecff0136c2&lt;br /&gt;
 raw                           11:a0c273aeeb2b (inactive)&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I have two named branches, raw and default (the default branch is, er, the default).  If you examine the full output of &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt;, which is quite long and I won&#039;t reproduce it here, you&#039;ll see, starting at the bottom, revisions 0 to 11 are all in the raw branch.  I have created and named this branch to contain the official Gaussian development code as processed by the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, without any of our makefiles or other alterations.  The default branch branches off from revision 1 and starts at revision 12.  Its descendants, revisions 12 to 23, are also in the default branch.  These were created by starting at revision 1, adding our makefiles and modifications to the build system, renaming this branch to the default branch, and then committing revision 12.  I tagged revision 12 as &amp;quot;H01&amp;quot;, which created revision 13.  I then merged revision 3, fixed the conflicts, and committed revision 14, and so on.  A more detailed guide on how to import a new official version of gdv exists in LINKY.&lt;br /&gt;
&lt;br /&gt;
You can use branch names just like tags wherever mercurial expects a revision identifier.  If you use a branch name mercurial will attempt to give you the revision that is most appropriate, this will usually be the newest head on that branch.&lt;br /&gt;
&lt;br /&gt;
To create a new branch you type &amp;lt;code&amp;gt;hg branch &amp;lt;branchname&amp;gt;&amp;lt;/code&amp;gt;.  This will take effect when you commit the working directory.  As I&#039;ve previously mentioned a simpler alternative to having branches, named or otherwise, in your repository is to have multiple repositories.&lt;br /&gt;
&lt;br /&gt;
== Ignoring files ==&lt;br /&gt;
&lt;br /&gt;
You may be wondering how the system will work when you start compiling files.  Won&#039;t all the &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.exe&amp;lt;/code&amp;gt; files start showing up in the output to &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;?  The answer is that they will not, because I&#039;ve told mercurial to ignore such files.  This information is stored in the &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file in the root of the repository.  It&#039;s quite long but it starts like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 syntax: glob&lt;br /&gt;
 gdv.make&lt;br /&gt;
 *.o&lt;br /&gt;
 *.lo&lt;br /&gt;
 *.a&lt;br /&gt;
 *.exe&lt;br /&gt;
 *.exel&lt;br /&gt;
 .*.swp&lt;br /&gt;
 *~&lt;br /&gt;
 *.log&lt;br /&gt;
 *.log.gz&lt;br /&gt;
 *.chk&lt;br /&gt;
 gdv/arc&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Any file that matches either the shell patterns or the file names in &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; is ignored by mercurial.  This means it does not show up to &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt;, and so on will ignore it unless it is explicitly mentioned on the command line.  So &amp;lt;code&amp;gt;hg add gdv&amp;lt;/code&amp;gt; will add all non-ignored files in the gdv directory, while &amp;lt;code&amp;gt;hg add gdv/*&amp;lt;/code&amp;gt; will add all the files in the gdv directory.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file is tracked, so please only commit changes to it if you think they will be useful to everyone.&lt;br /&gt;
== Other commands ==&lt;br /&gt;
&lt;br /&gt;
There are quite a few other commands available to mercurial, I will cover just a few here, if you&#039;re interested in becoming a power user refer to the documentation I have mentioned.&lt;br /&gt;
&lt;br /&gt;
=== hg addremove ===&lt;br /&gt;
You can use this command when you have large numbers of files to add and remove.  It also includes the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; flag to attempt to detect when files have been moved or copied.  Using this flag does require some subtlety, as it&#039;s not helpful to mark files as moved or copied unless they have been.  Also note that it is possible to inadvertently include ignored files in a mass &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg addremove&amp;lt;/code&amp;gt;; check what&#039;s being added before you commit.&lt;br /&gt;
&lt;br /&gt;
=== hg grep and hg locate ===&lt;br /&gt;
Similar to the standard UNIX grep and locate commands, but cognisant of the mercurial repository.&lt;br /&gt;
&lt;br /&gt;
=== hg init ===&lt;br /&gt;
Creates a new mercurial repository in the current directory&lt;br /&gt;
&lt;br /&gt;
=== hg serve ===&lt;br /&gt;
This starts a mini web server serving information about the repository.  I would strongly recommend you do not use this while working on the Gaussian development version as it would be all too easy to allow any user on the system to view all of the files in your repository.  I only mention it here because some of the other documentation may refer to it.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_short&amp;diff=256814</id>
		<title>Resgrp:comp-photo-version control short</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_short&amp;diff=256814"/>
		<updated>2012-10-08T13:23:48Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: Short summary version.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is a short summary of [[Resgrp:comp-photo-version control|this]] page.&lt;br /&gt;
&lt;br /&gt;
== Checking out a repository (hg clone)==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg clone existing-repo new-repo&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Makes a copy (clone) of the existing-repo and names it new-repo.  If new-repo is omitted hg will put the clone in the current directory&lt;br /&gt;
and name it ./existing-repo.  Repository specifications can be in the ssh:// or http:// formats.  Useful flags: &amp;lt;code&amp;gt;-u rev&amp;lt;/code&amp;gt; to update the&lt;br /&gt;
working directory to rev rather than the default.&lt;br /&gt;
&amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; to not update the working directory at all.&lt;br /&gt;
&lt;br /&gt;
==Seeing the state of the repository and working directory (hg status, hg log, hg summary)==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg log&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Shows all commits to the repository.  Useful flags: &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; shows full log message and list of changed files for each entry.&lt;br /&gt;
&amp;lt;code&amp;gt;-r rev&amp;lt;/code&amp;gt; shows log for rev (which can be a range).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg stat&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Shows altered / added / deleted files compared to working directory&#039;s parent; i.e. shows status of working directory.&lt;br /&gt;
Useful flags: various to limit output to only added / altered / deleted / etc files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg sum&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Shows summary of working directory.&lt;br /&gt;
&lt;br /&gt;
== Showing the differences (hg diff) ==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg diff&lt;br /&gt;
$ hg diff filename&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Shows difference between parent commit and working directory in &#039;diff&#039; format.  With no argument shows&lt;br /&gt;
diffs for all altered files.&lt;br /&gt;
&lt;br /&gt;
==Adding, copying, renaming, and deleting files (hg add, hg forget, hg mv, hg rm, hg cp) ==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg add filename&lt;br /&gt;
$ hg forget filename&lt;br /&gt;
$ hg rm filename&lt;br /&gt;
$ hg mv old-filename new-filename&lt;br /&gt;
$ hg cp old-filename new-filename&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add places a newly created file under version control (otherwise it will be listed as &#039;?&#039; unknown in hg stat and will not be committed).&lt;br /&gt;
Forget reverses an add before it&#039;s been committed.&lt;br /&gt;
Rm removes a file from the working directory and marks it as deleted to version control for the next commit.  &amp;lt;code&amp;gt;rm -A&amp;lt;/code&amp;gt; to mark a file&lt;br /&gt;
as deleted after you&#039;ve already deleted it.&lt;br /&gt;
Move and copy are similar to add and forget, but allow mercurial to track changes to renamed or copied files.&lt;br /&gt;
&lt;br /&gt;
==Committing the changes (hg commit)==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg ci&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check in the working directory as a new changeset.  User will be presented with a file to edit where they can write a useful and informative message.&lt;br /&gt;
Use &amp;lt;code&amp;gt;-m&amp;lt;/code&amp;gt; to pass message on command line.&lt;br /&gt;
&lt;br /&gt;
==Fixing mistakes (hg revert, hg rollback, hg update)==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg revert filename&lt;br /&gt;
$ hg revert -a&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use this command to &#039;&#039;throw away&#039;&#039; changes you have made to files.  The &amp;lt;code&amp;gt;-a&amp;lt;/code&amp;gt; flag reverts &amp;quot;all&amp;quot; files in the working directory.&lt;br /&gt;
The file(s) are reverted to how they are in the parent changeset.  A copy is made of each reverted file into a new file with a .orig suffix.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg rollback&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Undoes the last commit.  This only works once: that is, you can&#039;t do an hg rollback directly after an hg rollback.  There has to be an hg commit between rollbacks.&lt;br /&gt;
If you have pushed or pulled this commit to another repository then rolling it back locally is probably pointless.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg update --clean rev&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Similar to hg revert, this returns the working directory to a previous changeset rev.  Note that &lt;br /&gt;
using hg update &amp;quot;without&amp;quot; the&lt;br /&gt;
&amp;lt;code&amp;gt;--clean&amp;lt;/code&amp;gt; flag will do something different.&lt;br /&gt;
&lt;br /&gt;
==Collaboration (hg incoming, hg pull, hg outgoing, hg push, hg update)==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg incoming repository-location&lt;br /&gt;
$ hg outgoing repository-location&lt;br /&gt;
$ hg push repository-location&lt;br /&gt;
$ hg pull repository-location&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These commands interact with other repositories.  Incoming (and outgoing) shows which changesets the local (remote) repository has&lt;br /&gt;
that the other doesn&#039;t have.  Pull (and push) actually copies the changesets into the local (remote) repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg update rev&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Update attempts to change the parent changeset of the working directory.  If there are no changes&lt;br /&gt;
in the working directory it will be brought up to date with &amp;lt;code&amp;gt;rev&amp;lt;/code&amp;gt; (the tip of the current&lt;br /&gt;
branch is used if rev is omitted).  If there are changes then &amp;lt;code&amp;gt;hg update&amp;lt;/code&amp;gt; will either&lt;br /&gt;
abort (if the &amp;lt;code&amp;gt;--check&amp;lt;/code&amp;gt; option is used), discard the changes (if &amp;lt;code&amp;gt;--clean&amp;lt;/code&amp;gt;&lt;br /&gt;
is used, or attempt a merge (if &amp;lt;code&amp;gt;rev&amp;lt;/code&amp;gt; is an ancestor or descendant of the working&lt;br /&gt;
directory parent).&lt;br /&gt;
&lt;br /&gt;
==Merging two sets of changes (hg merge, hg resolve)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg merge rev&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Merge attempts to update the working directory with all changes between the requested revision&lt;br /&gt;
and the last common ancestor.  Conflicts may arise in files that have changed on both sides of the merge; &amp;lt;code&amp;gt;hg merge&amp;lt;/code&amp;gt; may start programs to try to resolve conflicts.  Unresolved conflicts are marked in &amp;lt;code&amp;gt;hg merge&amp;lt;/code&amp;gt;&#039;s output.  A working directory cannot be checked in until&lt;br /&gt;
all conflicts are resolved.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg resolve filename&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Resolve may start a tool to try to resolve conflicting files.  It can also be used to &lt;br /&gt;
mark files as resolved (&amp;lt;code&amp;gt;-m&amp;lt;/code&amp;gt; flag) or unresolved (&amp;lt;code&amp;gt;-u&amp;lt;/code&amp;gt; flag).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Tags (hg tag, hg tags==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg tag tagname&lt;br /&gt;
$ hg tag -r rev tagname&lt;br /&gt;
$ hg tags&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Associate &amp;lt;code&amp;gt;tagname&amp;lt;/code&amp;gt; with the parent or given revision.  This name can be used wherever mercurial expects a revision identifier.  Tags are not local unless marked as such and will&lt;br /&gt;
be exported to remote repositories on push or pull.  &amp;lt;code&amp;gt;hg tags&amp;lt;/code&amp;gt; shows all&lt;br /&gt;
tags known in this repository.&lt;br /&gt;
&lt;br /&gt;
=Getting help (hg help)==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;hg help&amp;lt;/code&amp;gt; shows a list of commands, &amp;lt;code&amp;gt;hg help command&amp;lt;/code&amp;gt; shows help for a&lt;br /&gt;
specific command or concept.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_short&amp;diff=256780</id>
		<title>Resgrp:comp-photo-version control short</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control_short&amp;diff=256780"/>
		<updated>2012-10-08T13:02:53Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: Created page with &amp;quot;== Checking out a repository (hg clone)== &amp;lt;code&amp;gt; $ hg clone existing-repo new-repo &amp;lt;/code&amp;gt; Makes a copy (clone) of the existing-repo and names it new-repo.  If new-repo is omitte...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Checking out a repository (hg clone)==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg clone existing-repo new-repo&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Makes a copy (clone) of the existing-repo and names it new-repo.  If new-repo is omitted hg will put the clone in the current directory&lt;br /&gt;
and name it ./existing-repo.  Repository specifications can be in the ssh:// or http:// formats.  Useful flags: &amp;lt;code&amp;gt;-u rev&amp;lt;/code&amp;gt; to update the&lt;br /&gt;
working directory to rev rather than the default.&lt;br /&gt;
&amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; to not update the working directory at all.&lt;br /&gt;
&lt;br /&gt;
==Seeing the state of the repository and working directory (hg status, hg log, hg summary)==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg log&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Shows all commits to the repository.  Useful flags: &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; shows full log message and list of changed files for each entry.&lt;br /&gt;
&amp;lt;code&amp;gt;-r rev&amp;lt;/code&amp;gt; shows log for rev (which can be a range).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg stat&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Shows altered / added / deleted files compared to working directory&#039;s parent; i.e. shows status of working directory.&lt;br /&gt;
Useful flags: various to limit output to only added / altered / deleted / etc files.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg sum&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Shows summary of working directory.&lt;br /&gt;
&lt;br /&gt;
== Showing the differences (hg diff) ==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg diff&lt;br /&gt;
$ hg diff filename&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Shows difference between parent commit and working directory in &#039;diff&#039; format.  With no argument shows&lt;br /&gt;
diffs for all altered files.&lt;br /&gt;
&lt;br /&gt;
==Adding, copying, renaming, and deleting files (hg add, hg forget, hg mv, hg rm, hg cp) ==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg add filename&lt;br /&gt;
$ hg forget filename&lt;br /&gt;
$ hg rm filename&lt;br /&gt;
$ hg mv old-filename new-filename&lt;br /&gt;
$ hg cp old-filename new-filename&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Add places a newly created file under version control (otherwise it will be listed as &#039;?&#039; unknown in hg stat and will not be committed).&lt;br /&gt;
Forget reverses an add before it&#039;s been committed.&lt;br /&gt;
Rm removes a file from the working directory and marks it as deleted to version control for the next commit.  &amp;lt;code&amp;gt;rm -A&amp;lt;/code&amp;gt; to mark a file&lt;br /&gt;
as deleted after you&#039;ve already deleted it.&lt;br /&gt;
Move and copy are similar to add and forget, but allow mercurial to track changes to renamed or copied files.&lt;br /&gt;
&lt;br /&gt;
==Committing the changes (hg commit)==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg ci&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Check in the working directory as a new changeset.  User will be presented with a file to edit where they can write a useful and informative message.&lt;br /&gt;
Use &amp;lt;code&amp;gt;-m&amp;lt;/code&amp;gt; to pass message on command line.&lt;br /&gt;
&lt;br /&gt;
==Fixing mistakes (hg revert, hg rollback, hg update)==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg revert filename&lt;br /&gt;
$ hg revert -a&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Use this command to &#039;&#039;throw away&#039;&#039; changes you have made to files.  The &amp;lt;code&amp;gt;-a&amp;lt;/code&amp;gt; flag reverts &amp;quot;all&amp;quot; files in the working directory.&lt;br /&gt;
The file(s) are reverted to how they are in the parent changeset.  A copy is made of each reverted file into a new file with a .orig suffix.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg rollback&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Undoes the last commit.  This only works once: that is, you can&#039;t do an hg rollback directly after an hg rollback.  There has to be an hg commit between rollbacks.&lt;br /&gt;
If you have pushed or pulled this commit to another repository then rolling it back locally is probably pointless.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg update --clean rev&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Similar to hg revert, this returns the working directory to a previous changeset rev.  Note that using hg update &amp;quot;without&amp;quot; the&lt;br /&gt;
&amp;lt;code&amp;gt;--clean&amp;lt;/code&amp;gt; flag will do something different.&lt;br /&gt;
&lt;br /&gt;
==Collaboration (hg incoming, hg pull, hg outgoing, hg push, hg update, hg parent)==&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg incoming repository-location&lt;br /&gt;
$ hg outgoing repository-location&lt;br /&gt;
$ hg push repository-location&lt;br /&gt;
$ hg pull repository-location&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
These commands interact with other repositories.  Incoming (and outgoing) shows which changesets the local (remote) repository has&lt;br /&gt;
that the other doesn&#039;t have.  Pull (and push) actually copies the changesets into the local (remote) repository.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
$ hg update&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
10 Merging two sets of changes (hg merge, hg resolve)&lt;br /&gt;
11 Tags and named branches (hg tag, hg tags, hg branch, hg branches)&lt;br /&gt;
12 Ignoring files&lt;br /&gt;
13 Other commands&lt;br /&gt;
13.1 hg addremove&lt;br /&gt;
13.2 hg grep and hg locate&lt;br /&gt;
13.3 hg init&lt;br /&gt;
13.4 hg serve&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=256693</id>
		<title>Resgrp:comp-photo-version control</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=256693"/>
		<updated>2012-10-07T15:12:42Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: Added link to short summary version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This document will teach you the basics of using mercurial, a distributed version control system (DVCS).  It is particularly directed towards using mercurial with the development version of Gaussian, so the examples will use Gaussian.  For more information on mercurial you can use the built-in help system &amp;lt;code&amp;gt;hg help&amp;lt;/code&amp;gt;, look at the official website: http://mercurial.selenic.com/wiki/Mercurial, or check out the official O&#039;Reilly book, the text of which is freely available at: http://hgbook.red-bean.com/.&lt;br /&gt;
&lt;br /&gt;
A version control system can sometimes seem an onerous imposition unless the user understands how it is going to help them in their work, so I&#039;ll try to briefly explain.  Version control is about tracking changes to data.  If one has a collection of files, say a distribution of Gaussian, then one is interested in changes that have been made to those files, whether from a new distribution from Gaussian or our own modifications.  We are particularly interested in cases where overlapping changes have been made.  These might be updates and bug fixes from Gaussian conflicting with our own modifications to a particular link, or it might be different researchers in a group working on the same piece of code independently.  A version control system will not only detect such cases but provide automated and safe methods for merging conflicting changes.&lt;br /&gt;
&lt;br /&gt;
Central to the idea of a VCS is the concept of a revision or changeset.  This is like a snapshot of some set of files and directories at some particular instant in their history.  A repository is where a VCS stores revisions.  So, using Gaussian as an example, some revisions in a particular repository might be the Gaussian source tree corresponding to Gaussian development versions H01, H08, H10, H11, etc.  The data that are actually kept inside the repository are the differences, or deltas, between the revisions.  This saves space compared to storing all the revisions.&lt;br /&gt;
&lt;br /&gt;
== Short version ==&lt;br /&gt;
&lt;br /&gt;
I&#039;ve made a summary version of this document [[Resgrp:comp-photo-version control short|here]].&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment (.hgrc)==&lt;br /&gt;
There are some one-off things you must do.  Firstly, edit your login scripts (&amp;lt;code&amp;gt;.bash_profile&amp;lt;/code&amp;gt; or similar) to include the command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 module load mercurial&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(If you&#039;re not on an IC HPC machine mercurial is available anywhere that runs Python.  It is generally available in distribution package systems, if not you can get it from http://mercurial.selenic.com/wiki/Mercurial).  Note that the Redhat provided mercurial on RHEL 5 and 6 is quite old and does not, at time of writing, support the repositories I have created.&lt;br /&gt;
&lt;br /&gt;
Next, create a file called &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; in your home directory and insert the following lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 username = Your Name &amp;lt;your@email.address&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(so for example, my &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; contains this line: &amp;lt;code&amp;gt;username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
Mercurial uses this username field to record who has changed what.  (If you&#039;re not on an IC HPC machine your version of mercurial may not&lt;br /&gt;
have the graphlog extension.  If it doesn&#039;t, don&#039;t worry, it&#039;s merely a tool for visualising changesets).&lt;br /&gt;
&lt;br /&gt;
== Checking out a repository (hg clone, hg log) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s get started and check out a repository.  Once you have loaded the mercurial module you will be able to type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussian-devel/example-gaussian-repo testrepo&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a copy of the repository at &amp;lt;code&amp;gt;/home/gaussian-devel/example-gaussian-repo&amp;lt;/code&amp;gt; and place it in a directory inside the current directory called &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt;.  You can give a full path as the second argument, or, you can leave it off altogether in which case mercurial will clone the repository into a directory named &amp;lt;code&amp;gt;example-gaussian-repo&amp;lt;/code&amp;gt;.  A note here for Imperial HPC users.  Copying a repository involves quite a bit of filesystem activity.  I have found that on cx1 this can be quite slow on the &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; filesystems.  You may wish to try these examples in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; filesystem which is a lot faster.  Be aware, however, that this raises two potentially serious problems.  The first is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is globally readable so before you clone you must make sure that your umask is set to &amp;lt;code&amp;gt;0077&amp;lt;/code&amp;gt;.  The second, of course, is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is periodically wiped.  If you plan on working in &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; there are simple ways of transferring information between repositories (&amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt;) that I will cover later.&lt;br /&gt;
&lt;br /&gt;
Now change into the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory.  Inside you will see three scripts and a &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory; also some hidden files and a hidden directory.  Inside the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory you will see the Gaussian source in the [[Resgrp:comp-photo-new gdv layout|new layout]].  The hidden &amp;lt;code&amp;gt;.hg&amp;lt;/code&amp;gt; directory inside the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory is the repository proper; you will almost never need to do anything in here.  The rest of the files and directories are called the working directory; this is where you will do your work.&lt;br /&gt;
&lt;br /&gt;
The first thing you might want to do is check the history of this repository to see past revisions that have been checked into it.  You do this with the &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log | head -20&lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 &lt;br /&gt;
 changeset:   22:6c81eb8dcbab&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      21:5b6ac3665a29&lt;br /&gt;
 parent:      11:a0c273aeeb2b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:08 2012 +0000&lt;br /&gt;
 summary:     Gaussian devel version H13 with our makefiles&lt;br /&gt;
 &lt;br /&gt;
 changeset:   21:5b6ac3665a29&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:41:40 2012 +0000&lt;br /&gt;
 summary:     Added tag h12p for changeset 0ef14d7dff56&lt;br /&gt;
 ...&lt;br /&gt;
 changeset:   1:515a93bfc3b5&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:10 2012 +0000&lt;br /&gt;
 summary:     Added tag h01-raw for changeset 073d6aa63ea7&lt;br /&gt;
 &lt;br /&gt;
 changeset:   0:073d6aa63ea7&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h01-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:09 2012 +0000&lt;br /&gt;
 summary:     Output from old-to-new.sh on version H01&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
You will see that there are various fields that may appear for each changeset.  The changeset field shows two numbers separated by a colon.  The second, longer, hexadecimal number is the unique identifier.  A particular hex identifier will always refer to the same changeset, even in different copies of the repository.  The first number is a local identifier.  These local IDs refer to particular changesets in one copy of the repository; if these changesets are present in another repository they may have a different local identifier.    You can use either identifier as an argument to &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands.  The user and date fields show who committed the change and when.  The summary field shows the first line of the log entry for that revision.  This means it is important to try to make the first line of your log entries a useful summary of what you have done!&lt;br /&gt;
&lt;br /&gt;
To see the entry for a particular revision use the &amp;lt;code&amp;gt;-r&amp;lt;/code&amp;gt; flag with a revision number, either short or long.  To see more information, including the full log entry and a complete list of all files involved in the change, use the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag, e.g.:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -r 2 -v | less&lt;br /&gt;
 changeset:   2:9f69ed4616ad&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h08-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:54:50 2012 +0000&lt;br /&gt;
 files:       gdv/archlib/arcvib.F gdv/archlib/brcpyw.F gdv/archlib/letset.F gdv/arctmp.F gdv/bsd/GauDiff_Compare.pm gdv/bsd/G&lt;br /&gt;
 ....&lt;br /&gt;
 at.F gdv/utilnz/xpndnb.F gdv/utilnz/zerock.F gdv/utilnz/zerod.F gdv/wrappers/ggeev.F gdv/wrappers/lappar.F gdv/wrappers/xgetrf.F  gdv/wrappers/xgetrs.F gdv/wrappers/ygeru.F gdv/wrappers/ytrsv.F&lt;br /&gt;
 description:&lt;br /&gt;
 Import of gdv H08.  See below for details.&lt;br /&gt;
 &lt;br /&gt;
 Result of these commands on the H01 raw rev:&lt;br /&gt;
 rm -fr gdv&lt;br /&gt;
 cp -pr h08/new-style-gdv .&lt;br /&gt;
 hg add gdv/bsd/*.a&lt;br /&gt;
 hg addremove -s 50&lt;br /&gt;
 &lt;br /&gt;
 h08/new-style is from old-to-new.sh on freshly untarred h08.tgz&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
As the log entry explains, this particular revision is the change from the H01 version of Gaussian to the H08 version, so there are a lot of changed files.  The description entry is intended to provide some human readable explanation of the changes.  When you start committing data to the repository you should aim to at least make your log entries understandable.&lt;br /&gt;
&lt;br /&gt;
As with all the commands that I will mention you can get more information by typing &amp;lt;code&amp;gt;hg help &amp;lt;command&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Committing changes (hg summary, hg status, hg diff) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make some alterations to this repository.  This is quite safe; we can&#039;t break the original repository because our copy is an entirely separate clone.  In fact, this is a very common working practice with mercurial.  As long as the filesystem isn&#039;t slow cloning a repository can be quite quick.  Indeed, cloning a repository into a destination on the same filesystem as the source makes use of hard linking which is very fast and saves space.  Therefore, it is very common to clone a repository, make some alterations to it, and then decide whether to push them back to the original repository or just delete the new clone.&lt;br /&gt;
&lt;br /&gt;
First, we want to know where it is we are starting from.  To get a quick summary you use the &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; command.  This should show something like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg summary&lt;br /&gt;
 parent: 23:1de40efd1c4b tip&lt;br /&gt;
 Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 branch: default&lt;br /&gt;
 commit: (clean)&lt;br /&gt;
 update: (current)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows, on the parent line, the revision that has been checked out into the working directory.  Below that is the summary line from the log entry for that revision.  The commit line shows if any files have been modified since the check out.  The update line shows if there are any applicable newer revisions in the repository.  In this example the output shows us that we checked out the revision with the local identifier 23, and unique identifier of 1de40efd1c4b, that we have modified nothing and that there are no appropriate newer revisions.  This checkout occurred automatically as a part of the &amp;lt;code&amp;gt;hg clone&amp;lt;/code&amp;gt; command.  You can clone without checking anything out into the working directory (say to make a backup copy of the repository) by passing the &amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; flag, or you can check out a particular revision with the &amp;lt;code&amp;gt;-u REV&amp;lt;/code&amp;gt; flag.  See &amp;lt;code&amp;gt;hg help clone&amp;lt;/code&amp;gt; for how mercurial chooses what to check out by default.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say we&#039;re adding a feature to link 510.  If you have something in mind go ahead and do it. For this example I have just added a few lines to the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, and will assume that your current working directory is &amp;lt;code&amp;gt;gdv/l510&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As you work you may be curious to know what it is you have changed.  The command to show this is &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The output shows a list of files that have been altered in some way.  Here the capital M shows that the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified.  By default &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; does not report on unchanged files.  If we wish to see how &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified we can use the &amp;lt;code&amp;gt;hg diff&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 11:07:55 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Add super new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows the output in a unified different format, refer to the man page for diff for more information.&lt;br /&gt;
&lt;br /&gt;
== Adding, copying, renaming, and deleting file (hg add, hg forget, hg mv, hg rm, hg cp) ==&lt;br /&gt;
&lt;br /&gt;
If you have created a new file then you must let mercurial know about its existence with the &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ echo &amp;quot;a new subroutine&amp;quot; &amp;gt; foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 ? gdv/l510/foo.F&lt;br /&gt;
 testrepo$ hg add foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here, I create a new file called &amp;lt;code&amp;gt;foo.F&amp;lt;/code&amp;gt;.  &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with a ?,  to indicate that it is unknown to the repository.  I then run &amp;lt;code&amp;gt;hg add foo.F&amp;lt;/code&amp;gt;, after which &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with an A.  This indicates that the file is scheduled to be added at the next commit.  If you change your mind about the file before the next commit you can use &amp;lt;code&amp;gt;hg forget&amp;lt;/code&amp;gt; to undo the add.&lt;br /&gt;
&lt;br /&gt;
If you are renaming a file, including the situation where you move the file from one directory to another (e.g. from l510 to utilam) then you may use the &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; command.  This will actually perform the move just like the normal &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; command.  If you&#039;ve already moved the file you can give &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; the &amp;lt;code&amp;gt;-A&amp;lt;/code&amp;gt; flag to record the rename after the fact.  Similarly, the &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt; command removes files from the working directory and records this fact in the repository, and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; copies a file.&lt;br /&gt;
&lt;br /&gt;
It is important to realise that these commands act on the working directory immediately but only affect the repository when they are committed.  Also, they do not affect the repository&#039;s previous history, so removing a file and then committing that change does not affect that file&#039;s existence in previous revisions in the repository.  However, &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; create a relationship between the source and destination files.  This becomes useful when merging in changes from somewhere else.  So for example, above I have made changes to &amp;lt;code&amp;gt;l510/a1tdep.F&amp;lt;/code&amp;gt;.  Let&#039;s say that someone else has decided to make this into a utility routine and has done the command &amp;lt;code&amp;gt;hg mv l510/a1tdep.F utilam/a1tdep.F&amp;lt;/code&amp;gt;.  If I choose to merge my changes with this other person&#039;s, mercurial will correctly apply the changes &#039;&#039;&#039;and&#039;&#039;&#039; move the file.  If instead of &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; they had used &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; then my changes would be applied to both files.  This means that you should only use &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; when it is appropriate that changes that are recorded before the copy are applied to both files.  Note that this does not mean that changes to the source file are forever applied to the destination file; this will only occur when merging a revision that does not contain a copy with a revision that does.  In general, you can expect mercurial to do the right thing.&lt;br /&gt;
&lt;br /&gt;
== Committing the changes (hg commit, hg tip) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt; (like many &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands, &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commit has an alias, in this case &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;.  I tend to use &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;) command creates a new revision and records the differences between the entire working directory and the parent revision (as shown on the parent line of &amp;lt;code&amp;gt;hg summary).  This will be the same as the output from &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;.  When you run the command mercurial will open a text editor.  If you wish to specify which editor is used add an &amp;lt;code&amp;gt;editor=vim&amp;lt;/code&amp;gt; (for example) line to the &amp;lt;code&amp;gt;[ui]&amp;lt;/code&amp;gt; part of your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file.  The editor will start with a couple of empty lines and then some lines beginning with &amp;quot;&amp;lt;code&amp;gt;HG:&amp;lt;/code&amp;gt;&amp;quot;.  These are there to give you helpful reminders of what you&#039;ve changed while you write your log message and will be ignored by mercurial when you commit.  If you close the editor without writing anything, or of the editor quits with an error, mercurial will abort the commit.  So for our current example:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci&lt;br /&gt;
 ... [opens vim]&lt;br /&gt;
 HG: Enter commit message.  Lines beginning with &#039;HG:&#039; are removed.&lt;br /&gt;
 HG: Leave message empty to abort commit.&lt;br /&gt;
 HG: --&lt;br /&gt;
 HG: user: Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 HG: branch &#039;default&#039;&lt;br /&gt;
 HG: added gdv/l510/foo.F&lt;br /&gt;
 HG: changed gdv/l510/a1tdep.F&lt;br /&gt;
 ~&lt;br /&gt;
 ~&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For short messages you can skip the editor step by passing the &amp;lt;code&amp;gt;-m &amp;quot;Log message here&amp;quot;&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
Understanding what you are doing here is essential to knowing what to write in the log and, importantly, when to commit.  There are two schools of thought.  When you commit you are creating a new revision in your local repository.  Since it is your repository, and as I have previously mentioned, it is very simple to create new repositories, you should commit whenever you feel like it and feel free to write cryptic log messages that only you will understand.  On the other hand, you are engaged in a collaborative exercise with other people: creating what will be a single version of Gaussian that contains yours and others&#039; modifications and Gaussian&#039;s updates.  Therefore, you should only commit when your code satisfies pre-agreed group requirements, and your log message should be detailed and comprehensible to anybody who reads it, even 50 years in the future.  The correct approach, of course, is to do both.&lt;br /&gt;
&lt;br /&gt;
Mercurial is a distributed version control system which means that each repository is the responsibility of its owner who can feel free to commit as frequently (or infrequently) as needed.  Sometimes adding a feature or removing a bug might take weeks, and you might feel that there is no point taking snapshots of the code until it works.  Other modifications might proceed incrementally with naturally defined stopping points between the start and the end.  Committing at these points makes perfect sense: not only does it leave a history of the modification, it provides checkpoints, versions of the code that you can retreat to without having to start again.  The log messages may tersely explain what has happened since the last revision (and note there is no point listing modified, added, etc, files as this information is stored in the commit anyway) or they may contain detailed essays on how a bug arose and the steps you have taken to fix it.  Information in the logs is searchable and should be thought of as both an aide memoir for yourself and a journal entry for others.&lt;br /&gt;
&lt;br /&gt;
When the time comes to merge your changes into other people&#039;s repositories, you might start thinking about the quality of your commit.  Does the code compile?  Does it run the test suite?  Can it run any test?  Have you committed a test that checks the code you have added or altered?  The group may decide that revisions that are being shared must answer yes to some or all of these questions.  You may decide that some or all of your revisions must pass these quality checks.  Or, you may be satisfied with noting in the log entry what this particular revision can or can&#039;t do (such as compile or run).&lt;br /&gt;
&lt;br /&gt;
It should be said though, that if you ever think &amp;quot;perhaps I should check in at this point&amp;quot;, then go for it.  Revisions live in the history of your repository forever (although see &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;), but when you transfer them to other people&#039;s repositories multiple revisions can be collapsed into one, or fixed in other ways.&lt;br /&gt;
&lt;br /&gt;
Returning to our example I enter a simple message.  Since &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; only shows the first line of any log entry by default it is a good idea to make this line a summary of the rest of the message.  I close the editor and the commit is done.&lt;br /&gt;
&lt;br /&gt;
We can see the results in the repository with an &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command (the &amp;lt;code&amp;gt;-l 2&amp;lt;/code&amp;gt; flag shows the last two revisions):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -l 2&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 summary:     A test message.&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Alternatively we can use the &amp;lt;code&amp;gt;hg tip&amp;lt;/code&amp;gt; command to show the most recently added repository, whether by ourselves, or by pulling from another repository (see later).&lt;br /&gt;
&lt;br /&gt;
== Fixing mistakes (hg revert, hg rollback) ==&lt;br /&gt;
&lt;br /&gt;
You can return one or more files, or the entire repository, to the state they were in when you last checked them out with in the &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; command.  Let&#039;s make an ill-advised alteration to our now committed change to &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ sed -i &#039;s/super/super duper/&#039; a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 13ecff0136c2 gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 17:23:42 2012 +0000&lt;br /&gt;
 @@ -27,7 +27,7 @@&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
  c&lt;br /&gt;
 -c     Add super new feature&lt;br /&gt;
 +c     Add super duper new feature&lt;br /&gt;
  c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ? gdv/l510/a1tdep.F.orig&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 testrepo$ rm a1tdep.*&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ! gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I use revert to undo the modifications to a file.  Notice that &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; leaves a copy of the modified file in &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt;.  This shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as an unknown file (&amp;quot;?&amp;quot;).  Also notice that while trying to delete the .orig file I have accidentally deleted &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, which now shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as a missing file (&amp;quot;!&amp;quot;).  I can revert this mistake too:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 testrepo$ ls a1tdep.F&lt;br /&gt;
 a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; can also be used to cancel scheduled adds, removes, copies, and renames.&lt;br /&gt;
&lt;br /&gt;
If you have just committed a revision and then change your mind you may be able to undo the effect with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;.  Doing this for our example gives us:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg rollback&lt;br /&gt;
 repository tip rolled back to revision 23 (undo commit)&lt;br /&gt;
 working directory now based on revision 23&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This removes the revision we just checked in from the repository but does not alter the current working directory.  If we choose, we could now use &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; to restore these to their revision 23 state.  There are two important caveats with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;: it can only remove the last checked in revision, and that it is usually pointless to rollback a revision that has already been pushed or pulled (see later) into somebody else&#039;s repository, as we can only affect our repository.  For the purposes of this example, I will once more check in the changes I have made:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci -m &#039;A test message&#039;&lt;br /&gt;
 testrepo$ hg tip&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:38:52 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Collaboration (hg incoming, hg pull, hg outgoing, hg push, hg update, hg parent) ==&lt;br /&gt;
&lt;br /&gt;
The tools described are already quite useful, and form the basis of the very earliest revision control systems.  The benefits of being able to detect what you&#039;ve changed, and how you&#039;ve changed it, being able to undo the changes selectively, and being able to take a snapshot of your work at any point of your choosing should be apparent.  The true power, however, of a modern version control system is how it mediates different streams of changes, particularly those from other users.  Note that a DVCS does not solve problems of merging and so on, but provides you, the user, with tools to solve them.&lt;br /&gt;
&lt;br /&gt;
Revisions in the repository form a directed acyclic graph (DAG).  Every revision apart from the first has at least one parent revision and may have zero or more child revisions.  A revision with no children is called a &#039;&#039;head&#039;&#039;.  Generally development takes place at a head of the repository: checking in a new revision onto a head creates and consumes a head.  However, it is possible to add a child to any revision, possibly creating a new head.  This is known as a branch, and may be named or unnamed.  A revision with children may still be a branch head if it has no children on its branch.&lt;br /&gt;
&lt;br /&gt;
There are various ways of managing branches.  You can have a few repositories with many branches, named and unnamed.  Or you can have many repositories with largely unbranched graphs; it&#039;s up to you.  Since mercurial uses heads as the default targets for some of its operations the latter approach is probably best for beginners as it makes operations within each repository simpler.&lt;br /&gt;
&lt;br /&gt;
This is probably best illustrated with an example.  I&#039;ll make a copy of the original repository, make a different change, and then merge the changes.  Change directory out of the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussiandevel/example-gaussian-repo testmerge&lt;br /&gt;
 updating to branch default&lt;br /&gt;
 13427 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we go into the new repository and make some modifications.  This time I alter the files &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;a2tdep.F&amp;lt;/code&amp;gt;, and add a file &amp;lt;code&amp;gt;bar.F&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 …[alterations to a1tdep.F, a2tdep.F, and bar.F]...&lt;br /&gt;
 testmerge$ hg add gdv/l510/bar.F&lt;br /&gt;
 testmerge$ hg diff&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Some new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a2tdep.F&lt;br /&gt;
 --- a/gdv/l510/a2tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a2tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -16,6 +16,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **DETERMINE IF WE RUN THE TIMEDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Super duper feature here too&lt;br /&gt;
 +c&lt;br /&gt;
        LenTst=0&lt;br /&gt;
        CALL FILEIO(11,jTDep,LenTst,0,0)&lt;br /&gt;
        IF (LenTst.EQ.0.OR.iopv.NE.23)RETURN&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/bar.F&lt;br /&gt;
 --- /dev/null   Thu Jan 01 00:00:00 1970 +0000&lt;br /&gt;
 +++ b/gdv/l510/bar.F    Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -0,0 +1,1 @@&lt;br /&gt;
 +Stuff in here&lt;br /&gt;
 testmerge$&lt;br /&gt;
 testmerge$ hg ci -m &#039;Added second new feature&#039;&lt;br /&gt;
 testmerge$ hg log -l 2&lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The situation now is that we have two repositories where there are revisions whose parent is revision 23 (23:1de40efd1c4b, in fact).  This sort of scenario might arise because we have been working on two different features in two different repositories, or it may be that two users have been working separately.  At some point you may wish to merge the work.  It&#039;s up to you when and how you do this: you may wish to merge in bug fixes quite frequently, and incorporate brand-new features much less frequently.  You can of course clone another repository in which to do the merge so that if it isn&#039;t satisfactory you can just delete the repository.&lt;br /&gt;
&lt;br /&gt;
First we must pull the revisions from one repository to another.  We use the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pull&amp;lt;/code&amp;gt; commands to do this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg incoming ../testrepo&lt;br /&gt;
 comparing with ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testmerge$ hg pull ../testrepo&lt;br /&gt;
 pulling from ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 adding changesets&lt;br /&gt;
 adding manifests&lt;br /&gt;
 adding file changes&lt;br /&gt;
 added 1 changesets with 2 changes to 2 files (+1 heads)&lt;br /&gt;
 (run &#039;hg heads&#039; to see heads, &#039;hg merge&#039; to merge)&lt;br /&gt;
 testmerge$ hg log -l 3&lt;br /&gt;
 changeset:   25:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 &lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command takes another repository as its argument and shows a list of revisions that are not present in the current repository.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command brings those revisions over into the current repository.  The &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command shows changeset 25 in the testmerge repository corresponds to number 24 in the original &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository.  Note the long ID is the same in both cases.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command reports that it has created a new head.  We can see this clearly with the &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt; command (from the graphlog extension). The &amp;lt;code&amp;gt;-r 23:&amp;lt;/code&amp;gt; flag tells &amp;lt;code&amp;gt;glog&amp;lt;/code&amp;gt; to show revisions 23 and greater, for clarity:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -r 23:&lt;br /&gt;
 o  changeset:   25:13ecff0136c2&lt;br /&gt;
 |  tag:         tip&lt;br /&gt;
 |  parent:      23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 |  summary:     A test message&lt;br /&gt;
 |&lt;br /&gt;
 | @  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; command can also be used to copy revisions from one repository to another.  It works much as you would expect, except that by default it does not permit the creation of new heads in the destination repository.  The idea is that you tend to pull into your own repository, where you&#039;re expected to know what you&#039;re doing, while you might be pushing into someone else&#039;s repository, where creating a new head might cause confusion.  &amp;lt;code&amp;gt;hg outgoing&amp;lt;/code&amp;gt; is the corresponding analogue to the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
In our example we now have a situation where we have two heads.  This can arise from revisions being created in different repositories and then pulled together, as shown.  Alternatively you can just create new heads in one repository.  A disadvantage of the single repository technique is that if you decide branch is going nowhere and elect not to merge or proceed with it, it still remains in your repository.  With multiple repositories you can just delete the offending repository.&lt;br /&gt;
&lt;br /&gt;
== Merging two sets of changes (hg merge, hg resolve) ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say that I decide that these two features will work together and I want to merge the two branches.  I can use the &amp;lt;code&amp;gt;hg up&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;hg update&amp;lt;/code&amp;gt;) command to update the current working directory to a particular revision in the repository.  If no revision is specified it will update to the current branch head.  The revision updated to becomes the parent (as shown by &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg parent&amp;lt;/code&amp;gt;) of the working directory.  If there are modified files in the working directory the update may attempt a merge.  The revision of the working directory when you start to merge is called the base of the merge.  This is important if the two revisions you are merging are on different branches, because the newly merged revision will stay on the base branch.  Note that the &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command does not update the working directory, so in this case it will still be at revision 24.  Let&#039;s update to revision 25 and then merge the changes from revision 24:&lt;br /&gt;
&lt;br /&gt;
[Which revision to merge from: in general you merge changes into whatever is your current baseline.  So, if you&#039;re merging the latest updates from Gaussian (from H10 to H11 for example) into your code, you update to your code and merge in the H11 revision.  If you&#039;re merging in your changes into the soon to be sent to Gaussian group development version you&#039;d start with that and merge in the revision(s) containing your changes]&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg up 25&lt;br /&gt;
 3 files updated, 0 files merged, 1 files removed, 0 files unresolved&lt;br /&gt;
 testmerge$ hg merge 24&lt;br /&gt;
 merging gdv/l510/a1tdep.F&lt;br /&gt;
 warning: conflicts during merge.&lt;br /&gt;
 merging gdv/l510/a1tdep.F failed!&lt;br /&gt;
 2 files updated, 0 files merged, 0 files removed, 1 files unresolved&lt;br /&gt;
 use &#039;hg resolve&#039; to retry unresolved file merges or &#039;hg update -C .&#039; to abandon&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The software automatically brings in the changes to foo.F, bar.F, and a2tdep.F (as &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; will show).  However, in our contrived example &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; is subject to changes from both revisions.  Mercurial will attempt to merge automatically, and in this case it fails.  If you edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; you will see it contains the lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 =======&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
which were inserted during the failed merge.  There is also an &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt; file created as a result of the failed merge.  As the output from &amp;lt;code&amp;gt;hg merge&amp;lt;/code&amp;gt; says you can either now resolve this failed merge or use &amp;lt;code&amp;gt;hg update -C&amp;lt;/code&amp;gt; to undo it (the &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; file will remain).&lt;br /&gt;
&lt;br /&gt;
Since we want to resolve the merge we should edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; so that it works.  At a bare minimum we will have to remove the “&amp;lt;code&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&amp;lt;/code&amp;gt;”, “&amp;lt;code&amp;gt;=======&amp;lt;/code&amp;gt;”, and “&amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&amp;lt;/code&amp;gt;” marker lines.  In a more complex situation we might have to completely rewrite this and other files.  This is what I mean when I say that mercurial only provides tools to do merging.  Even a completely successful merge, from mercurial&#039;s point of view, may be completely bogus code.&lt;br /&gt;
&lt;br /&gt;
There are tools available to make this task easier.  For example I use &amp;lt;code&amp;gt;vimdiff&amp;lt;/code&amp;gt;, a part of the popular &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; package.  To enable this I have altered my &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file to look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 merge = vimdiff&lt;br /&gt;
 username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
 &lt;br /&gt;
 [merge-tools]&lt;br /&gt;
 vimdiff.executable = vim&lt;br /&gt;
 vimdiff.args = -d $base $local $output $other +close +close&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
as per http://mercurial.selenic.com/wiki/MergingWithVim.  The page http://mercurial.selenic.com/wiki/MergeProgram contains instructions for other tools, including Emacs, and graphical tools.  If you edit your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file in this way then you now can type &amp;lt;code&amp;gt;hg resolve --all&amp;lt;/code&amp;gt; to run your chosen tool on all unresolved files.  Note that by default if your chosen tool exits without an error then &amp;lt;code&amp;gt;hg resolve&amp;lt;/code&amp;gt; will regard that file as resolved.  To cause &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; to exit with an error use &amp;lt;code&amp;gt;:cq&amp;lt;/code&amp;gt;.  See &amp;lt;code&amp;gt;hg help resolve&amp;lt;/code&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
In the example my resolution is to have the relevant lines in &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 c&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have resolved all the files that mercurial thinks need fixing you should check that the final merged result makes sense.  Checking that it compiles, or runs tests appropriate to both of the original revisions, for example.  When you are satisfied, you should check in the merged revision:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg ci -m &#039;Merged super and duper features&#039;&lt;br /&gt;
 &lt;br /&gt;
 testmerge$ hg tip&lt;br /&gt;
 &lt;br /&gt;
 changeset:   26:857f81e59d66&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      25:13ecff0136c2&lt;br /&gt;
 parent:      24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 13:10:52 2012 +0000&lt;br /&gt;
 summary:     Merged super and new features&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 testmerge$&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the new revision has &#039;&#039;two&#039;&#039; parent revisions; a merge always consumes a head.  This is clear from the output of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -l 4&lt;br /&gt;
 o    changeset:   26:857f81e59d66&lt;br /&gt;
 |\   tag:         tip&lt;br /&gt;
 | |  parent:      25:13ecff0136c2&lt;br /&gt;
 | |  parent:      24:457db23c0b1a&lt;br /&gt;
 | |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 | |  date:        Thu Jan 26 13:10:52 2012 +0000&lt;br /&gt;
 | |  summary:     Merged super and new features&lt;br /&gt;
 | |&lt;br /&gt;
 | o  changeset:   25:13ecff0136c2&lt;br /&gt;
 | |  parent:      23:1de40efd1c4b&lt;br /&gt;
 | |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 | |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 | |  summary:     A test message&lt;br /&gt;
 | |&lt;br /&gt;
 o |  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another example of merging here?  Perhaps Lee&#039;s code merging in changes on official version.&lt;br /&gt;
&lt;br /&gt;
== Tags and named branches (hg tag, hg tags, hg branch, hg branches) ==&lt;br /&gt;
&lt;br /&gt;
It is often useful to give a name to a particular revision.  This might be a changeset that corresponds to a given version of the code, or it might simply be a revision that marks a particular milestone.  In the &amp;lt;code&amp;gt;example-gaussian-repo&amp;lt;/code&amp;gt; you have probably noticed there are revisions in the history with descriptions like &amp;quot;Added tag h13 for changeset 6c81eb8dcbab&amp;quot;.  These are revisions corresponding to particular versions of the Gaussian development version, such as H01, H10, H13, etc.  You can see a list of the tags in a repository by doing:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg tags&lt;br /&gt;
 tip                               26:857f81e59d66&lt;br /&gt;
 h13                               22:6c81eb8dcbab&lt;br /&gt;
 h12p                              20:0ef14d7dff56&lt;br /&gt;
 h11                               18:7daba638a830&lt;br /&gt;
 h10                               16:e1d0af4e84d9&lt;br /&gt;
 h08                               14:656073c38db9&lt;br /&gt;
 h01                               12:737d1720e79a&lt;br /&gt;
 h13-raw                           10:b039f5c274e2&lt;br /&gt;
 h12p-raw                           8:522a8fe79d22&lt;br /&gt;
 h11-raw                            6:a28b789a9555&lt;br /&gt;
 h10-raw                            4:356081dab79d&lt;br /&gt;
 h08-raw                            2:9f69ed4616ad&lt;br /&gt;
 h01-raw                            0:073d6aa63ea7&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(the &amp;lt;code&amp;gt;tip&amp;lt;/code&amp;gt; tag is automatically assigned to the most recently checked in revision).  You may use a tag name anywhere where you might use a revision number, so for example, to check out the changeset corresponding to the official Gaussian development release H10, you would type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg up h10&lt;br /&gt;
 13887 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(this will look different if you have unchecked-in modifications in your working directory).  You could also pass h10 to the &amp;lt;code&amp;gt;hg clone -u&amp;lt;/code&amp;gt; flag, and so on.&lt;br /&gt;
You tag a revision with the &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt; command.  Issue it in a working directory and it will tag the revision that is the parent of the working directory.  Tags become part of the repository, that is they are shared during &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt;, so choose wisely.  If you&#039;d like to have tags that are only part of the local repository, use the &amp;lt;code&amp;gt;-l&amp;lt;/code&amp;gt; flag to &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Tags are stored in an &amp;lt;code&amp;gt;.hgtags&amp;lt;/code&amp;gt; file in the root directory of the repository.  Running &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt; alters this file and then commits the change to the repository.  Sometimes you can see conflicts in this file during merges.  I normally just resolve them by keeping as much information in the merged file as possible.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg branches&amp;lt;/code&amp;gt; command can be used to show the named branches in the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg branches&lt;br /&gt;
 default                       24:13ecff0136c2&lt;br /&gt;
 raw                           11:a0c273aeeb2b (inactive)&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I have two named branches, raw and default (the default branch is, er, the default).  If you examine the full output of &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt;, which is quite long and I won&#039;t reproduce it here, you&#039;ll see, starting at the bottom, revisions 0 to 11 are all in the raw branch.  I have created and named this branch to contain the official Gaussian development code as processed by the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, without any of our makefiles or other alterations.  The default branch branches off from revision 1 and starts at revision 12.  Its descendants, revisions 12 to 23, are also in the default branch.  These were created by starting at revision 1, adding our makefiles and modifications to the build system, renaming this branch to the default branch, and then committing revision 12.  I tagged revision 12 as &amp;quot;H01&amp;quot;, which created revision 13.  I then merged revision 3, fixed the conflicts, and committed revision 14, and so on.  A more detailed guide on how to import a new official version of gdv exists in LINKY.&lt;br /&gt;
&lt;br /&gt;
You can use branch names just like tags wherever mercurial expects a revision identifier.  If you use a branch name mercurial will attempt to give you the revision that is most appropriate, this will usually be the newest head on that branch.&lt;br /&gt;
&lt;br /&gt;
To create a new branch you type &amp;lt;code&amp;gt;hg branch &amp;lt;branchname&amp;gt;&amp;lt;/code&amp;gt;.  This will take effect when you commit the working directory.  As I&#039;ve previously mentioned a simpler alternative to having branches, named or otherwise, in your repository is to have multiple repositories.&lt;br /&gt;
&lt;br /&gt;
== Ignoring files ==&lt;br /&gt;
&lt;br /&gt;
You may be wondering how the system will work when you start compiling files.  Won&#039;t all the &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.exe&amp;lt;/code&amp;gt; files start showing up in the output to &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;?  The answer is that they will not, because I&#039;ve told mercurial to ignore such files.  This information is stored in the &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file in the root of the repository.  It&#039;s quite long but it starts like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 syntax: glob&lt;br /&gt;
 gdv.make&lt;br /&gt;
 *.o&lt;br /&gt;
 *.lo&lt;br /&gt;
 *.a&lt;br /&gt;
 *.exe&lt;br /&gt;
 *.exel&lt;br /&gt;
 .*.swp&lt;br /&gt;
 *~&lt;br /&gt;
 *.log&lt;br /&gt;
 *.log.gz&lt;br /&gt;
 *.chk&lt;br /&gt;
 gdv/arc&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Any file that matches either the shell patterns or the file names in &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; is ignored by mercurial.  This means it does not show up to &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt;, and so on will ignore it unless it is explicitly mentioned on the command line.  So &amp;lt;code&amp;gt;hg add gdv&amp;lt;/code&amp;gt; will add all non-ignored files in the gdv directory, while &amp;lt;code&amp;gt;hg add gdv/*&amp;lt;/code&amp;gt; will add all the files in the gdv directory.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file is tracked, so please only commit changes to it if you think they will be useful to everyone.&lt;br /&gt;
== Other commands ==&lt;br /&gt;
&lt;br /&gt;
There are quite a few other commands available to mercurial, I will cover just a few here, if you&#039;re interested in becoming a power user refer to the documentation I have mentioned.&lt;br /&gt;
&lt;br /&gt;
=== hg addremove ===&lt;br /&gt;
You can use this command when you have large numbers of files to add and remove.  It also includes the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; flag to attempt to detect when files have been moved or copied.  Using this flag does require some subtlety, as it&#039;s not helpful to mark files as moved or copied unless they have been.  Also note that it is possible to inadvertently include ignored files in a mass &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg addremove&amp;lt;/code&amp;gt;; check what&#039;s being added before you commit.&lt;br /&gt;
&lt;br /&gt;
=== hg grep and hg locate ===&lt;br /&gt;
Similar to the standard UNIX grep and locate commands, but cognisant of the mercurial repository.&lt;br /&gt;
&lt;br /&gt;
=== hg init ===&lt;br /&gt;
Creates a new mercurial repository in the current directory&lt;br /&gt;
&lt;br /&gt;
=== hg serve ===&lt;br /&gt;
This starts a mini web server serving information about the repository.  I would strongly recommend you do not use this while working on the Gaussian development version as it would be all too easy to allow any user on the system to view all of the files in your repository.  I only mention it here because some of the other documentation may refer to it.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=251887</id>
		<title>Resgrp:comp-photo-version control</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=251887"/>
		<updated>2012-03-21T15:52:34Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: /* Setting up your environment (.hgrc) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This document will teach you the basics of using mercurial, a distributed version control system (DVCS).  It is particularly directed towards using mercurial with the development version of Gaussian, so the examples will use Gaussian.  For more information on mercurial you can use the built-in help system &amp;lt;code&amp;gt;hg help&amp;lt;/code&amp;gt;, look at the official website: http://mercurial.selenic.com/wiki/Mercurial, or check out the official O&#039;Reilly book, the text of which is freely available at: http://hgbook.red-bean.com/.&lt;br /&gt;
&lt;br /&gt;
A version control system can sometimes seem an onerous imposition unless the user understands how it is going to help them in their work, so I&#039;ll try to briefly explain.  Version control is about tracking changes to data.  If one has a collection of files, say a distribution of Gaussian, then one is interested in changes that have been made to those files, whether from a new distribution from Gaussian or our own modifications.  We are particularly interested in cases where overlapping changes have been made.  These might be updates and bug fixes from Gaussian conflicting with our own modifications to a particular link, or it might be different researchers in a group working on the same piece of code independently.  A version control system will not only detect such cases but provide automated and safe methods for merging conflicting changes.&lt;br /&gt;
&lt;br /&gt;
Central to the idea of a VCS is the concept of a revision or changeset.  This is like a snapshot of some set of files and directories at some particular instant in their history.  A repository is where a VCS stores revisions.  So, using Gaussian as an example, some revisions in a particular repository might be the Gaussian source tree corresponding to Gaussian development versions H01, H08, H10, H11, etc.  The data that are actually kept inside the repository are the differences, or deltas, between the revisions.  This saves space compared to storing all the revisions.&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment (.hgrc)==&lt;br /&gt;
There are some one-off things you must do.  Firstly, edit your login scripts (&amp;lt;code&amp;gt;.bash_profile&amp;lt;/code&amp;gt; or similar) to include the command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 module load mercurial&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(If you&#039;re not on an IC HPC machine mercurial is available anywhere that runs Python.  It is generally available in distribution package systems, if not you can get it from http://mercurial.selenic.com/wiki/Mercurial).  Note that the Redhat provided mercurial on RHEL 5 and 6 is quite old and does not, at time of writing, support the repositories I have created.&lt;br /&gt;
&lt;br /&gt;
Next, create a file called &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; in your home directory and insert the following lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 username = Your Name &amp;lt;your@email.address&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(so for example, my &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; contains this line: &amp;lt;code&amp;gt;username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
Mercurial uses this username field to record who has changed what.  (If you&#039;re not on an IC HPC machine your version of mercurial may not&lt;br /&gt;
have the graphlog extension.  If it doesn&#039;t, don&#039;t worry, it&#039;s merely a tool for visualising changesets).&lt;br /&gt;
&lt;br /&gt;
== Checking out a repository (hg clone, hg log) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s get started and check out a repository.  Once you have loaded the mercurial module you will be able to type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussian-devel/example-gaussian-repo testrepo&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a copy of the repository at &amp;lt;code&amp;gt;/home/gaussian-devel/example-gaussian-repo&amp;lt;/code&amp;gt; and place it in a directory inside the current directory called &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt;.  You can give a full path as the second argument, or, you can leave it off altogether in which case mercurial will clone the repository into a directory named &amp;lt;code&amp;gt;example-gaussian-repo&amp;lt;/code&amp;gt;.  A note here for Imperial HPC users.  Copying a repository involves quite a bit of filesystem activity.  I have found that on cx1 this can be quite slow on the &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; filesystems.  You may wish to try these examples in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; filesystem which is a lot faster.  Be aware, however, that this raises two potentially serious problems.  The first is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is globally readable so before you clone you must make sure that your umask is set to &amp;lt;code&amp;gt;0077&amp;lt;/code&amp;gt;.  The second, of course, is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is periodically wiped.  If you plan on working in &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; there are simple ways of transferring information between repositories (&amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt;) that I will cover later.&lt;br /&gt;
&lt;br /&gt;
Now change into the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory.  Inside you will see three scripts and a &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory; also some hidden files and a hidden directory.  Inside the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory you will see the Gaussian source in the [[Resgrp:comp-photo-new gdv layout|new layout]].  The hidden &amp;lt;code&amp;gt;.hg&amp;lt;/code&amp;gt; directory inside the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory is the repository proper; you will almost never need to do anything in here.  The rest of the files and directories are called the working directory; this is where you will do your work.&lt;br /&gt;
&lt;br /&gt;
The first thing you might want to do is check the history of this repository to see past revisions that have been checked into it.  You do this with the &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log | head -20&lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 &lt;br /&gt;
 changeset:   22:6c81eb8dcbab&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      21:5b6ac3665a29&lt;br /&gt;
 parent:      11:a0c273aeeb2b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:08 2012 +0000&lt;br /&gt;
 summary:     Gaussian devel version H13 with our makefiles&lt;br /&gt;
 &lt;br /&gt;
 changeset:   21:5b6ac3665a29&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:41:40 2012 +0000&lt;br /&gt;
 summary:     Added tag h12p for changeset 0ef14d7dff56&lt;br /&gt;
 ...&lt;br /&gt;
 changeset:   1:515a93bfc3b5&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:10 2012 +0000&lt;br /&gt;
 summary:     Added tag h01-raw for changeset 073d6aa63ea7&lt;br /&gt;
 &lt;br /&gt;
 changeset:   0:073d6aa63ea7&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h01-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:09 2012 +0000&lt;br /&gt;
 summary:     Output from old-to-new.sh on version H01&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
You will see that there are various fields that may appear for each changeset.  The changeset field shows two numbers separated by a colon.  The second, longer, hexadecimal number is the unique identifier.  A particular hex identifier will always refer to the same changeset, even in different copies of the repository.  The first number is a local identifier.  These local IDs refer to particular changesets in one copy of the repository; if these changesets are present in another repository they may have a different local identifier.    You can use either identifier as an argument to &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands.  The user and date fields show who committed the change and when.  The summary field shows the first line of the log entry for that revision.  This means it is important to try to make the first line of your log entries a useful summary of what you have done!&lt;br /&gt;
&lt;br /&gt;
To see the entry for a particular revision use the &amp;lt;code&amp;gt;-r&amp;lt;/code&amp;gt; flag with a revision number, either short or long.  To see more information, including the full log entry and a complete list of all files involved in the change, use the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag, e.g.:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -r 2 -v | less&lt;br /&gt;
 changeset:   2:9f69ed4616ad&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h08-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:54:50 2012 +0000&lt;br /&gt;
 files:       gdv/archlib/arcvib.F gdv/archlib/brcpyw.F gdv/archlib/letset.F gdv/arctmp.F gdv/bsd/GauDiff_Compare.pm gdv/bsd/G&lt;br /&gt;
 ....&lt;br /&gt;
 at.F gdv/utilnz/xpndnb.F gdv/utilnz/zerock.F gdv/utilnz/zerod.F gdv/wrappers/ggeev.F gdv/wrappers/lappar.F gdv/wrappers/xgetrf.F  gdv/wrappers/xgetrs.F gdv/wrappers/ygeru.F gdv/wrappers/ytrsv.F&lt;br /&gt;
 description:&lt;br /&gt;
 Import of gdv H08.  See below for details.&lt;br /&gt;
 &lt;br /&gt;
 Result of these commands on the H01 raw rev:&lt;br /&gt;
 rm -fr gdv&lt;br /&gt;
 cp -pr h08/new-style-gdv .&lt;br /&gt;
 hg add gdv/bsd/*.a&lt;br /&gt;
 hg addremove -s 50&lt;br /&gt;
 &lt;br /&gt;
 h08/new-style is from old-to-new.sh on freshly untarred h08.tgz&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
As the log entry explains, this particular revision is the change from the H01 version of Gaussian to the H08 version, so there are a lot of changed files.  The description entry is intended to provide some human readable explanation of the changes.  When you start committing data to the repository you should aim to at least make your log entries understandable.&lt;br /&gt;
&lt;br /&gt;
As with all the commands that I will mention you can get more information by typing &amp;lt;code&amp;gt;hg help &amp;lt;command&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Committing changes (hg summary, hg status, hg diff) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make some alterations to this repository.  This is quite safe; we can&#039;t break the original repository because our copy is an entirely separate clone.  In fact, this is a very common working practice with mercurial.  As long as the filesystem isn&#039;t slow cloning a repository can be quite quick.  Indeed, cloning a repository into a destination on the same filesystem as the source makes use of hard linking which is very fast and saves space.  Therefore, it is very common to clone a repository, make some alterations to it, and then decide whether to push them back to the original repository or just delete the new clone.&lt;br /&gt;
&lt;br /&gt;
First, we want to know where it is we are starting from.  To get a quick summary you use the &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; command.  This should show something like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg summary&lt;br /&gt;
 parent: 23:1de40efd1c4b tip&lt;br /&gt;
 Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 branch: default&lt;br /&gt;
 commit: (clean)&lt;br /&gt;
 update: (current)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows, on the parent line, the revision that has been checked out into the working directory.  Below that is the summary line from the log entry for that revision.  The commit line shows if any files have been modified since the check out.  The update line shows if there are any applicable newer revisions in the repository.  In this example the output shows us that we checked out the revision with the local identifier 23, and unique identifier of 1de40efd1c4b, that we have modified nothing and that there are no appropriate newer revisions.  This checkout occurred automatically as a part of the &amp;lt;code&amp;gt;hg clone&amp;lt;/code&amp;gt; command.  You can clone without checking anything out into the working directory (say to make a backup copy of the repository) by passing the &amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; flag, or you can check out a particular revision with the &amp;lt;code&amp;gt;-u REV&amp;lt;/code&amp;gt; flag.  See &amp;lt;code&amp;gt;hg help clone&amp;lt;/code&amp;gt; for how mercurial chooses what to check out by default.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say we&#039;re adding a feature to link 510.  If you have something in mind go ahead and do it. For this example I have just added a few lines to the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, and will assume that your current working directory is &amp;lt;code&amp;gt;gdv/l510&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As you work you may be curious to know what it is you have changed.  The command to show this is &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The output shows a list of files that have been altered in some way.  Here the capital M shows that the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified.  By default &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; does not report on unchanged files.  If we wish to see how &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified we can use the &amp;lt;code&amp;gt;hg diff&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 11:07:55 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Add super new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows the output in a unified different format, refer to the man page for diff for more information.&lt;br /&gt;
&lt;br /&gt;
== Adding, copying, renaming, and deleting file (hg add, hg forget, hg mv, hg rm, hg cp) ==&lt;br /&gt;
&lt;br /&gt;
If you have created a new file then you must let mercurial know about its existence with the &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ echo &amp;quot;a new subroutine&amp;quot; &amp;gt; foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 ? gdv/l510/foo.F&lt;br /&gt;
 testrepo$ hg add foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here, I create a new file called &amp;lt;code&amp;gt;foo.F&amp;lt;/code&amp;gt;.  &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with a ?,  to indicate that it is unknown to the repository.  I then run &amp;lt;code&amp;gt;hg add foo.F&amp;lt;/code&amp;gt;, after which &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with an A.  This indicates that the file is scheduled to be added at the next commit.  If you change your mind about the file before the next commit you can use &amp;lt;code&amp;gt;hg forget&amp;lt;/code&amp;gt; to undo the add.&lt;br /&gt;
&lt;br /&gt;
If you are renaming a file, including the situation where you move the file from one directory to another (e.g. from l510 to utilam) then you may use the &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; command.  This will actually perform the move just like the normal &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; command.  If you&#039;ve already moved the file you can give &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; the &amp;lt;code&amp;gt;-A&amp;lt;/code&amp;gt; flag to record the rename after the fact.  Similarly, the &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt; command removes files from the working directory and records this fact in the repository, and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; copies a file.&lt;br /&gt;
&lt;br /&gt;
It is important to realise that these commands act on the working directory immediately but only affect the repository when they are committed.  Also, they do not affect the repository&#039;s previous history, so removing a file and then committing that change does not affect that file&#039;s existence in previous revisions in the repository.  However, &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; create a relationship between the source and destination files.  This becomes useful when merging in changes from somewhere else.  So for example, above I have made changes to &amp;lt;code&amp;gt;l510/a1tdep.F&amp;lt;/code&amp;gt;.  Let&#039;s say that someone else has decided to make this into a utility routine and has done the command &amp;lt;code&amp;gt;hg mv l510/a1tdep.F utilam/a1tdep.F&amp;lt;/code&amp;gt;.  If I choose to merge my changes with this other person&#039;s, mercurial will correctly apply the changes &#039;&#039;&#039;and&#039;&#039;&#039; move the file.  If instead of &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; they had used &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; then my changes would be applied to both files.  This means that you should only use &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; when it is appropriate that changes that are recorded before the copy are applied to both files.  Note that this does not mean that changes to the source file are forever applied to the destination file; this will only occur when merging a revision that does not contain a copy with a revision that does.  In general, you can expect mercurial to do the right thing.&lt;br /&gt;
&lt;br /&gt;
== Committing the changes (hg commit, hg tip) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt; (like many &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands, &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commit has an alias, in this case &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;.  I tend to use &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;) command creates a new revision and records the differences between the entire working directory and the parent revision (as shown on the parent line of &amp;lt;code&amp;gt;hg summary).  This will be the same as the output from &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;.  When you run the command mercurial will open a text editor.  If you wish to specify which editor is used add an &amp;lt;code&amp;gt;editor=vim&amp;lt;/code&amp;gt; (for example) line to the &amp;lt;code&amp;gt;[ui]&amp;lt;/code&amp;gt; part of your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file.  The editor will start with a couple of empty lines and then some lines beginning with &amp;quot;&amp;lt;code&amp;gt;HG:&amp;lt;/code&amp;gt;&amp;quot;.  These are there to give you helpful reminders of what you&#039;ve changed while you write your log message and will be ignored by mercurial when you commit.  If you close the editor without writing anything, or of the editor quits with an error, mercurial will abort the commit.  So for our current example:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci&lt;br /&gt;
 ... [opens vim]&lt;br /&gt;
 HG: Enter commit message.  Lines beginning with &#039;HG:&#039; are removed.&lt;br /&gt;
 HG: Leave message empty to abort commit.&lt;br /&gt;
 HG: --&lt;br /&gt;
 HG: user: Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 HG: branch &#039;default&#039;&lt;br /&gt;
 HG: added gdv/l510/foo.F&lt;br /&gt;
 HG: changed gdv/l510/a1tdep.F&lt;br /&gt;
 ~&lt;br /&gt;
 ~&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For short messages you can skip the editor step by passing the &amp;lt;code&amp;gt;-m &amp;quot;Log message here&amp;quot;&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
Understanding what you are doing here is essential to knowing what to write in the log and, importantly, when to commit.  There are two schools of thought.  When you commit you are creating a new revision in your local repository.  Since it is your repository, and as I have previously mentioned, it is very simple to create new repositories, you should commit whenever you feel like it and feel free to write cryptic log messages that only you will understand.  On the other hand, you are engaged in a collaborative exercise with other people: creating what will be a single version of Gaussian that contains yours and others&#039; modifications and Gaussian&#039;s updates.  Therefore, you should only commit when your code satisfies pre-agreed group requirements, and your log message should be detailed and comprehensible to anybody who reads it, even 50 years in the future.  The correct approach, of course, is to do both.&lt;br /&gt;
&lt;br /&gt;
Mercurial is a distributed version control system which means that each repository is the responsibility of its owner who can feel free to commit as frequently (or infrequently) as needed.  Sometimes adding a feature or removing a bug might take weeks, and you might feel that there is no point taking snapshots of the code until it works.  Other modifications might proceed incrementally with naturally defined stopping points between the start and the end.  Committing at these points makes perfect sense: not only does it leave a history of the modification, it provides checkpoints, versions of the code that you can retreat to without having to start again.  The log messages may tersely explain what has happened since the last revision (and note there is no point listing modified, added, etc, files as this information is stored in the commit anyway) or they may contain detailed essays on how a bug arose and the steps you have taken to fix it.  Information in the logs is searchable and should be thought of as both an aide memoir for yourself and a journal entry for others.&lt;br /&gt;
&lt;br /&gt;
When the time comes to merge your changes into other people&#039;s repositories, you might start thinking about the quality of your commit.  Does the code compile?  Does it run the test suite?  Can it run any test?  Have you committed a test that checks the code you have added or altered?  The group may decide that revisions that are being shared must answer yes to some or all of these questions.  You may decide that some or all of your revisions must pass these quality checks.  Or, you may be satisfied with noting in the log entry what this particular revision can or can&#039;t do (such as compile or run).&lt;br /&gt;
&lt;br /&gt;
It should be said though, that if you ever think &amp;quot;perhaps I should check in at this point&amp;quot;, then go for it.  Revisions live in the history of your repository forever (although see &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;), but when you transfer them to other people&#039;s repositories multiple revisions can be collapsed into one, or fixed in other ways.&lt;br /&gt;
&lt;br /&gt;
Returning to our example I enter a simple message.  Since &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; only shows the first line of any log entry by default it is a good idea to make this line a summary of the rest of the message.  I close the editor and the commit is done.&lt;br /&gt;
&lt;br /&gt;
We can see the results in the repository with an &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command (the &amp;lt;code&amp;gt;-l 2&amp;lt;/code&amp;gt; flag shows the last two revisions):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -l 2&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 summary:     A test message.&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Alternatively we can use the &amp;lt;code&amp;gt;hg tip&amp;lt;/code&amp;gt; command to show the most recently added repository, whether by ourselves, or by pulling from another repository (see later).&lt;br /&gt;
&lt;br /&gt;
== Fixing mistakes (hg revert, hg rollback) ==&lt;br /&gt;
&lt;br /&gt;
You can return one or more files, or the entire repository, to the state they were in when you last checked them out with in the &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; command.  Let&#039;s make an ill-advised alteration to our now committed change to &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ sed -i &#039;s/super/super duper/&#039; a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 13ecff0136c2 gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 17:23:42 2012 +0000&lt;br /&gt;
 @@ -27,7 +27,7 @@&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
  c&lt;br /&gt;
 -c     Add super new feature&lt;br /&gt;
 +c     Add super duper new feature&lt;br /&gt;
  c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ? gdv/l510/a1tdep.F.orig&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 testrepo$ rm a1tdep.*&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ! gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I use revert to undo the modifications to a file.  Notice that &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; leaves a copy of the modified file in &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt;.  This shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as an unknown file (&amp;quot;?&amp;quot;).  Also notice that while trying to delete the .orig file I have accidentally deleted &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, which now shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as a missing file (&amp;quot;!&amp;quot;).  I can revert this mistake too:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 testrepo$ ls a1tdep.F&lt;br /&gt;
 a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; can also be used to cancel scheduled adds, removes, copies, and renames.&lt;br /&gt;
&lt;br /&gt;
If you have just committed a revision and then change your mind you may be able to undo the effect with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;.  Doing this for our example gives us:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg rollback&lt;br /&gt;
 repository tip rolled back to revision 23 (undo commit)&lt;br /&gt;
 working directory now based on revision 23&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This removes the revision we just checked in from the repository but does not alter the current working directory.  If we choose, we could now use &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; to restore these to their revision 23 state.  There are two important caveats with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;: it can only remove the last checked in revision, and that it is usually pointless to rollback a revision that has already been pushed or pulled (see later) into somebody else&#039;s repository, as we can only affect our repository.  For the purposes of this example, I will once more check in the changes I have made:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci -m &#039;A test message&#039;&lt;br /&gt;
 testrepo$ hg tip&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:38:52 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Collaboration (hg incoming, hg pull, hg outgoing, hg push, hg update, hg parent) ==&lt;br /&gt;
&lt;br /&gt;
The tools described are already quite useful, and form the basis of the very earliest revision control systems.  The benefits of being able to detect what you&#039;ve changed, and how you&#039;ve changed it, being able to undo the changes selectively, and being able to take a snapshot of your work at any point of your choosing should be apparent.  The true power, however, of a modern version control system is how it mediates different streams of changes, particularly those from other users.  Note that a DVCS does not solve problems of merging and so on, but provides you, the user, with tools to solve them.&lt;br /&gt;
&lt;br /&gt;
Revisions in the repository form a directed acyclic graph (DAG).  Every revision apart from the first has at least one parent revision and may have zero or more child revisions.  A revision with no children is called a &#039;&#039;head&#039;&#039;.  Generally development takes place at a head of the repository: checking in a new revision onto a head creates and consumes a head.  However, it is possible to add a child to any revision, possibly creating a new head.  This is known as a branch, and may be named or unnamed.  A revision with children may still be a branch head if it has no children on its branch.&lt;br /&gt;
&lt;br /&gt;
There are various ways of managing branches.  You can have a few repositories with many branches, named and unnamed.  Or you can have many repositories with largely unbranched graphs; it&#039;s up to you.  Since mercurial uses heads as the default targets for some of its operations the latter approach is probably best for beginners as it makes operations within each repository simpler.&lt;br /&gt;
&lt;br /&gt;
This is probably best illustrated with an example.  I&#039;ll make a copy of the original repository, make a different change, and then merge the changes.  Change directory out of the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussiandevel/example-gaussian-repo testmerge&lt;br /&gt;
 updating to branch default&lt;br /&gt;
 13427 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we go into the new repository and make some modifications.  This time I alter the files &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;a2tdep.F&amp;lt;/code&amp;gt;, and add a file &amp;lt;code&amp;gt;bar.F&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 …[alterations to a1tdep.F, a2tdep.F, and bar.F]...&lt;br /&gt;
 testmerge$ hg add gdv/l510/bar.F&lt;br /&gt;
 testmerge$ hg diff&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Some new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a2tdep.F&lt;br /&gt;
 --- a/gdv/l510/a2tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a2tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -16,6 +16,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **DETERMINE IF WE RUN THE TIMEDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Super duper feature here too&lt;br /&gt;
 +c&lt;br /&gt;
        LenTst=0&lt;br /&gt;
        CALL FILEIO(11,jTDep,LenTst,0,0)&lt;br /&gt;
        IF (LenTst.EQ.0.OR.iopv.NE.23)RETURN&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/bar.F&lt;br /&gt;
 --- /dev/null   Thu Jan 01 00:00:00 1970 +0000&lt;br /&gt;
 +++ b/gdv/l510/bar.F    Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -0,0 +1,1 @@&lt;br /&gt;
 +Stuff in here&lt;br /&gt;
 testmerge$&lt;br /&gt;
 testmerge$ hg ci -m &#039;Added second new feature&#039;&lt;br /&gt;
 testmerge$ hg log -l 2&lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The situation now is that we have two repositories where there are revisions whose parent is revision 23 (23:1de40efd1c4b, in fact).  This sort of scenario might arise because we have been working on two different features in two different repositories, or it may be that two users have been working separately.  At some point you may wish to merge the work.  It&#039;s up to you when and how you do this: you may wish to merge in bug fixes quite frequently, and incorporate brand-new features much less frequently.  You can of course clone another repository in which to do the merge so that if it isn&#039;t satisfactory you can just delete the repository.&lt;br /&gt;
&lt;br /&gt;
First we must pull the revisions from one repository to another.  We use the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pull&amp;lt;/code&amp;gt; commands to do this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg incoming ../testrepo&lt;br /&gt;
 comparing with ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testmerge$ hg pull ../testrepo&lt;br /&gt;
 pulling from ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 adding changesets&lt;br /&gt;
 adding manifests&lt;br /&gt;
 adding file changes&lt;br /&gt;
 added 1 changesets with 2 changes to 2 files (+1 heads)&lt;br /&gt;
 (run &#039;hg heads&#039; to see heads, &#039;hg merge&#039; to merge)&lt;br /&gt;
 testmerge$ hg log -l 3&lt;br /&gt;
 changeset:   25:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 &lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command takes another repository as its argument and shows a list of revisions that are not present in the current repository.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command brings those revisions over into the current repository.  The &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command shows changeset 25 in the testmerge repository corresponds to number 24 in the original &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository.  Note the long ID is the same in both cases.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command reports that it has created a new head.  We can see this clearly with the &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt; command (from the graphlog extension). The &amp;lt;code&amp;gt;-r 23:&amp;lt;/code&amp;gt; flag tells &amp;lt;code&amp;gt;glog&amp;lt;/code&amp;gt; to show revisions 23 and greater, for clarity:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -r 23:&lt;br /&gt;
 o  changeset:   25:13ecff0136c2&lt;br /&gt;
 |  tag:         tip&lt;br /&gt;
 |  parent:      23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 |  summary:     A test message&lt;br /&gt;
 |&lt;br /&gt;
 | @  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; command can also be used to copy revisions from one repository to another.  It works much as you would expect, except that by default it does not permit the creation of new heads in the destination repository.  The idea is that you tend to pull into your own repository, where you&#039;re expected to know what you&#039;re doing, while you might be pushing into someone else&#039;s repository, where creating a new head might cause confusion.  &amp;lt;code&amp;gt;hg outgoing&amp;lt;/code&amp;gt; is the corresponding analogue to the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
In our example we now have a situation where we have two heads.  This can arise from revisions being created in different repositories and then pulled together, as shown.  Alternatively you can just create new heads in one repository.  A disadvantage of the single repository technique is that if you decide branch is going nowhere and elect not to merge or proceed with it, it still remains in your repository.  With multiple repositories you can just delete the offending repository.&lt;br /&gt;
&lt;br /&gt;
== Merging two sets of changes (hg merge, hg resolve) ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say that I decide that these two features will work together and I want to merge the two branches.  I can use the &amp;lt;code&amp;gt;hg up&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;hg update&amp;lt;/code&amp;gt;) command to update the current working directory to a particular revision in the repository.  If no revision is specified it will update to the current branch head.  The revision updated to becomes the parent (as shown by &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg parent&amp;lt;/code&amp;gt;) of the working directory.  If there are modified files in the working directory the update may attempt a merge.  The revision of the working directory when you start to merge is called the base of the merge.  This is important if the two revisions you are merging are on different branches, because the newly merged revision will stay on the base branch.  Note that the &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command does not update the working directory, so in this case it will still be at revision 24.  Let&#039;s update to revision 25 and then merge the changes from revision 24:&lt;br /&gt;
&lt;br /&gt;
[Which revision to merge from: in general you merge changes into whatever is your current baseline.  So, if you&#039;re merging the latest updates from Gaussian (from H10 to H11 for example) into your code, you update to your code and merge in the H11 revision.  If you&#039;re merging in your changes into the soon to be sent to Gaussian group development version you&#039;d start with that and merge in the revision(s) containing your changes]&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg up 25&lt;br /&gt;
 3 files updated, 0 files merged, 1 files removed, 0 files unresolved&lt;br /&gt;
 testmerge$ hg merge 24&lt;br /&gt;
 merging gdv/l510/a1tdep.F&lt;br /&gt;
 warning: conflicts during merge.&lt;br /&gt;
 merging gdv/l510/a1tdep.F failed!&lt;br /&gt;
 2 files updated, 0 files merged, 0 files removed, 1 files unresolved&lt;br /&gt;
 use &#039;hg resolve&#039; to retry unresolved file merges or &#039;hg update -C .&#039; to abandon&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The software automatically brings in the changes to foo.F, bar.F, and a2tdep.F (as &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; will show).  However, in our contrived example &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; is subject to changes from both revisions.  Mercurial will attempt to merge automatically, and in this case it fails.  If you edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; you will see it contains the lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 =======&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
which were inserted during the failed merge.  There is also an &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt; file created as a result of the failed merge.  As the output from &amp;lt;code&amp;gt;hg merge&amp;lt;/code&amp;gt; says you can either now resolve this failed merge or use &amp;lt;code&amp;gt;hg update -C&amp;lt;/code&amp;gt; to undo it (the &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; file will remain).&lt;br /&gt;
&lt;br /&gt;
Since we want to resolve the merge we should edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; so that it works.  At a bare minimum we will have to remove the “&amp;lt;code&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&amp;lt;/code&amp;gt;”, “&amp;lt;code&amp;gt;=======&amp;lt;/code&amp;gt;”, and “&amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&amp;lt;/code&amp;gt;” marker lines.  In a more complex situation we might have to completely rewrite this and other files.  This is what I mean when I say that mercurial only provides tools to do merging.  Even a completely successful merge, from mercurial&#039;s point of view, may be completely bogus code.&lt;br /&gt;
&lt;br /&gt;
There are tools available to make this task easier.  For example I use &amp;lt;code&amp;gt;vimdiff&amp;lt;/code&amp;gt;, a part of the popular &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; package.  To enable this I have altered my &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file to look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 merge = vimdiff&lt;br /&gt;
 username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
 &lt;br /&gt;
 [merge-tools]&lt;br /&gt;
 vimdiff.executable = vim&lt;br /&gt;
 vimdiff.args = -d $base $local $output $other +close +close&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
as per http://mercurial.selenic.com/wiki/MergingWithVim.  The page http://mercurial.selenic.com/wiki/MergeProgram contains instructions for other tools, including Emacs, and graphical tools.  If you edit your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file in this way then you now can type &amp;lt;code&amp;gt;hg resolve --all&amp;lt;/code&amp;gt; to run your chosen tool on all unresolved files.  Note that by default if your chosen tool exits without an error then &amp;lt;code&amp;gt;hg resolve&amp;lt;/code&amp;gt; will regard that file as resolved.  To cause &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; to exit with an error use &amp;lt;code&amp;gt;:cq&amp;lt;/code&amp;gt;.  See &amp;lt;code&amp;gt;hg help resolve&amp;lt;/code&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
In the example my resolution is to have the relevant lines in &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 c&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have resolved all the files that mercurial thinks need fixing you should check that the final merged result makes sense.  Checking that it compiles, or runs tests appropriate to both of the original revisions, for example.  When you are satisfied, you should check in the merged revision:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg ci -m &#039;Merged super and duper features&#039;&lt;br /&gt;
 &lt;br /&gt;
 testmerge$ hg tip&lt;br /&gt;
 &lt;br /&gt;
 changeset:   26:857f81e59d66&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      25:13ecff0136c2&lt;br /&gt;
 parent:      24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 13:10:52 2012 +0000&lt;br /&gt;
 summary:     Merged super and new features&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 testmerge$&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the new revision has &#039;&#039;two&#039;&#039; parent revisions; a merge always consumes a head.  This is clear from the output of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -l 4&lt;br /&gt;
 o    changeset:   26:857f81e59d66&lt;br /&gt;
 |\   tag:         tip&lt;br /&gt;
 | |  parent:      25:13ecff0136c2&lt;br /&gt;
 | |  parent:      24:457db23c0b1a&lt;br /&gt;
 | |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 | |  date:        Thu Jan 26 13:10:52 2012 +0000&lt;br /&gt;
 | |  summary:     Merged super and new features&lt;br /&gt;
 | |&lt;br /&gt;
 | o  changeset:   25:13ecff0136c2&lt;br /&gt;
 | |  parent:      23:1de40efd1c4b&lt;br /&gt;
 | |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 | |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 | |  summary:     A test message&lt;br /&gt;
 | |&lt;br /&gt;
 o |  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another example of merging here?  Perhaps Lee&#039;s code merging in changes on official version.&lt;br /&gt;
&lt;br /&gt;
== Tags and named branches (hg tag, hg tags, hg branch, hg branches) ==&lt;br /&gt;
&lt;br /&gt;
It is often useful to give a name to a particular revision.  This might be a changeset that corresponds to a given version of the code, or it might simply be a revision that marks a particular milestone.  In the &amp;lt;code&amp;gt;example-gaussian-repo&amp;lt;/code&amp;gt; you have probably noticed there are revisions in the history with descriptions like &amp;quot;Added tag h13 for changeset 6c81eb8dcbab&amp;quot;.  These are revisions corresponding to particular versions of the Gaussian development version, such as H01, H10, H13, etc.  You can see a list of the tags in a repository by doing:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg tags&lt;br /&gt;
 tip                               26:857f81e59d66&lt;br /&gt;
 h13                               22:6c81eb8dcbab&lt;br /&gt;
 h12p                              20:0ef14d7dff56&lt;br /&gt;
 h11                               18:7daba638a830&lt;br /&gt;
 h10                               16:e1d0af4e84d9&lt;br /&gt;
 h08                               14:656073c38db9&lt;br /&gt;
 h01                               12:737d1720e79a&lt;br /&gt;
 h13-raw                           10:b039f5c274e2&lt;br /&gt;
 h12p-raw                           8:522a8fe79d22&lt;br /&gt;
 h11-raw                            6:a28b789a9555&lt;br /&gt;
 h10-raw                            4:356081dab79d&lt;br /&gt;
 h08-raw                            2:9f69ed4616ad&lt;br /&gt;
 h01-raw                            0:073d6aa63ea7&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(the &amp;lt;code&amp;gt;tip&amp;lt;/code&amp;gt; tag is automatically assigned to the most recently checked in revision).  You may use a tag name anywhere where you might use a revision number, so for example, to check out the changeset corresponding to the official Gaussian development release H10, you would type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg up h10&lt;br /&gt;
 13887 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(this will look different if you have unchecked-in modifications in your working directory).  You could also pass h10 to the &amp;lt;code&amp;gt;hg clone -u&amp;lt;/code&amp;gt; flag, and so on.&lt;br /&gt;
You tag a revision with the &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt; command.  Issue it in a working directory and it will tag the revision that is the parent of the working directory.  Tags become part of the repository, that is they are shared during &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt;, so choose wisely.  If you&#039;d like to have tags that are only part of the local repository, use the &amp;lt;code&amp;gt;-l&amp;lt;/code&amp;gt; flag to &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Tags are stored in an &amp;lt;code&amp;gt;.hgtags&amp;lt;/code&amp;gt; file in the root directory of the repository.  Running &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt; alters this file and then commits the change to the repository.  Sometimes you can see conflicts in this file during merges.  I normally just resolve them by keeping as much information in the merged file as possible.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg branches&amp;lt;/code&amp;gt; command can be used to show the named branches in the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg branches&lt;br /&gt;
 default                       24:13ecff0136c2&lt;br /&gt;
 raw                           11:a0c273aeeb2b (inactive)&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I have two named branches, raw and default (the default branch is, er, the default).  If you examine the full output of &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt;, which is quite long and I won&#039;t reproduce it here, you&#039;ll see, starting at the bottom, revisions 0 to 11 are all in the raw branch.  I have created and named this branch to contain the official Gaussian development code as processed by the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, without any of our makefiles or other alterations.  The default branch branches off from revision 1 and starts at revision 12.  Its descendants, revisions 12 to 23, are also in the default branch.  These were created by starting at revision 1, adding our makefiles and modifications to the build system, renaming this branch to the default branch, and then committing revision 12.  I tagged revision 12 as &amp;quot;H01&amp;quot;, which created revision 13.  I then merged revision 3, fixed the conflicts, and committed revision 14, and so on.  A more detailed guide on how to import a new official version of gdv exists in LINKY.&lt;br /&gt;
&lt;br /&gt;
You can use branch names just like tags wherever mercurial expects a revision identifier.  If you use a branch name mercurial will attempt to give you the revision that is most appropriate, this will usually be the newest head on that branch.&lt;br /&gt;
&lt;br /&gt;
To create a new branch you type &amp;lt;code&amp;gt;hg branch &amp;lt;branchname&amp;gt;&amp;lt;/code&amp;gt;.  This will take effect when you commit the working directory.  As I&#039;ve previously mentioned a simpler alternative to having branches, named or otherwise, in your repository is to have multiple repositories.&lt;br /&gt;
&lt;br /&gt;
== Ignoring files ==&lt;br /&gt;
&lt;br /&gt;
You may be wondering how the system will work when you start compiling files.  Won&#039;t all the &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.exe&amp;lt;/code&amp;gt; files start showing up in the output to &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;?  The answer is that they will not, because I&#039;ve told mercurial to ignore such files.  This information is stored in the &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file in the root of the repository.  It&#039;s quite long but it starts like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 syntax: glob&lt;br /&gt;
 gdv.make&lt;br /&gt;
 *.o&lt;br /&gt;
 *.lo&lt;br /&gt;
 *.a&lt;br /&gt;
 *.exe&lt;br /&gt;
 *.exel&lt;br /&gt;
 .*.swp&lt;br /&gt;
 *~&lt;br /&gt;
 *.log&lt;br /&gt;
 *.log.gz&lt;br /&gt;
 *.chk&lt;br /&gt;
 gdv/arc&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Any file that matches either the shell patterns or the file names in &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; is ignored by mercurial.  This means it does not show up to &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt;, and so on will ignore it unless it is explicitly mentioned on the command line.  So &amp;lt;code&amp;gt;hg add gdv&amp;lt;/code&amp;gt; will add all non-ignored files in the gdv directory, while &amp;lt;code&amp;gt;hg add gdv/*&amp;lt;/code&amp;gt; will add all the files in the gdv directory.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file is tracked, so please only commit changes to it if you think they will be useful to everyone.&lt;br /&gt;
== Other commands ==&lt;br /&gt;
&lt;br /&gt;
There are quite a few other commands available to mercurial, I will cover just a few here, if you&#039;re interested in becoming a power user refer to the documentation I have mentioned.&lt;br /&gt;
&lt;br /&gt;
=== hg addremove ===&lt;br /&gt;
You can use this command when you have large numbers of files to add and remove.  It also includes the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; flag to attempt to detect when files have been moved or copied.  Using this flag does require some subtlety, as it&#039;s not helpful to mark files as moved or copied unless they have been.  Also note that it is possible to inadvertently include ignored files in a mass &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg addremove&amp;lt;/code&amp;gt;; check what&#039;s being added before you commit.&lt;br /&gt;
&lt;br /&gt;
=== hg grep and hg locate ===&lt;br /&gt;
Similar to the standard UNIX grep and locate commands, but cognisant of the mercurial repository.&lt;br /&gt;
&lt;br /&gt;
=== hg init ===&lt;br /&gt;
Creates a new mercurial repository in the current directory&lt;br /&gt;
&lt;br /&gt;
=== hg serve ===&lt;br /&gt;
This starts a mini web server serving information about the repository.  I would strongly recommend you do not use this while working on the Gaussian development version as it would be all too easy to allow any user on the system to view all of the files in your repository.  I only mention it here because some of the other documentation may refer to it.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=251024</id>
		<title>Resgrp:comp-photo-new gdv layout</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=251024"/>
		<updated>2012-03-20T11:50:47Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: /* Developing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Setting up ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Gaussian insists on having its executables not readable by world.  The best way to achieve this is to have a properly set umask; this is a good idea anyway, as having things readable (or writable!) by others is rarely a good idea.  If you need to allow others to view things you can set the permissions explicitly.  One problem here is that the Gaussian makefiles use the csh, which no sane person uses as a shell.  It&#039;s therefore possible that your umask is not being set for the c-shell, which results in world readable files by default.  Fix this permanently by inserting this line into &#039;&#039;both&#039;&#039; &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;~/.cshrc&amp;lt;/code&amp;gt; (you may have to create the latter):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  umask 077&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The new Gaussian development version layout ==&lt;br /&gt;
&lt;br /&gt;
When you first check out a version of gdv from the [[Resgrp:comp-photo-version_control|mercurial repository]] you will notice that the code is laid out in a different format.  Most of the large monolithic files have been broken down into subdirectories with their constituent subroutines split out into individual files.  For example, &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; has been replaced by a &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory containing each &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; subroutine in its own file.  Most of the utility files have been processed similarly.  This layout is primarily to help the functioning of the version control system.  With the old system a modification to a subroutine within &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; would show up only as a change to the file &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, with only line numbers to help you guess what subroutine had actually been altered.  Moving a subroutine from a link file to a utility file would only show up as a deletion of a block of lines from one and an addition of a block of lines to the other.  The new system allows us to immediately see which subroutines have been altered and to track them if they are moved or copied.&lt;br /&gt;
When you check out the repository there are currently three scripts next to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; scripts convert between the two formats.  See [[#Importing your own code|Importing your own code]] for details on &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;.  These will be useful when receiving new tarballs from Gaussian, or converting already written code, or when the time comes to send code back to Gaussian.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; script attempts to get a distribution very close to an old form Gaussian layout, but there will be differences.  Some old-style files are in an arbitrary order which the script does not attempt to recreate.  Fortunately these are not files that we are likely to change.&lt;br /&gt;
The third script, &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt;, takes executables, libraries, and object files from an already compiled version of Gaussian.  It shouldn&#039;t matter whether the previously compiled version is new style or old-style.&lt;br /&gt;
&lt;br /&gt;
== Building from scratch ==&lt;br /&gt;
&lt;br /&gt;
If you choose not to use &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; then you must build from scratch.  This is actually quite quick.  Assuming you have checked out the version you wish to compile, and have loaded the appropriate compiler and Linda modules, you should &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.  Do &#039;&#039;&#039;not&#039;&#039;&#039; run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt;, as this will start the normal Gaussian build system, which will fail.&lt;br /&gt;
&lt;br /&gt;
You will need to set the symbolic link for &amp;lt;code&amp;gt;bsd/gdv.make&amp;lt;/code&amp;gt; to point to the appropriate makefile yourself.  This needs to be one of the modififed makefiles, which are prefixed with &#039;uber&#039;.   The easiest option is just to use &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt; which uses the same options that &amp;lt;code&amp;gt;i386.make&amp;lt;/code&amp;gt; does.  The other &#039;uber-*.make&#039; files are tailored to our particular systems (and therefore we may house them elsewhere in the future), such as the Sandybridge nodes or the Altix.  If you want to modify an existing makefile see the comments [[#The makefile|here]].&lt;br /&gt;
Choose your &#039;uber&#039; makefile (I&#039;ll use the &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt; file here) and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  gdv$ ln -s uber-i386.make bsd/gdv.make&lt;br /&gt;
  gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once there is an uber makefile now set you are ready to use the new build system.  To build the entirety of Gaussian type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make build-tools &amp;amp;&amp;amp; make -j 6 util.a &amp;amp;&amp;amp; make util.a &amp;amp;&amp;amp; make -j 6 exe &amp;amp;&amp;amp; make exe 2&amp;gt;&amp;amp;1 | tee make.log&lt;br /&gt;
 [... lots of output ]&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The number 6 in this example instructs make to run six parallel threads while building.  You can use different numbers depending on how many processors the system you&#039;re building on has, how loaded it is, and so on.  I find that building in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; directory with a relatively unloaded cx1 login node, I can build Gaussian in about 15 minutes.  You&#039;ll notice that after each parallel invocation of make I have a serial invocation at the same time for the same target.  This is because sometimes the parallel make loses track of where it is and doesn&#039;t fully make a target.  The serial invocation should always correct this.&lt;br /&gt;
Once Gaussian is built (and you can always check by seeing that &amp;lt;code&amp;gt;make exe&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;Nothing to be done for: `exe&#039;&amp;lt;/code&amp;gt;) you can also build a Linda version by typing &amp;lt;code&amp;gt;make linda&amp;lt;/code&amp;gt;.  You will need the 8.2 version of the Linda compiler in your path; I suggest this is made into a module.&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory of your freshly checked out repository, type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ ../pillage.sh /home/gaussian-devel/gaussiandvh13_pgi_118/gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for example) wait a while and when the prompt returns you should have a fully populated and up-to-date set of binaries.  &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; touches all the imported libraries and executables so they are newer than the source code.  This means that if you type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make&lt;br /&gt;
 ln -sf browse arc&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
only some trivial things get made.&lt;br /&gt;
&lt;br /&gt;
It&#039;s up to you to make sure that any development you do uses a consistent compiler, Linda compiler, etc, to the pillaged binaries.&lt;br /&gt;
&lt;br /&gt;
== Doing it yourself ==&lt;br /&gt;
&lt;br /&gt;
I did try to make a version of &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; that linked to executables instead of copying them, and you may feel tempted to try the same.  The main problem that you need to overcome is that if the libraries you are linking to are older than their corresponding &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will try to update them.  If the libraries are not yours this will simply fail and cause make to exit.  However, if the symbolically linked libraries are yours they will be updated, which is probably not what you want!&lt;br /&gt;
If you really need to save space there are some easier things you can do.  Starting from an empty repository, run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; and make the build tools as above.  Then copy an appropriate util.a from somewhere to your &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory (do not use &amp;lt;code&amp;gt;cp -p&amp;lt;/code&amp;gt;).  Finally, use make to build only the links you are planning to alter, e.g. &amp;lt;code&amp;gt;make l510.exe&amp;lt;/code&amp;gt;.  You should also alter the Makefile so that the mystuff target lists only these links.  This saves space by not having any of the other links&#039; libraries or executables.  You will also not have any &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files for the util  subroutines; as long as the util.a file is newer than all of the util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will not try to make them.  If, however, even one util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; file becomes newer than util.a make will make &#039;&#039;&#039;all&#039;&#039;&#039; of the util &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files!&lt;br /&gt;
Now you can use the &amp;lt;code&amp;gt;%subst&amp;lt;/code&amp;gt; keyword to Gaussian to tell it to pick up the appropriate links from this directory.&lt;br /&gt;
&lt;br /&gt;
== Developing ==&lt;br /&gt;
&lt;br /&gt;
However you have built the binaries developing in the new system is very simple.  Edit the files you need to change, type &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;make Linda&amp;lt;/code&amp;gt; from the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.   You can also type make inside a link subdirectory, which will build just that link&#039;s executable. The makefile knows about Gaussian&#039;s dependencies, so for example if you change a subroutine in &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; then both &amp;lt;code&amp;gt;l510.exe&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;l1003.exe&amp;lt;/code&amp;gt; will be re-linked (because &amp;lt;code&amp;gt;l1003&amp;lt;/code&amp;gt; depends on &amp;lt;code&amp;gt;l510.a&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
By default the makefile checks everything to see if it&#039;s up-to-date.  As there are nearly 12,000 files in this layout this can take a few seconds, longer if the filesystem is being stressed.  I find that with a hot cache on &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; make takes less than a second to check everything.  With a cold cache on &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; it can take some tens of seconds.  If you want to get make to only check specific executables edit the Makefile in &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt;, uncomment the &amp;quot;mystuff&amp;quot; line, and change it appropriately.  Note, however, that all the util files are always checked.  The makefile is a tracked file in the repository, so please make sure you don&#039;t check in these trivial changes.&lt;br /&gt;
&lt;br /&gt;
You do not need to edit the makefile if you add, move, or delete subroutines.&lt;br /&gt;
&lt;br /&gt;
== Importing your own code ==&lt;br /&gt;
&lt;br /&gt;
If your code is in the old layout, i.e. it&#039;s all monolithic links and utilities just as in the official Gaussian distribution tarball, then use the  &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;  script.  First, check out the version of the development code that was the basis of your code.  Let&#039;s assume you took the H10 code and have been working on that, but have not merged in changes for H11, H12P or H13.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone -u h10 /home/gaussiandevel/example-gaussian-repo /tmp/testrepo&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;or&#039;&#039;&#039;, if you already have a repository checked out, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into it and do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg update h10&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script assumes that you&#039;ve got a &amp;lt;code&amp;gt;gau-fsplit&amp;lt;/code&amp;gt; command in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  If you haven&#039;t, you can create one by building the build-tools, as explained above, and making sure this directory appears, however temporarily, in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  Or, you can point your path to the pre-built binaries in &amp;lt;code&amp;gt;/home/gaussian-devel&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now change directory to be above the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory of your own code.  Run the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, with an argument of the directory you want the new style to appear in (it should not exist):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ cd /path/to/my-code&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv&lt;br /&gt;
 my-code$ PATH=$PATH:/home/gaussian-devel/gaussiandvh10_pgi_105/gdv /tmp/testrepo/old-to-new.sh new-style&lt;br /&gt;
 [...some output...]&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv   new-style&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now remove the gdv directory in the newly checked out working directory and replace it with the one from new-style.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 my-code$ cd /tmp/testrepo&lt;br /&gt;
 testrepo$ rm -fr gdv&lt;br /&gt;
 testrepo$ cp -pr /path/to/mycode/new-style/gdv .&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now you&#039;re ready to use commands like &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; to see what you&#039;ve changed compared to H10, &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt; to check in your changes, &amp;lt;code&amp;gt;hg merge h13&amp;lt;/code&amp;gt; to merge in changes up to version H13 (for example).&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have the entire Gaussian source code in your directory you can get &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; to work by making sure there&#039;s a (possibly empty) file in &amp;lt;code&amp;gt;gdv/bsd/mdl1.F&amp;lt;/code&amp;gt;.  There will be a few warnings but it will split out any files it can find in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
If you just have a few subroutines already split out, then you should just copy them to the appropriate place in the working directory.&lt;br /&gt;
&lt;br /&gt;
This might seem like a pain but you&#039;ll only have to do it once for each version of the code you have!&lt;br /&gt;
&lt;br /&gt;
== The makefile ==&lt;br /&gt;
&lt;br /&gt;
In modifying the Gassian build system I have attempted to balance two competing needs.  The first is a strong desire to modify as little as possible of Gaussian&#039;s original makefiles.  This is so that when we receive newer versions of Gaussian, with their inevitable changes to the makefiles, our modifications can be trivially merged in.  The second is to have a build system that works nicely with the new file layout, which is necessary for the version control system.  The compromise that I have chosen is to have a new Makefile in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory that understand such things as how to build libraries from the split util and link files, and which executables depend on which libraries, while relying on the existing Gaussian makefiles for details such as compiler invocation and flags.&lt;br /&gt;
&lt;br /&gt;
Sadly it was not possible to use the existing Gaussian makefile without modifying it slightly.  This modified version of &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; is called &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.  In it the rules to make most of the libraries and executables are commented out, and a few fixes for other problems are added.  If you wish to compile on another platform you will need to make an uber makefile for that platform.  Base this off the differences between &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you want to add a new link you will need to add it to the Makefile, and possibly to the &amp;lt;code&amp;gt;uber-*&amp;lt;/code&amp;gt; makefile.&lt;br /&gt;
&lt;br /&gt;
== Tools and tricks ==&lt;br /&gt;
&lt;br /&gt;
If you aren&#039;t already using these tools, you should be.&lt;br /&gt;
&lt;br /&gt;
=== Tags ===&lt;br /&gt;
&lt;br /&gt;
One complaint that might arise in going from monolithic link files to split files is that finding the definitions of subroutines and functions becomes much more difficult.  So, if you are editing &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; and are in the MCSCF deck you might come to the line that calls the Davids subroutine.  Finding where this subroutine is defined used to be as simple as searching for &#039;e Davids&#039; (assuming it&#039;s a subroutine, and that there is only one space between subroutine and Davids, and that it&#039;s in &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, etc).  How are you to find it now?&lt;br /&gt;
&lt;br /&gt;
The answer is to use &#039;&#039;&#039;tags&#039;&#039;&#039;.  These have been around for a few decades and are extremely useful.  Firstly you must create a tags file, or files.  For vi/vim you do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv$ ctags *.F */*.F */*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for Emacs substitute etags for ctags).  If you want to create a tags file in one of the link subdirectories just use:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv/l510$ ctags *.F ../*/*.F ../*/*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a ctags (or etags) file in the current directory.  Now, start vi (or Emacs) and edit &amp;lt;code&amp;gt;l510/mcscf.F&amp;lt;/code&amp;gt;.  Find the line that calls the Davids subroutine and position the cursor over the word Davids.  Press &amp;lt;code&amp;gt;Ctrl-]&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-.&amp;lt;/code&amp;gt;) and you will be immediately taken to the definition of that subroutine, even if it’s in another file.  Press &amp;lt;code&amp;gt;Ctrl-T&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-*&amp;lt;/code&amp;gt;) and you&#039;ll be taken back to where you were.  These tags stack, that is you can go into a subroutine, and from there go into another one, and so on, and still be able to back out to the beginning.&lt;br /&gt;
&lt;br /&gt;
You can also start vi (vim really) with the &amp;lt;code&amp;gt;-t &amp;lt;tag&amp;gt;&amp;lt;/code&amp;gt; option to jump immediately to a particular tag.  I don&#039;t know if emacs can do this, as I lost the will to live while browsing the &#039;info&#039; documentation.&lt;br /&gt;
&lt;br /&gt;
Editors other than vi and Emacs also support tags; check the documentation.  If your editor doesn&#039;t support tags it&#039;s just not good enough, sorry.&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
Screen is a terminal multiplexer.  If you wish to have multiple terminals open on a remote system you&#039;re probably accustomed to opening multiple SSH windows from your local system.  An alternative is to use &amp;lt;code&amp;gt;screen&amp;lt;/code&amp;gt;.  It allows you to have multiple windows, each with its own history and possibly executing commands, and switch between them with some simple keypresses.  It also preserves the state of these windows when your connection to screen drops, allowing you to reconnect later.&lt;br /&gt;
&lt;br /&gt;
It&#039;s a bit beyond the scope of this page, if you want to learn more check out the various web resources or it, such as http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=251020</id>
		<title>Resgrp:comp-photo-new gdv layout</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=251020"/>
		<updated>2012-03-20T11:49:30Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: /* Building from scratch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Setting up ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Gaussian insists on having its executables not readable by world.  The best way to achieve this is to have a properly set umask; this is a good idea anyway, as having things readable (or writable!) by others is rarely a good idea.  If you need to allow others to view things you can set the permissions explicitly.  One problem here is that the Gaussian makefiles use the csh, which no sane person uses as a shell.  It&#039;s therefore possible that your umask is not being set for the c-shell, which results in world readable files by default.  Fix this permanently by inserting this line into &#039;&#039;both&#039;&#039; &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;~/.cshrc&amp;lt;/code&amp;gt; (you may have to create the latter):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  umask 077&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The new Gaussian development version layout ==&lt;br /&gt;
&lt;br /&gt;
When you first check out a version of gdv from the [[Resgrp:comp-photo-version_control|mercurial repository]] you will notice that the code is laid out in a different format.  Most of the large monolithic files have been broken down into subdirectories with their constituent subroutines split out into individual files.  For example, &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; has been replaced by a &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory containing each &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; subroutine in its own file.  Most of the utility files have been processed similarly.  This layout is primarily to help the functioning of the version control system.  With the old system a modification to a subroutine within &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; would show up only as a change to the file &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, with only line numbers to help you guess what subroutine had actually been altered.  Moving a subroutine from a link file to a utility file would only show up as a deletion of a block of lines from one and an addition of a block of lines to the other.  The new system allows us to immediately see which subroutines have been altered and to track them if they are moved or copied.&lt;br /&gt;
When you check out the repository there are currently three scripts next to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; scripts convert between the two formats.  See [[#Importing your own code|Importing your own code]] for details on &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;.  These will be useful when receiving new tarballs from Gaussian, or converting already written code, or when the time comes to send code back to Gaussian.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; script attempts to get a distribution very close to an old form Gaussian layout, but there will be differences.  Some old-style files are in an arbitrary order which the script does not attempt to recreate.  Fortunately these are not files that we are likely to change.&lt;br /&gt;
The third script, &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt;, takes executables, libraries, and object files from an already compiled version of Gaussian.  It shouldn&#039;t matter whether the previously compiled version is new style or old-style.&lt;br /&gt;
&lt;br /&gt;
== Building from scratch ==&lt;br /&gt;
&lt;br /&gt;
If you choose not to use &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; then you must build from scratch.  This is actually quite quick.  Assuming you have checked out the version you wish to compile, and have loaded the appropriate compiler and Linda modules, you should &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.  Do &#039;&#039;&#039;not&#039;&#039;&#039; run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt;, as this will start the normal Gaussian build system, which will fail.&lt;br /&gt;
&lt;br /&gt;
You will need to set the symbolic link for &amp;lt;code&amp;gt;bsd/gdv.make&amp;lt;/code&amp;gt; to point to the appropriate makefile yourself.  This needs to be one of the modififed makefiles, which are prefixed with &#039;uber&#039;.   The easiest option is just to use &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt; which uses the same options that &amp;lt;code&amp;gt;i386.make&amp;lt;/code&amp;gt; does.  The other &#039;uber-*.make&#039; files are tailored to our particular systems (and therefore we may house them elsewhere in the future), such as the Sandybridge nodes or the Altix.  If you want to modify an existing makefile see the comments [[#The makefile|here]].&lt;br /&gt;
Choose your &#039;uber&#039; makefile (I&#039;ll use the &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt; file here) and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  gdv$ ln -s uber-i386.make bsd/gdv.make&lt;br /&gt;
  gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once there is an uber makefile now set you are ready to use the new build system.  To build the entirety of Gaussian type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make build-tools &amp;amp;&amp;amp; make -j 6 util.a &amp;amp;&amp;amp; make util.a &amp;amp;&amp;amp; make -j 6 exe &amp;amp;&amp;amp; make exe 2&amp;gt;&amp;amp;1 | tee make.log&lt;br /&gt;
 [... lots of output ]&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The number 6 in this example instructs make to run six parallel threads while building.  You can use different numbers depending on how many processors the system you&#039;re building on has, how loaded it is, and so on.  I find that building in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; directory with a relatively unloaded cx1 login node, I can build Gaussian in about 15 minutes.  You&#039;ll notice that after each parallel invocation of make I have a serial invocation at the same time for the same target.  This is because sometimes the parallel make loses track of where it is and doesn&#039;t fully make a target.  The serial invocation should always correct this.&lt;br /&gt;
Once Gaussian is built (and you can always check by seeing that &amp;lt;code&amp;gt;make exe&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;Nothing to be done for: `exe&#039;&amp;lt;/code&amp;gt;) you can also build a Linda version by typing &amp;lt;code&amp;gt;make linda&amp;lt;/code&amp;gt;.  You will need the 8.2 version of the Linda compiler in your path; I suggest this is made into a module.&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory of your freshly checked out repository, type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ ../pillage.sh /home/gaussian-devel/gaussiandvh13_pgi_118/gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for example) wait a while and when the prompt returns you should have a fully populated and up-to-date set of binaries.  &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; touches all the imported libraries and executables so they are newer than the source code.  This means that if you type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make&lt;br /&gt;
 ln -sf browse arc&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
only some trivial things get made.&lt;br /&gt;
&lt;br /&gt;
It&#039;s up to you to make sure that any development you do uses a consistent compiler, Linda compiler, etc, to the pillaged binaries.&lt;br /&gt;
&lt;br /&gt;
== Doing it yourself ==&lt;br /&gt;
&lt;br /&gt;
I did try to make a version of &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; that linked to executables instead of copying them, and you may feel tempted to try the same.  The main problem that you need to overcome is that if the libraries you are linking to are older than their corresponding &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will try to update them.  If the libraries are not yours this will simply fail and cause make to exit.  However, if the symbolically linked libraries are yours they will be updated, which is probably not what you want!&lt;br /&gt;
If you really need to save space there are some easier things you can do.  Starting from an empty repository, run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; and make the build tools as above.  Then copy an appropriate util.a from somewhere to your &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory (do not use &amp;lt;code&amp;gt;cp -p&amp;lt;/code&amp;gt;).  Finally, use make to build only the links you are planning to alter, e.g. &amp;lt;code&amp;gt;make l510.exe&amp;lt;/code&amp;gt;.  You should also alter the Makefile so that the mystuff target lists only these links.  This saves space by not having any of the other links&#039; libraries or executables.  You will also not have any &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files for the util  subroutines; as long as the util.a file is newer than all of the util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will not try to make them.  If, however, even one util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; file becomes newer than util.a make will make &#039;&#039;&#039;all&#039;&#039;&#039; of the util &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files!&lt;br /&gt;
Now you can use the &amp;lt;code&amp;gt;%subst&amp;lt;/code&amp;gt; keyword to Gaussian to tell it to pick up the appropriate links from this directory.&lt;br /&gt;
&lt;br /&gt;
== Developing ==&lt;br /&gt;
&lt;br /&gt;
However you have built the binaries developing in the new system is very simple.  Edit the files you need to change, type &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;make Linda&amp;lt;/code&amp;gt; from the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.   You can also type make inside a link subdirectory, which will build just that link&#039;s executable. The makefile knows about Gaussian&#039;s dependencies, so for example if you change a subroutine in &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; then both &amp;lt;code&amp;gt;l510.exe&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;l1003.exe&amp;lt;/code&amp;gt; will be re-linked.&lt;br /&gt;
&lt;br /&gt;
By default the makefile checks everything to see if it&#039;s up-to-date.  As there are nearly 12,000 files in this layout this can take a few seconds, longer if the filesystem is being stressed.  I find that with a hot cache on &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; make takes less than a second to check everything.  With a cold cache on &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; it can take some tens of seconds.  If you want to get make to only check specific executables edit the Makefile in &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt;, uncomment the &amp;quot;mystuff&amp;quot; line, and change it appropriately.  Note, however, that all the util files are always checked.  The makefile is a tracked file in the repository, so please make sure you don&#039;t check in these trivial changes.&lt;br /&gt;
&lt;br /&gt;
You do not need to edit the makefile if you add, move, or delete subroutines.&lt;br /&gt;
&lt;br /&gt;
== Importing your own code ==&lt;br /&gt;
&lt;br /&gt;
If your code is in the old layout, i.e. it&#039;s all monolithic links and utilities just as in the official Gaussian distribution tarball, then use the  &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;  script.  First, check out the version of the development code that was the basis of your code.  Let&#039;s assume you took the H10 code and have been working on that, but have not merged in changes for H11, H12P or H13.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone -u h10 /home/gaussiandevel/example-gaussian-repo /tmp/testrepo&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;or&#039;&#039;&#039;, if you already have a repository checked out, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into it and do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg update h10&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script assumes that you&#039;ve got a &amp;lt;code&amp;gt;gau-fsplit&amp;lt;/code&amp;gt; command in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  If you haven&#039;t, you can create one by building the build-tools, as explained above, and making sure this directory appears, however temporarily, in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  Or, you can point your path to the pre-built binaries in &amp;lt;code&amp;gt;/home/gaussian-devel&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now change directory to be above the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory of your own code.  Run the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, with an argument of the directory you want the new style to appear in (it should not exist):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ cd /path/to/my-code&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv&lt;br /&gt;
 my-code$ PATH=$PATH:/home/gaussian-devel/gaussiandvh10_pgi_105/gdv /tmp/testrepo/old-to-new.sh new-style&lt;br /&gt;
 [...some output...]&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv   new-style&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now remove the gdv directory in the newly checked out working directory and replace it with the one from new-style.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 my-code$ cd /tmp/testrepo&lt;br /&gt;
 testrepo$ rm -fr gdv&lt;br /&gt;
 testrepo$ cp -pr /path/to/mycode/new-style/gdv .&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now you&#039;re ready to use commands like &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; to see what you&#039;ve changed compared to H10, &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt; to check in your changes, &amp;lt;code&amp;gt;hg merge h13&amp;lt;/code&amp;gt; to merge in changes up to version H13 (for example).&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have the entire Gaussian source code in your directory you can get &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; to work by making sure there&#039;s a (possibly empty) file in &amp;lt;code&amp;gt;gdv/bsd/mdl1.F&amp;lt;/code&amp;gt;.  There will be a few warnings but it will split out any files it can find in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
If you just have a few subroutines already split out, then you should just copy them to the appropriate place in the working directory.&lt;br /&gt;
&lt;br /&gt;
This might seem like a pain but you&#039;ll only have to do it once for each version of the code you have!&lt;br /&gt;
&lt;br /&gt;
== The makefile ==&lt;br /&gt;
&lt;br /&gt;
In modifying the Gassian build system I have attempted to balance two competing needs.  The first is a strong desire to modify as little as possible of Gaussian&#039;s original makefiles.  This is so that when we receive newer versions of Gaussian, with their inevitable changes to the makefiles, our modifications can be trivially merged in.  The second is to have a build system that works nicely with the new file layout, which is necessary for the version control system.  The compromise that I have chosen is to have a new Makefile in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory that understand such things as how to build libraries from the split util and link files, and which executables depend on which libraries, while relying on the existing Gaussian makefiles for details such as compiler invocation and flags.&lt;br /&gt;
&lt;br /&gt;
Sadly it was not possible to use the existing Gaussian makefile without modifying it slightly.  This modified version of &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; is called &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.  In it the rules to make most of the libraries and executables are commented out, and a few fixes for other problems are added.  If you wish to compile on another platform you will need to make an uber makefile for that platform.  Base this off the differences between &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you want to add a new link you will need to add it to the Makefile, and possibly to the &amp;lt;code&amp;gt;uber-*&amp;lt;/code&amp;gt; makefile.&lt;br /&gt;
&lt;br /&gt;
== Tools and tricks ==&lt;br /&gt;
&lt;br /&gt;
If you aren&#039;t already using these tools, you should be.&lt;br /&gt;
&lt;br /&gt;
=== Tags ===&lt;br /&gt;
&lt;br /&gt;
One complaint that might arise in going from monolithic link files to split files is that finding the definitions of subroutines and functions becomes much more difficult.  So, if you are editing &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; and are in the MCSCF deck you might come to the line that calls the Davids subroutine.  Finding where this subroutine is defined used to be as simple as searching for &#039;e Davids&#039; (assuming it&#039;s a subroutine, and that there is only one space between subroutine and Davids, and that it&#039;s in &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, etc).  How are you to find it now?&lt;br /&gt;
&lt;br /&gt;
The answer is to use &#039;&#039;&#039;tags&#039;&#039;&#039;.  These have been around for a few decades and are extremely useful.  Firstly you must create a tags file, or files.  For vi/vim you do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv$ ctags *.F */*.F */*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for Emacs substitute etags for ctags).  If you want to create a tags file in one of the link subdirectories just use:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv/l510$ ctags *.F ../*/*.F ../*/*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a ctags (or etags) file in the current directory.  Now, start vi (or Emacs) and edit &amp;lt;code&amp;gt;l510/mcscf.F&amp;lt;/code&amp;gt;.  Find the line that calls the Davids subroutine and position the cursor over the word Davids.  Press &amp;lt;code&amp;gt;Ctrl-]&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-.&amp;lt;/code&amp;gt;) and you will be immediately taken to the definition of that subroutine, even if it’s in another file.  Press &amp;lt;code&amp;gt;Ctrl-T&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-*&amp;lt;/code&amp;gt;) and you&#039;ll be taken back to where you were.  These tags stack, that is you can go into a subroutine, and from there go into another one, and so on, and still be able to back out to the beginning.&lt;br /&gt;
&lt;br /&gt;
You can also start vi (vim really) with the &amp;lt;code&amp;gt;-t &amp;lt;tag&amp;gt;&amp;lt;/code&amp;gt; option to jump immediately to a particular tag.  I don&#039;t know if emacs can do this, as I lost the will to live while browsing the &#039;info&#039; documentation.&lt;br /&gt;
&lt;br /&gt;
Editors other than vi and Emacs also support tags; check the documentation.  If your editor doesn&#039;t support tags it&#039;s just not good enough, sorry.&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
Screen is a terminal multiplexer.  If you wish to have multiple terminals open on a remote system you&#039;re probably accustomed to opening multiple SSH windows from your local system.  An alternative is to use &amp;lt;code&amp;gt;screen&amp;lt;/code&amp;gt;.  It allows you to have multiple windows, each with its own history and possibly executing commands, and switch between them with some simple keypresses.  It also preserves the state of these windows when your connection to screen drops, allowing you to reconnect later.&lt;br /&gt;
&lt;br /&gt;
It&#039;s a bit beyond the scope of this page, if you want to learn more check out the various web resources or it, such as http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=251018</id>
		<title>Resgrp:comp-photo-new gdv layout</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=251018"/>
		<updated>2012-03-20T11:47:49Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Setting up ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Gaussian insists on having its executables not readable by world.  The best way to achieve this is to have a properly set umask; this is a good idea anyway, as having things readable (or writable!) by others is rarely a good idea.  If you need to allow others to view things you can set the permissions explicitly.  One problem here is that the Gaussian makefiles use the csh, which no sane person uses as a shell.  It&#039;s therefore possible that your umask is not being set for the c-shell, which results in world readable files by default.  Fix this permanently by inserting this line into &#039;&#039;both&#039;&#039; &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;~/.cshrc&amp;lt;/code&amp;gt; (you may have to create the latter):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  umask 077&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The new Gaussian development version layout ==&lt;br /&gt;
&lt;br /&gt;
When you first check out a version of gdv from the [[Resgrp:comp-photo-version_control|mercurial repository]] you will notice that the code is laid out in a different format.  Most of the large monolithic files have been broken down into subdirectories with their constituent subroutines split out into individual files.  For example, &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; has been replaced by a &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory containing each &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; subroutine in its own file.  Most of the utility files have been processed similarly.  This layout is primarily to help the functioning of the version control system.  With the old system a modification to a subroutine within &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; would show up only as a change to the file &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, with only line numbers to help you guess what subroutine had actually been altered.  Moving a subroutine from a link file to a utility file would only show up as a deletion of a block of lines from one and an addition of a block of lines to the other.  The new system allows us to immediately see which subroutines have been altered and to track them if they are moved or copied.&lt;br /&gt;
When you check out the repository there are currently three scripts next to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; scripts convert between the two formats.  See [[#Importing your own code|Importing your own code]] for details on &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;.  These will be useful when receiving new tarballs from Gaussian, or converting already written code, or when the time comes to send code back to Gaussian.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; script attempts to get a distribution very close to an old form Gaussian layout, but there will be differences.  Some old-style files are in an arbitrary order which the script does not attempt to recreate.  Fortunately these are not files that we are likely to change.&lt;br /&gt;
The third script, &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt;, takes executables, libraries, and object files from an already compiled version of Gaussian.  It shouldn&#039;t matter whether the previously compiled version is new style or old-style.&lt;br /&gt;
&lt;br /&gt;
== Building from scratch ==&lt;br /&gt;
&lt;br /&gt;
If you choose not to use &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; then you must build from scratch.  This is actually quite quick.  Assuming you have checked out the version you wish to compile, and have loaded the appropriate compiler and Linda modules, you should &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.  Do &#039;&#039;&#039;not&#039;&#039;&#039; run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt;, as this will start the normal Gaussian build system, which will fail.&lt;br /&gt;
&lt;br /&gt;
You will need to set the symbolic link for &amp;lt;code&amp;gt;bsd/gdv.make&amp;lt;/code&amp;gt; to point to the appropriate makefile yourself.  This needs to be one of the modififed makefiles, which are prefixed with &#039;uber&#039;.   The easiest option is just to use &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt; which uses the same options that &amp;lt;code&amp;gt;i386.make&amp;lt;/code&amp;gt; does.  The other &#039;uber-*.make&#039; files are tailored to our particular systems (and therefore we may house them elsewhere in the future), such as the Sandybridge nodes or the Altix.  If you want to modify an existing makefile see the comments [[#The makefile|here]].&lt;br /&gt;
Choose your &#039;uber&#039; makefile (I&#039;ll use the &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt; file here) and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  gdv$ ln -s uber-i386.make bsd/gdv.make&lt;br /&gt;
  gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once there is an uber makefile now set you are now ready to use the new build system.  To build the entirety of Gaussian type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make build-tools &amp;amp;&amp;amp; make -j 6 util.a &amp;amp;&amp;amp; make util.a &amp;amp;&amp;amp; make -j 6 exe &amp;amp;&amp;amp; make exe 2&amp;gt;&amp;amp;1 | tee make.log&lt;br /&gt;
 [... lots of output ]&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The number 6 in this example instructs make to run six parallel threads while building.  You can use different numbers depending on how many processors the system you&#039;re building on has, how loaded it is, and so on.  I find that building in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; directory with a relatively unloaded cx1 login node, I can build Gaussian in about 15 minutes.  You&#039;ll notice that after each parallel invocation of make I have a serial invocation at the same time for the same target.  This is because sometimes the parallel make loses track of where it is and doesn&#039;t fully make a target.  The serial invocation should always correct this.&lt;br /&gt;
Once Gaussian is built (and you can always check by seeing that &amp;lt;code&amp;gt;make exe&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;Nothing to be done for: `exe&#039;&amp;lt;/code&amp;gt;) you can also build a Linda version by typing &amp;lt;code&amp;gt;make linda&amp;lt;/code&amp;gt;.  You will need the 8.2 version of the Linda compiler in your path; I suggest this is made into a module.&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory of your freshly checked out repository, type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ ../pillage.sh /home/gaussian-devel/gaussiandvh13_pgi_118/gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for example) wait a while and when the prompt returns you should have a fully populated and up-to-date set of binaries.  &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; touches all the imported libraries and executables so they are newer than the source code.  This means that if you type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make&lt;br /&gt;
 ln -sf browse arc&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
only some trivial things get made.&lt;br /&gt;
&lt;br /&gt;
It&#039;s up to you to make sure that any development you do uses a consistent compiler, Linda compiler, etc, to the pillaged binaries.&lt;br /&gt;
&lt;br /&gt;
== Doing it yourself ==&lt;br /&gt;
&lt;br /&gt;
I did try to make a version of &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; that linked to executables instead of copying them, and you may feel tempted to try the same.  The main problem that you need to overcome is that if the libraries you are linking to are older than their corresponding &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will try to update them.  If the libraries are not yours this will simply fail and cause make to exit.  However, if the symbolically linked libraries are yours they will be updated, which is probably not what you want!&lt;br /&gt;
If you really need to save space there are some easier things you can do.  Starting from an empty repository, run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; and make the build tools as above.  Then copy an appropriate util.a from somewhere to your &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory (do not use &amp;lt;code&amp;gt;cp -p&amp;lt;/code&amp;gt;).  Finally, use make to build only the links you are planning to alter, e.g. &amp;lt;code&amp;gt;make l510.exe&amp;lt;/code&amp;gt;.  You should also alter the Makefile so that the mystuff target lists only these links.  This saves space by not having any of the other links&#039; libraries or executables.  You will also not have any &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files for the util  subroutines; as long as the util.a file is newer than all of the util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will not try to make them.  If, however, even one util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; file becomes newer than util.a make will make &#039;&#039;&#039;all&#039;&#039;&#039; of the util &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files!&lt;br /&gt;
Now you can use the &amp;lt;code&amp;gt;%subst&amp;lt;/code&amp;gt; keyword to Gaussian to tell it to pick up the appropriate links from this directory.&lt;br /&gt;
&lt;br /&gt;
== Developing ==&lt;br /&gt;
&lt;br /&gt;
However you have built the binaries developing in the new system is very simple.  Edit the files you need to change, type &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;make Linda&amp;lt;/code&amp;gt; from the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.   You can also type make inside a link subdirectory, which will build just that link&#039;s executable. The makefile knows about Gaussian&#039;s dependencies, so for example if you change a subroutine in &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; then both &amp;lt;code&amp;gt;l510.exe&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;l1003.exe&amp;lt;/code&amp;gt; will be re-linked.&lt;br /&gt;
&lt;br /&gt;
By default the makefile checks everything to see if it&#039;s up-to-date.  As there are nearly 12,000 files in this layout this can take a few seconds, longer if the filesystem is being stressed.  I find that with a hot cache on &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; make takes less than a second to check everything.  With a cold cache on &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; it can take some tens of seconds.  If you want to get make to only check specific executables edit the Makefile in &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt;, uncomment the &amp;quot;mystuff&amp;quot; line, and change it appropriately.  Note, however, that all the util files are always checked.  The makefile is a tracked file in the repository, so please make sure you don&#039;t check in these trivial changes.&lt;br /&gt;
&lt;br /&gt;
You do not need to edit the makefile if you add, move, or delete subroutines.&lt;br /&gt;
&lt;br /&gt;
== Importing your own code ==&lt;br /&gt;
&lt;br /&gt;
If your code is in the old layout, i.e. it&#039;s all monolithic links and utilities just as in the official Gaussian distribution tarball, then use the  &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;  script.  First, check out the version of the development code that was the basis of your code.  Let&#039;s assume you took the H10 code and have been working on that, but have not merged in changes for H11, H12P or H13.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone -u h10 /home/gaussiandevel/example-gaussian-repo /tmp/testrepo&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;or&#039;&#039;&#039;, if you already have a repository checked out, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into it and do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg update h10&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script assumes that you&#039;ve got a &amp;lt;code&amp;gt;gau-fsplit&amp;lt;/code&amp;gt; command in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  If you haven&#039;t, you can create one by building the build-tools, as explained above, and making sure this directory appears, however temporarily, in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  Or, you can point your path to the pre-built binaries in &amp;lt;code&amp;gt;/home/gaussian-devel&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now change directory to be above the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory of your own code.  Run the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, with an argument of the directory you want the new style to appear in (it should not exist):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ cd /path/to/my-code&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv&lt;br /&gt;
 my-code$ PATH=$PATH:/home/gaussian-devel/gaussiandvh10_pgi_105/gdv /tmp/testrepo/old-to-new.sh new-style&lt;br /&gt;
 [...some output...]&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv   new-style&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now remove the gdv directory in the newly checked out working directory and replace it with the one from new-style.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 my-code$ cd /tmp/testrepo&lt;br /&gt;
 testrepo$ rm -fr gdv&lt;br /&gt;
 testrepo$ cp -pr /path/to/mycode/new-style/gdv .&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now you&#039;re ready to use commands like &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; to see what you&#039;ve changed compared to H10, &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt; to check in your changes, &amp;lt;code&amp;gt;hg merge h13&amp;lt;/code&amp;gt; to merge in changes up to version H13 (for example).&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have the entire Gaussian source code in your directory you can get &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; to work by making sure there&#039;s a (possibly empty) file in &amp;lt;code&amp;gt;gdv/bsd/mdl1.F&amp;lt;/code&amp;gt;.  There will be a few warnings but it will split out any files it can find in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
If you just have a few subroutines already split out, then you should just copy them to the appropriate place in the working directory.&lt;br /&gt;
&lt;br /&gt;
This might seem like a pain but you&#039;ll only have to do it once for each version of the code you have!&lt;br /&gt;
&lt;br /&gt;
== The makefile ==&lt;br /&gt;
&lt;br /&gt;
In modifying the Gassian build system I have attempted to balance two competing needs.  The first is a strong desire to modify as little as possible of Gaussian&#039;s original makefiles.  This is so that when we receive newer versions of Gaussian, with their inevitable changes to the makefiles, our modifications can be trivially merged in.  The second is to have a build system that works nicely with the new file layout, which is necessary for the version control system.  The compromise that I have chosen is to have a new Makefile in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory that understand such things as how to build libraries from the split util and link files, and which executables depend on which libraries, while relying on the existing Gaussian makefiles for details such as compiler invocation and flags.&lt;br /&gt;
&lt;br /&gt;
Sadly it was not possible to use the existing Gaussian makefile without modifying it slightly.  This modified version of &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; is called &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.  In it the rules to make most of the libraries and executables are commented out, and a few fixes for other problems are added.  If you wish to compile on another platform you will need to make an uber makefile for that platform.  Base this off the differences between &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you want to add a new link you will need to add it to the Makefile, and possibly to the &amp;lt;code&amp;gt;uber-*&amp;lt;/code&amp;gt; makefile.&lt;br /&gt;
&lt;br /&gt;
== Tools and tricks ==&lt;br /&gt;
&lt;br /&gt;
If you aren&#039;t already using these tools, you should be.&lt;br /&gt;
&lt;br /&gt;
=== Tags ===&lt;br /&gt;
&lt;br /&gt;
One complaint that might arise in going from monolithic link files to split files is that finding the definitions of subroutines and functions becomes much more difficult.  So, if you are editing &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; and are in the MCSCF deck you might come to the line that calls the Davids subroutine.  Finding where this subroutine is defined used to be as simple as searching for &#039;e Davids&#039; (assuming it&#039;s a subroutine, and that there is only one space between subroutine and Davids, and that it&#039;s in &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, etc).  How are you to find it now?&lt;br /&gt;
&lt;br /&gt;
The answer is to use &#039;&#039;&#039;tags&#039;&#039;&#039;.  These have been around for a few decades and are extremely useful.  Firstly you must create a tags file, or files.  For vi/vim you do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv$ ctags *.F */*.F */*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for Emacs substitute etags for ctags).  If you want to create a tags file in one of the link subdirectories just use:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv/l510$ ctags *.F ../*/*.F ../*/*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a ctags (or etags) file in the current directory.  Now, start vi (or Emacs) and edit &amp;lt;code&amp;gt;l510/mcscf.F&amp;lt;/code&amp;gt;.  Find the line that calls the Davids subroutine and position the cursor over the word Davids.  Press &amp;lt;code&amp;gt;Ctrl-]&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-.&amp;lt;/code&amp;gt;) and you will be immediately taken to the definition of that subroutine, even if it’s in another file.  Press &amp;lt;code&amp;gt;Ctrl-T&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-*&amp;lt;/code&amp;gt;) and you&#039;ll be taken back to where you were.  These tags stack, that is you can go into a subroutine, and from there go into another one, and so on, and still be able to back out to the beginning.&lt;br /&gt;
&lt;br /&gt;
You can also start vi (vim really) with the &amp;lt;code&amp;gt;-t &amp;lt;tag&amp;gt;&amp;lt;/code&amp;gt; option to jump immediately to a particular tag.  I don&#039;t know if emacs can do this, as I lost the will to live while browsing the &#039;info&#039; documentation.&lt;br /&gt;
&lt;br /&gt;
Editors other than vi and Emacs also support tags; check the documentation.  If your editor doesn&#039;t support tags it&#039;s just not good enough, sorry.&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
Screen is a terminal multiplexer.  If you wish to have multiple terminals open on a remote system you&#039;re probably accustomed to opening multiple SSH windows from your local system.  An alternative is to use &amp;lt;code&amp;gt;screen&amp;lt;/code&amp;gt;.  It allows you to have multiple windows, each with its own history and possibly executing commands, and switch between them with some simple keypresses.  It also preserves the state of these windows when your connection to screen drops, allowing you to reconnect later.&lt;br /&gt;
&lt;br /&gt;
It&#039;s a bit beyond the scope of this page, if you want to learn more check out the various web resources or it, such as http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=238619</id>
		<title>Resgrp:comp-photo-new gdv layout</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=238619"/>
		<updated>2012-02-29T10:59:58Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: /* Tags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Setting up ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Gaussian insists on having its executables not readable by world.  The best way to achieve this is to have a properly set umask; this is a good idea anyway, as having things readable (or writable!) by others is rarely a good idea.  If you need to allow others to view things you can set the permissions explicitly.  One problem here is that the Gaussian makefiles use the csh, which no sane person uses as a shell.  It&#039;s therefore possible that your umask is not being set for the c-shell, which results in world readable files by default.  Fix this permanently by inserting this line into &#039;&#039;both&#039;&#039; &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;~/.cshrc&amp;lt;/code&amp;gt; (you may have to create the latter):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  umask 077&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The new Gaussian development version layout ==&lt;br /&gt;
&lt;br /&gt;
When you first check out a version of gdv from the [[Resgrp:comp-photo-version_control|mercurial repository]] you will notice that the code is laid out in a different format.  Most of the large monolithic files have been broken down into subdirectories with their constituent subroutines split out into individual files.  For example, &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; has been replaced by a &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory containing each &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; subroutine in its own file.  Most of the utility files have been processed similarly.  This layout is primarily to help the functioning of the version control system.  With the old system a modification to a subroutine within &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; would show up only as a change to the file &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, with only line numbers to help you guess what subroutine had actually been altered.  Moving a subroutine from a link file to a utility file would only show up as a deletion of a block of lines from one and an addition of a block of lines to the other.  The new system allows us to immediately see which subroutines have been altered and to track them if they are moved or copied.&lt;br /&gt;
When you check out the repository there are currently three scripts next to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; scripts convert between the two formats.  See [[#Importing your own code|Importing your own code]] for details on &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;.  These will be useful when receiving new tarballs from Gaussian, or converting already written code, or when the time comes to send code back to Gaussian.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; script attempts to get a distribution very close to an old form Gaussian layout, but there will be differences.  Some old-style files are in an arbitrary order which the script does not attempt to recreate.  Fortunately these are not files that we are likely to change.&lt;br /&gt;
The third script, &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt;, takes executables, libraries, and object files from an already compiled version of Gaussian.  It shouldn&#039;t matter whether the previously compiled version is new style or old-style.&lt;br /&gt;
Building from scratch.&lt;br /&gt;
If you choose not to use &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; then you must build from scratch.  This is actually quite quick.  Assuming you have checked out the version you wish to compile, and have loaded the appropriate compiler and Linda modules, you should &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ bsd/bldgdv&lt;br /&gt;
 ...[lots#s of output]...&lt;br /&gt;
 echo Currrently gdv.make points to: i386.make&lt;br /&gt;
 Currrently gdv.make points to: i386.make&lt;br /&gt;
 if ( -f bsd/uber-i386.make ) then&lt;br /&gt;
 rm -f bsd/gdv.make&lt;br /&gt;
 ln -s uber-i386.make bsd/gdv.make&lt;br /&gt;
 echo Changing gdv.make to point to bsd/uber-i386.make&lt;br /&gt;
 Changing gdv.make to point to bsd/uber-i386.make&lt;br /&gt;
 endif&lt;br /&gt;
 exit 1&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The modified &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; script terminates almost immediately.  It will do the usual Gaussian setting up of the built environment, including setting the symbolic link for &amp;lt;code&amp;gt;bsd/gdv.make&amp;lt;/code&amp;gt; to point to the appropriate makefile.  However our modification will cause it to look for an &amp;quot;uber-&amp;quot; prefixed version of that makefile.  The uber here means that there is one make file over the entire subdirectory.  At the time of writing there is only one uber- prefixed makefile and that is &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt;.  The modifications to make an uber- makefile are quite simple, and are covered [[#The makefile|later]].&lt;br /&gt;
&lt;br /&gt;
Provided there is an uber makefile now set you are now ready to use the new build system.  To build the entirety of Gaussian type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make build-tools &amp;amp;&amp;amp; make -j 6 util.a &amp;amp;&amp;amp; make util.a &amp;amp;&amp;amp; make -j 6 exe &amp;amp;&amp;amp; make exe 2&amp;gt;&amp;amp;1 | tee make.log&lt;br /&gt;
 [... lots of output ]&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The number 6 in this example instructs make to run six parallel threads while building.  You can use different numbers depending on how many processors the system you&#039;re building on has, how loaded it is, and so on.  I find that building in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; directory with a relatively unloaded cx1 login node, I can build Gaussian in about 15 minutes.  You&#039;ll notice that after each parallel invocation of make I have a serial invocation at the same time for the same target.  This is because sometimes the parallel make loses track of where it is and doesn&#039;t fully make a target.  The serial invocation should always correct this.&lt;br /&gt;
Once Gaussian is built (and you can always check by seeing that &amp;lt;code&amp;gt;make exe&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;Nothing to be done for: `exe&#039;&amp;lt;/code&amp;gt;) you can also build a Linda version by typing &amp;lt;code&amp;gt;make linda&amp;lt;/code&amp;gt;.  You will need the 8.2 version of the Linda compiler in your path; I suggest this is made into a module.&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory of your freshly checked out repository, type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ ../pillage.sh /home/gaussian-devel/gaussiandvh13_pgi_118/gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for example) wait a while and when the prompt returns you should have a fully populated and up-to-date set of binaries.  &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; touches all the imported libraries and executables so they are newer than the source code.  This means that if you type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make&lt;br /&gt;
 ln -sf browse arc&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
only some trivial things get made.&lt;br /&gt;
&lt;br /&gt;
It&#039;s up to you to make sure that any development you do uses a consistent compiler, Linda compiler, etc, to the pillaged binaries.&lt;br /&gt;
&lt;br /&gt;
== Doing it yourself ==&lt;br /&gt;
&lt;br /&gt;
I did try to make a version of &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; that linked to executables instead of copying them, and you may feel tempted to try the same.  The main problem that you need to overcome is that if the libraries you are linking to are older than their corresponding &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will try to update them.  If the libraries are not yours this will simply fail and cause make to exit.  However, if the symbolically linked libraries are yours they will be updated, which is probably not what you want!&lt;br /&gt;
If you really need to save space there are some easier things you can do.  Starting from an empty repository, run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; and make the build tools as above.  Then copy an appropriate util.a from somewhere to your &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory (do not use &amp;lt;code&amp;gt;cp -p&amp;lt;/code&amp;gt;).  Finally, use make to build only the links you are planning to alter, e.g. &amp;lt;code&amp;gt;make l510.exe&amp;lt;/code&amp;gt;.  You should also alter the Makefile so that the mystuff target lists only these links.  This saves space by not having any of the other links&#039; libraries or executables.  You will also not have any &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files for the util  subroutines; as long as the util.a file is newer than all of the util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will not try to make them.  If, however, even one util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; file becomes newer than util.a make will make &#039;&#039;&#039;all&#039;&#039;&#039; of the util &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files!&lt;br /&gt;
Now you can use the &amp;lt;code&amp;gt;%subst&amp;lt;/code&amp;gt; keyword to Gaussian to tell it to pick up the appropriate links from this directory.&lt;br /&gt;
&lt;br /&gt;
== Developing ==&lt;br /&gt;
&lt;br /&gt;
However you have built the binaries developing in the new system is very simple.  Edit the files you need to change, type &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;make Linda&amp;lt;/code&amp;gt; from the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.   You can also type make inside a link subdirectory, which will build just that link&#039;s executable. The makefile knows about Gaussian&#039;s dependencies, so for example if you change a subroutine in &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; then both &amp;lt;code&amp;gt;l510.exe&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;l1003.exe&amp;lt;/code&amp;gt; will be re-linked.&lt;br /&gt;
&lt;br /&gt;
By default the makefile checks everything to see if it&#039;s up-to-date.  As there are nearly 12,000 files in this layout this can take a few seconds, longer if the filesystem is being stressed.  I find that with a hot cache on &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; make takes less than a second to check everything.  With a cold cache on &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; it can take some tens of seconds.  If you want to get make to only check specific executables edit the Makefile in &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt;, uncomment the &amp;quot;mystuff&amp;quot; line, and change it appropriately.  Note, however, that all the util files are always checked.  The makefile is a tracked file in the repository, so please make sure you don&#039;t check in these trivial changes.&lt;br /&gt;
&lt;br /&gt;
You do not need to edit the makefile if you add, move, or delete subroutines.&lt;br /&gt;
&lt;br /&gt;
== Importing your own code ==&lt;br /&gt;
&lt;br /&gt;
If your code is in the old layout, i.e. it&#039;s all monolithic links and utilities just as in the official Gaussian distribution tarball, then use the  &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;  script.  First, check out the version of the development code that was the basis of your code.  Let&#039;s assume you took the H10 code and have been working on that, but have not merged in changes for H11, H12P or H13.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone -u h10 /home/gaussiandevel/example-gaussian-repo /tmp/testrepo&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;or&#039;&#039;&#039;, if you already have a repository checked out, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into it and do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg update h10&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script assumes that you&#039;ve got a &amp;lt;code&amp;gt;gau-fsplit&amp;lt;/code&amp;gt; command in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  If you haven&#039;t, you can create one by building the build-tools, as explained above, and making sure this directory appears, however temporarily, in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  Or, you can point your path to the pre-built binaries in &amp;lt;code&amp;gt;/home/gaussian-devel&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now change directory to be above the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory of your own code.  Run the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, with an argument of the directory you want the new style to appear in (it should not exist):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ cd /path/to/my-code&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv&lt;br /&gt;
 my-code$ PATH=$PATH:/home/gaussian-devel/gaussiandvh10_pgi_105/gdv /tmp/testrepo/old-to-new.sh new-style&lt;br /&gt;
 [...some output...]&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv   new-style&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now remove the gdv directory in the newly checked out working directory and replace it with the one from new-style.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 my-code$ cd /tmp/testrepo&lt;br /&gt;
 testrepo$ rm -fr gdv&lt;br /&gt;
 testrepo$ cp -pr /path/to/mycode/new-style/gdv .&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now you&#039;re ready to use commands like &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; to see what you&#039;ve changed compared to H10, &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt; to check in your changes, &amp;lt;code&amp;gt;hg merge h13&amp;lt;/code&amp;gt; to merge in changes up to version H13 (for example).&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have the entire Gaussian source code in your directory you can get &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; to work by making sure there&#039;s a (possibly empty) file in &amp;lt;code&amp;gt;gdv/bsd/mdl1.F&amp;lt;/code&amp;gt;.  There will be a few warnings but it will split out any files it can find in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
If you just have a few subroutines already split out, then you should just copy them to the appropriate place in the working directory.&lt;br /&gt;
&lt;br /&gt;
This might seem like a pain but you&#039;ll only have to do it once for each version of the code you have!&lt;br /&gt;
&lt;br /&gt;
== The makefile ==&lt;br /&gt;
&lt;br /&gt;
In modifying the Gassian build system I have attempted to balance two competing needs.  The first is a strong desire to modify as little as possible of Gaussian&#039;s original makefiles.  This is so that when we receive newer versions of Gaussian, with their inevitable changes to the makefiles, our modifications can be trivially merged in.  The second is to have a build system that works nicely with the new file layout, which is necessary for the version control system.  The compromise that I have chosen is to have a new Makefile in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory that understand such things as how to build libraries from the split util and link files, and which executables depend on which libraries, while relying on the existing Gaussian makefiles for details such as compiler invocation and flags.&lt;br /&gt;
&lt;br /&gt;
Sadly it was not possible to use the existing Gaussian makefile without modifying it slightly.  This modified version of &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; is called &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.  In it the rules to make most of the libraries and executables are commented out, and a few fixes for other problems are added.  If you wish to compile on another platform you will need to make an uber makefile for that platform.  Base this off the differences between &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you want to add a new link you will need to add it to the Makefile, and possibly to the &amp;lt;code&amp;gt;uber-*&amp;lt;/code&amp;gt; makefile.&lt;br /&gt;
&lt;br /&gt;
== Tools and tricks ==&lt;br /&gt;
&lt;br /&gt;
If you aren&#039;t already using these tools, you should be.&lt;br /&gt;
&lt;br /&gt;
=== Tags ===&lt;br /&gt;
&lt;br /&gt;
One complaint that might arise in going from monolithic link files to split files is that finding the definitions of subroutines and functions becomes much more difficult.  So, if you are editing &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; and are in the MCSCF deck you might come to the line that calls the Davids subroutine.  Finding where this subroutine is defined used to be as simple as searching for &#039;e Davids&#039; (assuming it&#039;s a subroutine, and that there is only one space between subroutine and Davids, and that it&#039;s in &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, etc).  How are you to find it now?&lt;br /&gt;
&lt;br /&gt;
The answer is to use &#039;&#039;&#039;tags&#039;&#039;&#039;.  These have been around for a few decades and are extremely useful.  Firstly you must create a tags file, or files.  For vi/vim you do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv$ ctags *.F */*.F */*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for Emacs substitute etags for ctags).  If you want to create a tags file in one of the link subdirectories just use:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv/l510$ ctags *.F ../*/*.F ../*/*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a ctags (or etags) file in the current directory.  Now, start vi (or Emacs) and edit &amp;lt;code&amp;gt;l510/mcscf.F&amp;lt;/code&amp;gt;.  Find the line that calls the Davids subroutine and position the cursor over the word Davids.  Press &amp;lt;code&amp;gt;Ctrl-]&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-.&amp;lt;/code&amp;gt;) and you will be immediately taken to the definition of that subroutine, even if it’s in another file.  Press &amp;lt;code&amp;gt;Ctrl-T&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-*&amp;lt;/code&amp;gt;) and you&#039;ll be taken back to where you were.  These tags stack, that is you can go into a subroutine, and from there go into another one, and so on, and still be able to back out to the beginning.&lt;br /&gt;
&lt;br /&gt;
You can also start vi (vim really) with the &amp;lt;code&amp;gt;-t &amp;lt;tag&amp;gt;&amp;lt;/code&amp;gt; option to jump immediately to a particular tag.  I don&#039;t know if emacs can do this, as I lost the will to live while browsing the &#039;info&#039; documentation.&lt;br /&gt;
&lt;br /&gt;
Editors other than vi and Emacs also support tags; check the documentation.  If your editor doesn&#039;t support tags it&#039;s just not good enough, sorry.&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
Screen is a terminal multiplexer.  If you wish to have multiple terminals open on a remote system you&#039;re probably accustomed to opening multiple SSH windows from your local system.  An alternative is to use &amp;lt;code&amp;gt;screen&amp;lt;/code&amp;gt;.  It allows you to have multiple windows, each with its own history and possibly executing commands, and switch between them with some simple keypresses.  It also preserves the state of these windows when your connection to screen drops, allowing you to reconnect later.&lt;br /&gt;
&lt;br /&gt;
It&#039;s a bit beyond the scope of this page, if you want to learn more check out the various web resources or it, such as http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=237723</id>
		<title>Resgrp:comp-photo-new gdv layout</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=237723"/>
		<updated>2012-02-27T10:20:43Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Setting up ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Gaussian insists on having its executables not readable by world.  The best way to achieve this is to have a properly set umask; this is a good idea anyway, as having things readable (or writable!) by others is rarely a good idea.  If you need to allow others to view things you can set the permissions explicitly.  One problem here is that the Gaussian makefiles use the csh, which no sane person uses as a shell.  It&#039;s therefore possible that your umask is not being set for the c-shell, which results in world readable files by default.  Fix this permanently by inserting this line into &#039;&#039;both&#039;&#039; &amp;lt;code&amp;gt;~/.bashrc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;~/.cshrc&amp;lt;/code&amp;gt; (you may have to create the latter):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
  umask 077&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The new Gaussian development version layout ==&lt;br /&gt;
&lt;br /&gt;
When you first check out a version of gdv from the [[Resgrp:comp-photo-version_control|mercurial repository]] you will notice that the code is laid out in a different format.  Most of the large monolithic files have been broken down into subdirectories with their constituent subroutines split out into individual files.  For example, &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; has been replaced by a &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory containing each &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; subroutine in its own file.  Most of the utility files have been processed similarly.  This layout is primarily to help the functioning of the version control system.  With the old system a modification to a subroutine within &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; would show up only as a change to the file &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, with only line numbers to help you guess what subroutine had actually been altered.  Moving a subroutine from a link file to a utility file would only show up as a deletion of a block of lines from one and an addition of a block of lines to the other.  The new system allows us to immediately see which subroutines have been altered and to track them if they are moved or copied.&lt;br /&gt;
When you check out the repository there are currently three scripts next to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; scripts convert between the two formats.  See [[#Importing your own code|Importing your own code]] for details on &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;.  These will be useful when receiving new tarballs from Gaussian, or converting already written code, or when the time comes to send code back to Gaussian.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; script attempts to get a distribution very close to an old form Gaussian layout, but there will be differences.  Some old-style files are in an arbitrary order which the script does not attempt to recreate.  Fortunately these are not files that we are likely to change.&lt;br /&gt;
The third script, &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt;, takes executables, libraries, and object files from an already compiled version of Gaussian.  It shouldn&#039;t matter whether the previously compiled version is new style or old-style.&lt;br /&gt;
Building from scratch.&lt;br /&gt;
If you choose not to use &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; then you must build from scratch.  This is actually quite quick.  Assuming you have checked out the version you wish to compile, and have loaded the appropriate compiler and Linda modules, you should &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ bsd/bldgdv&lt;br /&gt;
 ...[lots#s of output]...&lt;br /&gt;
 echo Currrently gdv.make points to: i386.make&lt;br /&gt;
 Currrently gdv.make points to: i386.make&lt;br /&gt;
 if ( -f bsd/uber-i386.make ) then&lt;br /&gt;
 rm -f bsd/gdv.make&lt;br /&gt;
 ln -s uber-i386.make bsd/gdv.make&lt;br /&gt;
 echo Changing gdv.make to point to bsd/uber-i386.make&lt;br /&gt;
 Changing gdv.make to point to bsd/uber-i386.make&lt;br /&gt;
 endif&lt;br /&gt;
 exit 1&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The modified &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; script terminates almost immediately.  It will do the usual Gaussian setting up of the built environment, including setting the symbolic link for &amp;lt;code&amp;gt;bsd/gdv.make&amp;lt;/code&amp;gt; to point to the appropriate makefile.  However our modification will cause it to look for an &amp;quot;uber-&amp;quot; prefixed version of that makefile.  The uber here means that there is one make file over the entire subdirectory.  At the time of writing there is only one uber- prefixed makefile and that is &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt;.  The modifications to make an uber- makefile are quite simple, and are covered [[#The makefile|later]].&lt;br /&gt;
&lt;br /&gt;
Provided there is an uber makefile now set you are now ready to use the new build system.  To build the entirety of Gaussian type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make build-tools &amp;amp;&amp;amp; make -j 6 util.a &amp;amp;&amp;amp; make util.a &amp;amp;&amp;amp; make -j 6 exe &amp;amp;&amp;amp; make exe 2&amp;gt;&amp;amp;1 | tee make.log&lt;br /&gt;
 [... lots of output ]&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The number 6 in this example instructs make to run six parallel threads while building.  You can use different numbers depending on how many processors the system you&#039;re building on has, how loaded it is, and so on.  I find that building in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; directory with a relatively unloaded cx1 login node, I can build Gaussian in about 15 minutes.  You&#039;ll notice that after each parallel invocation of make I have a serial invocation at the same time for the same target.  This is because sometimes the parallel make loses track of where it is and doesn&#039;t fully make a target.  The serial invocation should always correct this.&lt;br /&gt;
Once Gaussian is built (and you can always check by seeing that &amp;lt;code&amp;gt;make exe&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;Nothing to be done for: `exe&#039;&amp;lt;/code&amp;gt;) you can also build a Linda version by typing &amp;lt;code&amp;gt;make linda&amp;lt;/code&amp;gt;.  You will need the 8.2 version of the Linda compiler in your path; I suggest this is made into a module.&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory of your freshly checked out repository, type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ ../pillage.sh /home/gaussian-devel/gaussiandvh13_pgi_118/gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for example) wait a while and when the prompt returns you should have a fully populated and up-to-date set of binaries.  &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; touches all the imported libraries and executables so they are newer than the source code.  This means that if you type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make&lt;br /&gt;
 ln -sf browse arc&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
only some trivial things get made.&lt;br /&gt;
&lt;br /&gt;
It&#039;s up to you to make sure that any development you do uses a consistent compiler, Linda compiler, etc, to the pillaged binaries.&lt;br /&gt;
&lt;br /&gt;
== Doing it yourself ==&lt;br /&gt;
&lt;br /&gt;
I did try to make a version of &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; that linked to executables instead of copying them, and you may feel tempted to try the same.  The main problem that you need to overcome is that if the libraries you are linking to are older than their corresponding &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will try to update them.  If the libraries are not yours this will simply fail and cause make to exit.  However, if the symbolically linked libraries are yours they will be updated, which is probably not what you want!&lt;br /&gt;
If you really need to save space there are some easier things you can do.  Starting from an empty repository, run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; and make the build tools as above.  Then copy an appropriate util.a from somewhere to your &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory (do not use &amp;lt;code&amp;gt;cp -p&amp;lt;/code&amp;gt;).  Finally, use make to build only the links you are planning to alter, e.g. &amp;lt;code&amp;gt;make l510.exe&amp;lt;/code&amp;gt;.  You should also alter the Makefile so that the mystuff target lists only these links.  This saves space by not having any of the other links&#039; libraries or executables.  You will also not have any &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files for the util  subroutines; as long as the util.a file is newer than all of the util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will not try to make them.  If, however, even one util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; file becomes newer than util.a make will make &#039;&#039;&#039;all&#039;&#039;&#039; of the util &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files!&lt;br /&gt;
Now you can use the &amp;lt;code&amp;gt;%subst&amp;lt;/code&amp;gt; keyword to Gaussian to tell it to pick up the appropriate links from this directory.&lt;br /&gt;
&lt;br /&gt;
== Developing ==&lt;br /&gt;
&lt;br /&gt;
However you have built the binaries developing in the new system is very simple.  Edit the files you need to change, type &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;make Linda&amp;lt;/code&amp;gt; from the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.   You can also type make inside a link subdirectory, which will build just that link&#039;s executable. The makefile knows about Gaussian&#039;s dependencies, so for example if you change a subroutine in &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; then both &amp;lt;code&amp;gt;l510.exe&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;l1003.exe&amp;lt;/code&amp;gt; will be re-linked.&lt;br /&gt;
&lt;br /&gt;
By default the makefile checks everything to see if it&#039;s up-to-date.  As there are nearly 12,000 files in this layout this can take a few seconds, longer if the filesystem is being stressed.  I find that with a hot cache on &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; make takes less than a second to check everything.  With a cold cache on &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; it can take some tens of seconds.  If you want to get make to only check specific executables edit the Makefile in &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt;, uncomment the &amp;quot;mystuff&amp;quot; line, and change it appropriately.  Note, however, that all the util files are always checked.  The makefile is a tracked file in the repository, so please make sure you don&#039;t check in these trivial changes.&lt;br /&gt;
&lt;br /&gt;
You do not need to edit the makefile if you add, move, or delete subroutines.&lt;br /&gt;
&lt;br /&gt;
== Importing your own code ==&lt;br /&gt;
&lt;br /&gt;
If your code is in the old layout, i.e. it&#039;s all monolithic links and utilities just as in the official Gaussian distribution tarball, then use the  &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;  script.  First, check out the version of the development code that was the basis of your code.  Let&#039;s assume you took the H10 code and have been working on that, but have not merged in changes for H11, H12P or H13.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone -u h10 /home/gaussiandevel/example-gaussian-repo /tmp/testrepo&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;or&#039;&#039;&#039;, if you already have a repository checked out, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into it and do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg update h10&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script assumes that you&#039;ve got a &amp;lt;code&amp;gt;gau-fsplit&amp;lt;/code&amp;gt; command in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  If you haven&#039;t, you can create one by building the build-tools, as explained above, and making sure this directory appears, however temporarily, in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  Or, you can point your path to the pre-built binaries in &amp;lt;code&amp;gt;/home/gaussian-devel&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now change directory to be above the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory of your own code.  Run the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, with an argument of the directory you want the new style to appear in (it should not exist):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ cd /path/to/my-code&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv&lt;br /&gt;
 my-code$ PATH=$PATH:/home/gaussian-devel/gaussiandvh10_pgi_105/gdv /tmp/testrepo/old-to-new.sh new-style&lt;br /&gt;
 [...some output...]&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv   new-style&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now remove the gdv directory in the newly checked out working directory and replace it with the one from new-style.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 my-code$ cd /tmp/testrepo&lt;br /&gt;
 testrepo$ rm -fr gdv&lt;br /&gt;
 testrepo$ cp -pr /path/to/mycode/new-style/gdv .&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now you&#039;re ready to use commands like &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; to see what you&#039;ve changed compared to H10, &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt; to check in your changes, &amp;lt;code&amp;gt;hg merge h13&amp;lt;/code&amp;gt; to merge in changes up to version H13 (for example).&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have the entire Gaussian source code in your directory you can get &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; to work by making sure there&#039;s a (possibly empty) file in &amp;lt;code&amp;gt;gdv/bsd/mdl1.F&amp;lt;/code&amp;gt;.  There will be a few warnings but it will split out any files it can find in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
If you just have a few subroutines already split out, then you should just copy them to the appropriate place in the working directory.&lt;br /&gt;
&lt;br /&gt;
This might seem like a pain but you&#039;ll only have to do it once for each version of the code you have!&lt;br /&gt;
&lt;br /&gt;
== The makefile ==&lt;br /&gt;
&lt;br /&gt;
In modifying the Gassian build system I have attempted to balance two competing needs.  The first is a strong desire to modify as little as possible of Gaussian&#039;s original makefiles.  This is so that when we receive newer versions of Gaussian, with their inevitable changes to the makefiles, our modifications can be trivially merged in.  The second is to have a build system that works nicely with the new file layout, which is necessary for the version control system.  The compromise that I have chosen is to have a new Makefile in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory that understand such things as how to build libraries from the split util and link files, and which executables depend on which libraries, while relying on the existing Gaussian makefiles for details such as compiler invocation and flags.&lt;br /&gt;
&lt;br /&gt;
Sadly it was not possible to use the existing Gaussian makefile without modifying it slightly.  This modified version of &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; is called &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.  In it the rules to make most of the libraries and executables are commented out, and a few fixes for other problems are added.  If you wish to compile on another platform you will need to make an uber makefile for that platform.  Base this off the differences between &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you want to add a new link you will need to add it to the Makefile, and possibly to the &amp;lt;code&amp;gt;uber-*&amp;lt;/code&amp;gt; makefile.&lt;br /&gt;
&lt;br /&gt;
== Tools and tricks ==&lt;br /&gt;
&lt;br /&gt;
If you aren&#039;t already using these tools, you should be.&lt;br /&gt;
&lt;br /&gt;
=== Tags ===&lt;br /&gt;
&lt;br /&gt;
One complaint that might arise in going from monolithic link files to split files is that finding the definitions of subroutines and functions becomes much more difficult.  So, if you are editing &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; and are in the MCSCF deck you might come to the line that calls the Davids subroutine.  Finding where this subroutine is defined used to be as simple as searching for &#039;e Davids&#039; (assuming it&#039;s a subroutine, and that there is only one space between subroutine and Davids, and that it&#039;s in &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, etc).  How are you to find it now?&lt;br /&gt;
&lt;br /&gt;
The answer is to use &#039;&#039;&#039;tags&#039;&#039;&#039;.  These have been around for a few decades and are extremely useful.  Firstly you must create a tags file, or files.  For vi/vim you do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv$ ctags *.F */*.F */*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for Emacs substitute etags for ctags).  If you want to create a tags file in one of the link subdirectories just use:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv/l510$ ctags *.F ../*/*.F ../*/*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a ctags (or etags) file in the current directory.  Now, start vi (or Emacs) and edit &amp;lt;code&amp;gt;l510/mcscf.F&amp;lt;/code&amp;gt;.  Find the line that calls the Davids subroutine and position the cursor over the word Davids.  Press &amp;lt;code&amp;gt;Ctrl-]&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-.&amp;lt;/code&amp;gt;) and you will be immediately taken to the definition of that subroutine, even if it’s in another file.  Press &amp;lt;code&amp;gt;Ctrl-T&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-*&amp;lt;/code&amp;gt;) and you&#039;ll be taken back to where you were.  These tags stack, that is you can go into a subroutine, and from there go into another one, and so on, and still be able to back out to the beginning.&lt;br /&gt;
&lt;br /&gt;
Editors other than vi and Emacs also support tags; check the documentation.  If your editor doesn&#039;t support tags it&#039;s just not good enough, sorry.&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
Screen is a terminal multiplexer.  If you wish to have multiple terminals open on a remote system you&#039;re probably accustomed to opening multiple SSH windows from your local system.  An alternative is to use &amp;lt;code&amp;gt;screen&amp;lt;/code&amp;gt;.  It allows you to have multiple windows, each with its own history and possibly executing commands, and switch between them with some simple keypresses.  It also preserves the state of these windows when your connection to screen drops, allowing you to reconnect later.&lt;br /&gt;
&lt;br /&gt;
It&#039;s a bit beyond the scope of this page, if you want to learn more check out the various web resources or it, such as http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=230406</id>
		<title>Resgrp:comp-photo-new gdv layout</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=230406"/>
		<updated>2012-02-08T12:28:29Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== The new Gaussian development version layout ==&lt;br /&gt;
&lt;br /&gt;
When you first check out a version of gdv from the [[Resgrp:comp-photo-version_control|mercurial repository]] you will notice that the code is laid out in a different format.  Most of the large monolithic files have been broken down into subdirectories with their constituent subroutines split out into individual files.  For example, &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; has been replaced by a &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory containing each &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; subroutine in its own file.  Most of the utility files have been processed similarly.  This layout is primarily to help the functioning of the version control system.  With the old system a modification to a subroutine within &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; would show up only as a change to the file &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, with only line numbers to help you guess what subroutine had actually been altered.  Moving a subroutine from a link file to a utility file would only show up as a deletion of a block of lines from one and an addition of a block of lines to the other.  The new system allows us to immediately see which subroutines have been altered and to track them if they are moved or copied.&lt;br /&gt;
When you check out the repository there are currently three scripts next to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; scripts convert between the two formats.  See [[#Importing your own code|Importing your own code]] for details on &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;.  These will be useful when receiving new tarballs from Gaussian, or converting already written code, or when the time comes to send code back to Gaussian.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; script attempts to get a distribution very close to an old form Gaussian layout, but there will be differences.  Some old-style files are in an arbitrary order which the script does not attempt to recreate.  Fortunately these are not files that we are likely to change.&lt;br /&gt;
The third script, &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt;, takes executables, libraries, and object files from an already compiled version of Gaussian.  It shouldn&#039;t matter whether the previously compiled version is new style or old-style.&lt;br /&gt;
Building from scratch.&lt;br /&gt;
If you choose not to use &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; then you must build from scratch.  This is actually quite quick.  Assuming you have checked out the version you wish to compile, and have loaded the appropriate compiler and Linda modules, you should &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ bsd/bldgdv&lt;br /&gt;
 ...[lots#s of output]...&lt;br /&gt;
 echo Currrently gdv.make points to: i386.make&lt;br /&gt;
 Currrently gdv.make points to: i386.make&lt;br /&gt;
 if ( -f bsd/uber-i386.make ) then&lt;br /&gt;
 rm -f bsd/gdv.make&lt;br /&gt;
 ln -s uber-i386.make bsd/gdv.make&lt;br /&gt;
 echo Changing gdv.make to point to bsd/uber-i386.make&lt;br /&gt;
 Changing gdv.make to point to bsd/uber-i386.make&lt;br /&gt;
 endif&lt;br /&gt;
 exit 1&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The modified &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; script terminates almost immediately.  It will do the usual Gaussian setting up of the built environment, including setting the symbolic link for &amp;lt;code&amp;gt;bsd/gdv.make&amp;lt;/code&amp;gt; to point to the appropriate makefile.  However our modification will cause it to look for an &amp;quot;uber-&amp;quot; prefixed version of that makefile.  The uber here means that there is one make file over the entire subdirectory.  At the time of writing there is only one uber- prefixed makefile and that is &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt;.  The modifications to make an uber- makefile are quite simple, and are covered [[#The makefile|later]].&lt;br /&gt;
&lt;br /&gt;
Provided there is an uber makefile now set you are now ready to use the new build system.  To build the entirety of Gaussian type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make build-tools &amp;amp;&amp;amp; make -j 6 util.a &amp;amp;&amp;amp; make util.a &amp;amp;&amp;amp; make -j 6 exe &amp;amp;&amp;amp; make exe 2&amp;gt;&amp;amp;1 | tee make.log&lt;br /&gt;
 [... lots of output ]&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The number 6 in this example instructs make to run six parallel threads while building.  You can use different numbers depending on how many processors the system you&#039;re building on has, how loaded it is, and so on.  I find that building in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; directory with a relatively unloaded cx1 login node, I can build Gaussian in about 15 minutes.  You&#039;ll notice that after each parallel invocation of make I have a serial invocation at the same time for the same target.  This is because sometimes the parallel make loses track of where it is and doesn&#039;t fully make a target.  The serial invocation should always correct this.&lt;br /&gt;
Once Gaussian is built (and you can always check by seeing that &amp;lt;code&amp;gt;make exe&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;Nothing to be done for: `exe&#039;&amp;lt;/code&amp;gt;) you can also build a Linda version by typing &amp;lt;code&amp;gt;make linda&amp;lt;/code&amp;gt;.  You will need the 8.2 version of the Linda compiler in your path; I suggest this is made into a module.&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory of your freshly checked out repository, type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ ../pillage.sh /home/gaussian-devel/gaussiandvh13_pgi_118/gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for example) wait a while and when the prompt returns you should have a fully populated and up-to-date set of binaries.  &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; touches all the imported libraries and executables so they are newer than the source code.  This means that if you type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make&lt;br /&gt;
 ln -sf browse arc&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
only some trivial things get made.&lt;br /&gt;
&lt;br /&gt;
It&#039;s up to you to make sure that any development you do uses a consistent compiler, Linda compiler, etc, to the pillaged binaries.&lt;br /&gt;
&lt;br /&gt;
== Doing it yourself ==&lt;br /&gt;
&lt;br /&gt;
I did try to make a version of &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; that linked to executables instead of copying them, and you may feel tempted to try the same.  The main problem that you need to overcome is that if the libraries you are linking to are older than their corresponding &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will try to update them.  If the libraries are not yours this will simply fail and cause make to exit.  However, if the symbolically linked libraries are yours they will be updated, which is probably not what you want!&lt;br /&gt;
If you really need to save space there are some easier things you can do.  Starting from an empty repository, run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; and make the build tools as above.  Then copy an appropriate util.a from somewhere to your &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory (do not use &amp;lt;code&amp;gt;cp -p&amp;lt;/code&amp;gt;).  Finally, use make to build only the links you are planning to alter, e.g. &amp;lt;code&amp;gt;make l510.exe&amp;lt;/code&amp;gt;.  You should also alter the Makefile so that the mystuff target lists only these links.  This saves space by not having any of the other links&#039; libraries or executables.  You will also not have any &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files for the util  subroutines; as long as the util.a file is newer than all of the util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will not try to make them.  If, however, even one util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; file becomes newer than util.a make will make &#039;&#039;&#039;all&#039;&#039;&#039; of the util &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files!&lt;br /&gt;
Now you can use the &amp;lt;code&amp;gt;%subst&amp;lt;/code&amp;gt; keyword to Gaussian to tell it to pick up the appropriate links from this directory.&lt;br /&gt;
&lt;br /&gt;
== Developing ==&lt;br /&gt;
&lt;br /&gt;
However you have built the binaries developing in the new system is very simple.  Edit the files you need to change, type &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;make Linda&amp;lt;/code&amp;gt; from the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.   You can also type make inside a link subdirectory, which will build just that link&#039;s executable. The makefile knows about Gaussian&#039;s dependencies, so for example if you change a subroutine in &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; then both &amp;lt;code&amp;gt;l510.exe&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;l1003.exe&amp;lt;/code&amp;gt; will be re-linked.&lt;br /&gt;
&lt;br /&gt;
By default the makefile checks everything to see if it&#039;s up-to-date.  As there are nearly 12,000 files in this layout this can take a few seconds, longer if the filesystem is being stressed.  I find that with a hot cache on &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; make takes less than a second to check everything.  With a cold cache on &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; it can take some tens of seconds.  If you want to get make to only check specific executables edit the Makefile in &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt;, uncomment the &amp;quot;mystuff&amp;quot; line, and change it appropriately.  Note, however, that all the util files are always checked.  The makefile is a tracked file in the repository, so please make sure you don&#039;t check in these trivial changes.&lt;br /&gt;
&lt;br /&gt;
You do not need to edit the makefile if you add, move, or delete subroutines.&lt;br /&gt;
&lt;br /&gt;
== Importing your own code ==&lt;br /&gt;
&lt;br /&gt;
If your code is in the old layout, i.e. it&#039;s all monolithic links and utilities just as in the official Gaussian distribution tarball, then use the  &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt;  script.  First, check out the version of the development code that was the basis of your code.  Let&#039;s assume you took the H10 code and have been working on that, but have not merged in changes for H11, H12P or H13.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone -u h10 /home/gaussiandevel/example-gaussian-repo /tmp/testrepo&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;or&#039;&#039;&#039;, if you already have a repository checked out, &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into it and do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg update h10&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script assumes that you&#039;ve got a &amp;lt;code&amp;gt;gau-fsplit&amp;lt;/code&amp;gt; command in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  If you haven&#039;t, you can create one by building the build-tools, as explained above, and making sure this directory appears, however temporarily, in your &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;.  Or, you can point your path to the pre-built binaries in &amp;lt;code&amp;gt;/home/gaussian-devel&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Now change directory to be above the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory of your own code.  Run the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, with an argument of the directory you want the new style to appear in (it should not exist):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ cd /path/to/my-code&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv&lt;br /&gt;
 my-code$ PATH=$PATH:/home/gaussian-devel/gaussiandvh10_pgi_105/gdv /tmp/testrepo/old-to-new.sh new-style&lt;br /&gt;
 [...some output...]&lt;br /&gt;
 my-code$ ls&lt;br /&gt;
 gdv   new-style&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now remove the gdv directory in the newly checked out working directory and replace it with the one from new-style.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 my-code$ cd /tmp/testrepo&lt;br /&gt;
 testrepo$ rm -fr gdv&lt;br /&gt;
 testrepo$ cp -pr /path/to/mycode/new-style/gdv .&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Now you&#039;re ready to use commands like &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; to see what you&#039;ve changed compared to H10, &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt; to check in your changes, &amp;lt;code&amp;gt;hg merge h13&amp;lt;/code&amp;gt; to merge in changes up to version H13 (for example).&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t have the entire Gaussian source code in your directory you can get &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; to work by making sure there&#039;s a (possibly empty) file in &amp;lt;code&amp;gt;gdv/bsd/mdl1.F&amp;lt;/code&amp;gt;.  There will be a few warnings but it will split out any files it can find in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
If you just have a few subroutines already split out, then you should just copy them to the appropriate place in the working directory.&lt;br /&gt;
&lt;br /&gt;
This might seem like a pain but you&#039;ll only have to do it once for each version of the code you have!&lt;br /&gt;
&lt;br /&gt;
== The makefile ==&lt;br /&gt;
&lt;br /&gt;
In modifying the Gassian build system I have attempted to balance two competing needs.  The first is a strong desire to modify as little as possible of Gaussian&#039;s original makefiles.  This is so that when we receive newer versions of Gaussian, with their inevitable changes to the makefiles, our modifications can be trivially merged in.  The second is to have a build system that works nicely with the new file layout, which is necessary for the version control system.  The compromise that I have chosen is to have a new Makefile in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory that understand such things as how to build libraries from the split util and link files, and which executables depend on which libraries, while relying on the existing Gaussian makefiles for details such as compiler invocation and flags.&lt;br /&gt;
&lt;br /&gt;
Sadly it was not possible to use the existing Gaussian makefile without modifying it slightly.  This modified version of &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; is called &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.  In it the rules to make most of the libraries and executables are commented out, and a few fixes for other problems are added.  If you wish to compile on another platform you will need to make an uber makefile for that platform.  Base this off the differences between &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you want to add a new link you will need to add it to the Makefile, and possibly to the &amp;lt;code&amp;gt;uber-*&amp;lt;/code&amp;gt; makefile.&lt;br /&gt;
&lt;br /&gt;
== Tools and tricks ==&lt;br /&gt;
&lt;br /&gt;
If you aren&#039;t already using these tools, you should be.&lt;br /&gt;
&lt;br /&gt;
=== Tags ===&lt;br /&gt;
&lt;br /&gt;
One complaint that might arise in going from monolithic link files to split files is that finding the definitions of subroutines and functions becomes much more difficult.  So, if you are editing &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; and are in the MCSCF deck you might come to the line that calls the Davids subroutine.  Finding where this subroutine is defined used to be as simple as searching for &#039;e Davids&#039; (assuming it&#039;s a subroutine, and that there is only one space between subroutine and Davids, and that it&#039;s in &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, etc).  How are you to find it now?&lt;br /&gt;
&lt;br /&gt;
The answer is to use &#039;&#039;&#039;tags&#039;&#039;&#039;.  These have been around for a few decades and are extremely useful.  Firstly you must create a tags file, or files.  For vi/vim you do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv$ ctags *.F */*.F */*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for Emacs substitute etags for ctags).  If you want to create a tags file in one of the link subdirectories just use:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv/l510$ ctags *.F ../*/*.F ../*/*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a ctags (or etags) file in the current directory.  Now, start vi (or Emacs) and edit &amp;lt;code&amp;gt;l510/mcscf.F&amp;lt;/code&amp;gt;.  Find the line that calls the Davids subroutine and position the cursor over the word Davids.  Press &amp;lt;code&amp;gt;Ctrl-]&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-.&amp;lt;/code&amp;gt;) and you will be immediately taken to the definition of that subroutine, even if it’s in another file.  Press &amp;lt;code&amp;gt;Ctrl-T&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-*&amp;lt;/code&amp;gt;) and you&#039;ll be taken back to where you were.  These tags stack, that is you can go into a subroutine, and from there go into another one, and so on, and still be able to back out to the beginning.&lt;br /&gt;
&lt;br /&gt;
Editors other than vi and Emacs also support tags; check the documentation.  If your editor doesn&#039;t support tags it&#039;s just not good enough, sorry.&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
Screen is a terminal multiplexer.  If you wish to have multiple terminals open on a remote system you&#039;re probably accustomed to opening multiple SSH windows from your local system.  An alternative is to use &amp;lt;code&amp;gt;screen&amp;lt;/code&amp;gt;.  It allows you to have multiple windows, each with its own history and possibly executing commands, and switch between them with some simple keypresses.  It also preserves the state of these windows when your connection to screen drops, allowing you to reconnect later.&lt;br /&gt;
&lt;br /&gt;
It&#039;s a bit beyond the scope of this page, if you want to learn more check out the various web resources or it, such as http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=230153</id>
		<title>Resgrp:comp-photo-new gdv layout</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-new_gdv_layout&amp;diff=230153"/>
		<updated>2012-02-07T17:08:29Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: Created page with &amp;quot;== The new Gaussian development version layout ==  When you first check out a version of gdv from the mercurial repository you will notice t...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== The new Gaussian development version layout ==&lt;br /&gt;
&lt;br /&gt;
When you first check out a version of gdv from the [[Resgrp:comp-photo-version_control|mercurial repository]] you will notice that the code is laid out in a different format.  Most of the large monolithic files have been broken down into subdirectories with their constituent subroutines split out into individual files.  For example, &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; has been replaced by a &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory containing each &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; subroutine in its own file.  Most of the utility files have been processed similarly.  This layout is primarily to help the functioning of the version control system.  With the old system a modification to a subroutine within &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; would show up only as a change to the file &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, with only line numbers to help you guess what subroutine had actually been altered.  Moving a subroutine from a link file to a utility file would only show up as a deletion of a block of lines from one and an addition of a block of lines to the other.  The new system allows us to immediately see which subroutines have been altered and to track them if they are moved or copied.&lt;br /&gt;
When you check out the repository there are currently three scripts next to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; scripts convert between the two formats.  These will be useful when receiving new tarballs from Gaussian, or converting already written code, or when the time comes to send code back to Gaussian.  The &amp;lt;code&amp;gt;new-to-old.sh&amp;lt;/code&amp;gt; script attempts to get a distribution very close to an old form Gaussian layout, but there will be differences.  Some old-style files are in an arbitrary order which the script does not attempt to recreate.  Fortunately these are not files that we are likely to change.&lt;br /&gt;
The third script, &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt;, takes executables, libraries, and object files from an already compiled version of Gaussian.  It shouldn&#039;t matter whether the previously compiled version is new style or old-style.&lt;br /&gt;
Building from scratch.&lt;br /&gt;
If you choose not to use &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; then you must build from scratch.  This is actually quite quick.  Assuming you have checked out the version you wish to compile, and have loaded the appropriate compiler and Linda modules, you should &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ bsd/bldgdv&lt;br /&gt;
 ...[lots#s of output]...&lt;br /&gt;
 echo Currrently gdv.make points to: i386.make&lt;br /&gt;
 Currrently gdv.make points to: i386.make&lt;br /&gt;
 if ( -f bsd/uber-i386.make ) then&lt;br /&gt;
 rm -f bsd/gdv.make&lt;br /&gt;
 ln -s uber-i386.make bsd/gdv.make&lt;br /&gt;
 echo Changing gdv.make to point to bsd/uber-i386.make&lt;br /&gt;
 Changing gdv.make to point to bsd/uber-i386.make&lt;br /&gt;
 endif&lt;br /&gt;
 exit 1&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The modified &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; script terminates almost immediately.  It will do the usual Gaussian setting up of the built environment, including setting the symbolic link for &amp;lt;code&amp;gt;bsd/gdv.make&amp;lt;/code&amp;gt; to point to the appropriate makefile.  However our modification will cause it to look for an &amp;quot;uber-&amp;quot; prefixed version of that makefile.  The uber here means that there is one make file over the entire subdirectory.  At the time of writing there is only one uber- prefixed makefile and that is &amp;lt;code&amp;gt;uber-i386.make&amp;lt;/code&amp;gt;.  The modifications to make an uber- makefile are quite simple, and are covered [[#The makefile|later]].&lt;br /&gt;
&lt;br /&gt;
Provided there is an uber makefile now set you are now ready to use the new build system.  To build the entirety of Gaussian type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make build-tools &amp;amp;&amp;amp; make -j 6 util.a &amp;amp;&amp;amp; make util.a &amp;amp;&amp;amp; make -j 6 exe &amp;amp;&amp;amp; make exe 2&amp;gt;&amp;amp;1 | tee make.log&lt;br /&gt;
 [... lots of output ]&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The number 6 in this example instructs make to run six parallel threads while building.  You can use different numbers depending on how many processors the system you&#039;re building on has, how loaded it is, and so on.  I find that building in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; directory with a relatively unloaded cx1 login node, I can build Gaussian in about 15 minutes.  You&#039;ll notice that after each parallel invocation of make I have a serial invocation at the same time for the same target.  This is because sometimes the parallel make loses track of where it is and doesn&#039;t fully make a target.  The serial invocation should always correct this.&lt;br /&gt;
Once Gaussian is built (and you can always check by seeing that &amp;lt;code&amp;gt;make exe&amp;lt;/code&amp;gt; returns &amp;lt;code&amp;gt;Nothing to be done for: `exe&#039;&amp;lt;/code&amp;gt;) you can also build a Linda version by typing &amp;lt;code&amp;gt;make linda&amp;lt;/code&amp;gt;.  You will need the 8.2 version of the Linda compiler in your path; I suggest this is made into a module.&lt;br /&gt;
&lt;br /&gt;
== Using &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; ==&lt;br /&gt;
&amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; into the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; subdirectory of your freshly checked out repository, type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ ../pillage.sh /home/gaussian-devel/gaussiandvh13_pgi_118/gdv&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for example) wait a while and when the prompt returns you should have a fully populated and up-to-date set of binaries.  &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; touches all the imported libraries and executables so they are newer than the source code.  This means that if you type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 gdv$ make&lt;br /&gt;
 ln -sf browse arc&lt;br /&gt;
 gdv$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
only some trivial things get made.&lt;br /&gt;
&lt;br /&gt;
It&#039;s up to you to make sure that any development you do uses a consistent compiler, Linda compiler, etc, to the pillaged binaries.&lt;br /&gt;
&lt;br /&gt;
== Doing it yourself ==&lt;br /&gt;
&lt;br /&gt;
I did try to make a version of &amp;lt;code&amp;gt;pillage.sh&amp;lt;/code&amp;gt; that linked to executables instead of copying them, and you may feel tempted to try the same.  The main problem that you need to overcome is that if the libraries you are linking to are older than their corresponding &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will try to update them.  If the libraries are not yours this will simply fail and cause make to exit.  However, if the symbolically linked libraries are yours they will be updated, which is probably not what you want!&lt;br /&gt;
If you really need to save space there are some easier things you can do.  Starting from an empty repository, run &amp;lt;code&amp;gt;bldgdv&amp;lt;/code&amp;gt; and make the build tools as above.  Then copy an appropriate util.a from somewhere to your &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory (do not use &amp;lt;code&amp;gt;cp -p&amp;lt;/code&amp;gt;).  Finally, use make to build only the links you are planning to alter, e.g. &amp;lt;code&amp;gt;make l510.exe&amp;lt;/code&amp;gt;.  You should also alter the Makefile so that the mystuff target lists only these links.  This saves space by not having any of the other links&#039; libraries or executables.  You will also not have any &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files for the util  subroutines; as long as the util.a file is newer than all of the util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; files make will not try to make them.  If, however, even one util &amp;lt;code&amp;gt;.F&amp;lt;/code&amp;gt; file becomes newer than util.a make will make &#039;&#039;&#039;all&#039;&#039;&#039; of the util &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt; files!&lt;br /&gt;
Now you can use the &amp;lt;code&amp;gt;%subst&amp;lt;/code&amp;gt; keyword to Gaussian to tell it to pick up the appropriate links from this directory.&lt;br /&gt;
&lt;br /&gt;
== Developing ==&lt;br /&gt;
&lt;br /&gt;
However you have built the binaries developing in the new system is very simple.  Edit the files you need to change, type &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;make Linda&amp;lt;/code&amp;gt; from the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory.   You can also type make inside a link subdirectory, which will build just that link&#039;s executable. The makefile knows about Gaussian&#039;s dependencies, so for example if you change a subroutine in &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; then both &amp;lt;code&amp;gt;l510.exe&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;l1003.exe&amp;lt;/code&amp;gt; will be re-linked.&lt;br /&gt;
&lt;br /&gt;
By default the makefile checks everything to see if it&#039;s up-to-date.  As there are nearly 12,000 files in this layout this can take a few seconds, longer if the filesystem is being stressed.  I find that with a hot cache on &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; make takes less than a second to check everything.  With a cold cache on &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; it can take some tens of seconds.  If you want to get make to only check specific executables edit the Makefile in &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt;, uncomment the &amp;quot;mystuff&amp;quot; line, and change it appropriately.  Note, however, that all the util files are always checked.  The makefile is a tracked file in the repository, so please make sure you don&#039;t check in these trivial changes.&lt;br /&gt;
&lt;br /&gt;
You do not need to edit the makefile if you add, move, or delete subroutines.&lt;br /&gt;
&lt;br /&gt;
== The makefile ==&lt;br /&gt;
&lt;br /&gt;
In modifying the Gassian build system I have attempted to balance two competing needs.  The first is a strong desire to modify as little as possible of Gaussian&#039;s original makefiles.  This is so that when we receive newer versions of Gaussian, with their inevitable changes to the makefiles, our modifications can be trivially merged in.  The second is to have a build system that works nicely with the new file layout, which is necessary for the version control system.  The compromise that I have chosen is to have a new Makefile in the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory that understand such things as how to build libraries from the split util and link files, and which executables depend on which libraries, while relying on the existing Gaussian makefiles for details such as compiler invocation and flags.&lt;br /&gt;
&lt;br /&gt;
Sadly it was not possible to use the existing Gaussian makefile without modifying it slightly.  This modified version of &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; is called &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.  In it the rules to make most of the libraries and executables are commented out, and a few fixes for other problems are added.  If you wish to compile on another platform you will need to make an uber makefile for that platform.  Base this off the differences between &amp;lt;code&amp;gt;bsd/i386.make&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;bsd/uber-i386.make&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you want to add a new link you will need to add it to the Makefile, and possibly to the &amp;lt;code&amp;gt;uber-*&amp;lt;/code&amp;gt; makefile.&lt;br /&gt;
&lt;br /&gt;
== Tools and tricks ==&lt;br /&gt;
&lt;br /&gt;
If you aren&#039;t already using these tools, you should be.&lt;br /&gt;
&lt;br /&gt;
=== Tags ===&lt;br /&gt;
&lt;br /&gt;
One complaint that might arise in going from monolithic link files to split files is that finding the definitions of subroutines and functions becomes much more difficult.  So, if you are editing &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt; and are in the MCSCF deck you might come to the line that calls the Davids subroutine.  Finding where this subroutine is defined used to be as simple as searching for &#039;e Davids&#039; (assuming it&#039;s a subroutine, and that there is only one space between subroutine and Davids, and that it&#039;s in &amp;lt;code&amp;gt;l510.F&amp;lt;/code&amp;gt;, etc).  How are you to find it now?&lt;br /&gt;
&lt;br /&gt;
The answer is to use &#039;&#039;&#039;tags&#039;&#039;&#039;.  These have been around for a few decades and are extremely useful.  Firstly you must create a tags file, or files.  For vi/vim you do:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv$ ctags *.F */*.F */*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(for Emacs substitute etags for ctags).  If you want to create a tags file in one of the link subdirectories just use:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo/gdv/l510$ ctags *.F ../*/*.F ../*/*.c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a ctags (or etags) file in the current directory.  Now, start vi (or Emacs) and edit &amp;lt;code&amp;gt;l510/mcscf.F&amp;lt;/code&amp;gt;.  Find the line that calls the Davids subroutine and position the cursor over the word Davids.  Press &amp;lt;code&amp;gt;Ctrl-]&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-.&amp;lt;/code&amp;gt;) and you will be immediately taken to the definition of that subroutine, even if it’s in another file.  Press &amp;lt;code&amp;gt;Ctrl-T&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;M-*&amp;lt;/code&amp;gt;) and you&#039;ll be taken back to where you were.  These tags stack, that is you can go into a subroutine, and from there go into another one, and so on, and still be able to back out to the beginning.&lt;br /&gt;
&lt;br /&gt;
Editors other than vi and Emacs also support tags; check the documentation.  If your editor doesn&#039;t support tags it&#039;s just not good enough, sorry.&lt;br /&gt;
&lt;br /&gt;
=== Screen ===&lt;br /&gt;
&lt;br /&gt;
Screen is a terminal multiplexer.  If you wish to have multiple terminals open on a remote system you&#039;re probably accustomed to opening multiple SSH windows from your local system.  An alternative is to use &amp;lt;code&amp;gt;screen&amp;lt;/code&amp;gt;.  It allows you to have multiple windows, each with its own history and possibly executing commands, and switch between them with some simple keypresses.  It also preserves the state of these windows when your connection to screen drops, allowing you to reconnect later.&lt;br /&gt;
&lt;br /&gt;
It&#039;s a bit beyond the scope of this page, if you want to learn more check out the various web resources or it, such as http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=229973</id>
		<title>Resgrp:comp-photo-version control</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=229973"/>
		<updated>2012-02-07T15:40:59Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This document will teach you the basics of using mercurial, a distributed version control system (DVCS).  It is particularly directed towards using mercurial with the development version of Gaussian, so the examples will use Gaussian.  For more information on mercurial you can use the built-in help system &amp;lt;code&amp;gt;hg help&amp;lt;/code&amp;gt;, look at the official website: http://mercurial.selenic.com/wiki/Mercurial, or check out the official O&#039;Reilly book, the text of which is freely available at: http://hgbook.red-bean.com/.&lt;br /&gt;
&lt;br /&gt;
A version control system can sometimes seem an onerous imposition unless the user understands how it is going to help them in their work, so I&#039;ll try to briefly explain.  Version control is about tracking changes to data.  If one has a collection of files, say a distribution of Gaussian, then one is interested in changes that have been made to those files, whether from a new distribution from Gaussian or our own modifications.  We are particularly interested in cases where overlapping changes have been made.  These might be updates and bug fixes from Gaussian conflicting with our own modifications to a particular link, or it might be different researchers in a group working on the same piece of code independently.  A version control system will not only detect such cases but provide automated and safe methods for merging conflicting changes.&lt;br /&gt;
&lt;br /&gt;
Central to the idea of a VCS is the concept of a revision or changeset.  This is like a snapshot of some set of files and directories at some particular instant in their history.  A repository is where a VCS stores revisions.  So, using Gaussian as an example, some revisions in a particular repository might be the Gaussian source tree corresponding to Gaussian development versions H01, H08, H10, H11, etc.  The data that are actually kept inside the repository are the differences, or deltas, between the revisions.  This saves space compared to storing all the revisions.&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment (.hgrc)==&lt;br /&gt;
There are some one-off things you must do.  Firstly, edit your login scripts (&amp;lt;code&amp;gt;.bash_profile&amp;lt;/code&amp;gt; or similar) to include the command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 module load mercurial&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(If you&#039;re not on an IC HPC machine mercurial is available anywhere that runs Python.  It is generally available in distribution package systems, if not you can get it from http://mercurial.selenic.com/wiki/Mercurial)&lt;br /&gt;
&lt;br /&gt;
Next, create a file called &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; in your home directory and insert the following lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 username = Your Name &amp;lt;your@email.address&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(so for example, my &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; contains this line: &amp;lt;code&amp;gt;username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
Mercurial uses this username field to record who has changed what.  (If you&#039;re not on an IC HPC machine your version of mercurial may not&lt;br /&gt;
have the graphlog extension.  If it doesn&#039;t, don&#039;t worry, it&#039;s merely a tool for visualising changesets).&lt;br /&gt;
&lt;br /&gt;
== Checking out a repository (hg clone, hg log) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s get started and check out a repository.  Once you have loaded the mercurial module you will be able to type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussian-devel/example-gaussian-repo testrepo&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a copy of the repository at &amp;lt;code&amp;gt;/home/gaussian-devel/example-gaussian-repo&amp;lt;/code&amp;gt; and place it in a directory inside the current directory called &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt;.  You can give a full path as the second argument, or, you can leave it off altogether in which case mercurial will clone the repository into a directory named &amp;lt;code&amp;gt;example-gaussian-repo&amp;lt;/code&amp;gt;.  A note here for Imperial HPC users.  Copying a repository involves quite a bit of filesystem activity.  I have found that on cx1 this can be quite slow on the &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; filesystems.  You may wish to try these examples in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; filesystem which is a lot faster.  Be aware, however, that this raises two potentially serious problems.  The first is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is globally readable so before you clone you must make sure that your umask is set to &amp;lt;code&amp;gt;0077&amp;lt;/code&amp;gt;.  The second, of course, is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is periodically wiped.  If you plan on working in &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; there are simple ways of transferring information between repositories (&amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt;) that I will cover later.&lt;br /&gt;
&lt;br /&gt;
Now change into the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory.  Inside you will see three scripts and a &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory; also some hidden files and a hidden directory.  Inside the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory you will see the Gaussian source in the [[Resgrp:comp-photo-new gdv layout|new layout]].  The hidden &amp;lt;code&amp;gt;.hg&amp;lt;/code&amp;gt; directory inside the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory is the repository proper; you will almost never need to do anything in here.  The rest of the files and directories are called the working directory; this is where you will do your work.&lt;br /&gt;
&lt;br /&gt;
The first thing you might want to do is check the history of this repository to see past revisions that have been checked into it.  You do this with the &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log | head -20&lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 &lt;br /&gt;
 changeset:   22:6c81eb8dcbab&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      21:5b6ac3665a29&lt;br /&gt;
 parent:      11:a0c273aeeb2b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:08 2012 +0000&lt;br /&gt;
 summary:     Gaussian devel version H13 with our makefiles&lt;br /&gt;
 &lt;br /&gt;
 changeset:   21:5b6ac3665a29&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:41:40 2012 +0000&lt;br /&gt;
 summary:     Added tag h12p for changeset 0ef14d7dff56&lt;br /&gt;
 ...&lt;br /&gt;
 changeset:   1:515a93bfc3b5&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:10 2012 +0000&lt;br /&gt;
 summary:     Added tag h01-raw for changeset 073d6aa63ea7&lt;br /&gt;
 &lt;br /&gt;
 changeset:   0:073d6aa63ea7&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h01-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:09 2012 +0000&lt;br /&gt;
 summary:     Output from old-to-new.sh on version H01&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
You will see that there are various fields that may appear for each changeset.  The changeset field shows two numbers separated by a colon.  The second, longer, hexadecimal number is the unique identifier.  A particular hex identifier will always refer to the same changeset, even in different copies of the repository.  The first number is a local identifier.  These local IDs refer to particular changesets in one copy of the repository; if these changesets are present in another repository they may have a different local identifier.    You can use either identifier as an argument to &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands.  The user and date fields show who committed the change and when.  The summary field shows the first line of the log entry for that revision.  This means it is important to try to make the first line of your log entries a useful summary of what you have done!&lt;br /&gt;
&lt;br /&gt;
To see the entry for a particular revision use the &amp;lt;code&amp;gt;-r&amp;lt;/code&amp;gt; flag with a revision number, either short or long.  To see more information, including the full log entry and a complete list of all files involved in the change, use the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag, e.g.:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -r 2 -v | less&lt;br /&gt;
 changeset:   2:9f69ed4616ad&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h08-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:54:50 2012 +0000&lt;br /&gt;
 files:       gdv/archlib/arcvib.F gdv/archlib/brcpyw.F gdv/archlib/letset.F gdv/arctmp.F gdv/bsd/GauDiff_Compare.pm gdv/bsd/G&lt;br /&gt;
 ....&lt;br /&gt;
 at.F gdv/utilnz/xpndnb.F gdv/utilnz/zerock.F gdv/utilnz/zerod.F gdv/wrappers/ggeev.F gdv/wrappers/lappar.F gdv/wrappers/xgetrf.F  gdv/wrappers/xgetrs.F gdv/wrappers/ygeru.F gdv/wrappers/ytrsv.F&lt;br /&gt;
 description:&lt;br /&gt;
 Import of gdv H08.  See below for details.&lt;br /&gt;
 &lt;br /&gt;
 Result of these commands on the H01 raw rev:&lt;br /&gt;
 rm -fr gdv&lt;br /&gt;
 cp -pr h08/new-style-gdv .&lt;br /&gt;
 hg add gdv/bsd/*.a&lt;br /&gt;
 hg addremove -s 50&lt;br /&gt;
 &lt;br /&gt;
 h08/new-style is from old-to-new.sh on freshly untarred h08.tgz&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
As the log entry explains, this particular revision is the change from the H01 version of Gaussian to the H08 version, so there are a lot of changed files.  The description entry is intended to provide some human readable explanation of the changes.  When you start committing data to the repository you should aim to at least make your log entries understandable.&lt;br /&gt;
&lt;br /&gt;
As with all the commands that I will mention you can get more information by typing &amp;lt;code&amp;gt;hg help &amp;lt;command&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Committing changes (hg summary, hg status, hg diff) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make some alterations to this repository.  This is quite safe; we can&#039;t break the original repository because our copy is an entirely separate clone.  In fact, this is a very common working practice with mercurial.  As long as the filesystem isn&#039;t slow cloning a repository can be quite quick.  Indeed, cloning a repository into a destination on the same filesystem as the source makes use of hard linking which is very fast and saves space.  Therefore, it is very common to clone a repository, make some alterations to it, and then decide whether to push them back to the original repository or just delete the new clone.&lt;br /&gt;
&lt;br /&gt;
First, we want to know where it is we are starting from.  To get a quick summary you use the &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; command.  This should show something like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg summary&lt;br /&gt;
 parent: 23:1de40efd1c4b tip&lt;br /&gt;
 Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 branch: default&lt;br /&gt;
 commit: (clean)&lt;br /&gt;
 update: (current)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows, on the parent line, the revision that has been checked out into the working directory.  Below that is the summary line from the log entry for that revision.  The commit line shows if any files have been modified since the check out.  The update line shows if there are any applicable newer revisions in the repository.  In this example the output shows us that we checked out the revision with the local identifier 23, and unique identifier of 1de40efd1c4b, that we have modified nothing and that there are no appropriate newer revisions.  This checkout occurred automatically as a part of the &amp;lt;code&amp;gt;hg clone&amp;lt;/code&amp;gt; command.  You can clone without checking anything out into the working directory (say to make a backup copy of the repository) by passing the &amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; flag, or you can check out a particular revision with the &amp;lt;code&amp;gt;-u REV&amp;lt;/code&amp;gt; flag.  See &amp;lt;code&amp;gt;hg help clone&amp;lt;/code&amp;gt; for how mercurial chooses what to check out by default.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say we&#039;re adding a feature to link 510.  If you have something in mind go ahead and do it. For this example I have just added a few lines to the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, and will assume that your current working directory is &amp;lt;code&amp;gt;gdv/l510&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As you work you may be curious to know what it is you have changed.  The command to show this is &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The output shows a list of files that have been altered in some way.  Here the capital M shows that the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified.  By default &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; does not report on unchanged files.  If we wish to see how &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified we can use the &amp;lt;code&amp;gt;hg diff&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 11:07:55 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Add super new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows the output in a unified different format, refer to the man page for diff for more information.&lt;br /&gt;
&lt;br /&gt;
== Adding, copying, renaming, and deleting file (hg add, hg forget, hg mv, hg rm, hg cp) ==&lt;br /&gt;
&lt;br /&gt;
If you have created a new file then you must let mercurial know about its existence with the &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ echo &amp;quot;a new subroutine&amp;quot; &amp;gt; foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 ? gdv/l510/foo.F&lt;br /&gt;
 testrepo$ hg add foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here, I create a new file called &amp;lt;code&amp;gt;foo.F&amp;lt;/code&amp;gt;.  &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with a ?,  to indicate that it is unknown to the repository.  I then run &amp;lt;code&amp;gt;hg add foo.F&amp;lt;/code&amp;gt;, after which &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with an A.  This indicates that the file is scheduled to be added at the next commit.  If you change your mind about the file before the next commit you can use &amp;lt;code&amp;gt;hg forget&amp;lt;/code&amp;gt; to undo the add.&lt;br /&gt;
&lt;br /&gt;
If you are renaming a file, including the situation where you move the file from one directory to another (e.g. from l510 to utilam) then you may use the &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; command.  This will actually perform the move just like the normal &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; command.  If you&#039;ve already moved the file you can give &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; the &amp;lt;code&amp;gt;-A&amp;lt;/code&amp;gt; flag to record the rename after the fact.  Similarly, the &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt; command removes files from the working directory and records this fact in the repository, and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; copies a file.&lt;br /&gt;
&lt;br /&gt;
It is important to realise that these commands act on the working directory immediately but only affect the repository when they are committed.  Also, they do not affect the repository&#039;s previous history, so removing a file and then committing that change does not affect that file&#039;s existence in previous revisions in the repository.  However, &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; create a relationship between the source and destination files.  This becomes useful when merging in changes from somewhere else.  So for example, above I have made changes to &amp;lt;code&amp;gt;l510/a1tdep.F&amp;lt;/code&amp;gt;.  Let&#039;s say that someone else has decided to make this into a utility routine and has done the command &amp;lt;code&amp;gt;hg mv l510/a1tdep.F utilam/a1tdep.F&amp;lt;/code&amp;gt;.  If I choose to merge my changes with this other person&#039;s, mercurial will correctly apply the changes &#039;&#039;&#039;and&#039;&#039;&#039; move the file.  If instead of &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; they had used &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; then my changes would be applied to both files.  This means that you should only use &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; when it is appropriate that changes that are recorded before the copy are applied to both files.  Note that this does not mean that changes to the source file are forever applied to the destination file; this will only occur when merging a revision that does not contain a copy with a revision that does.  In general, you can expect mercurial to do the right thing.&lt;br /&gt;
&lt;br /&gt;
== Committing the changes (hg commit, hg tip) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt; (like many &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands, &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commit has an alias, in this case &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;.  I tend to use &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;) command creates a new revision and records the differences between the entire working directory and the parent revision (as shown on the parent line of &amp;lt;code&amp;gt;hg summary).  This will be the same as the output from &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;.  When you run the command mercurial will open a text editor.  If you wish to specify which editor is used add an &amp;lt;code&amp;gt;editor=vim&amp;lt;/code&amp;gt; (for example) line to the &amp;lt;code&amp;gt;[ui]&amp;lt;/code&amp;gt; part of your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file.  The editor will start with a couple of empty lines and then some lines beginning with &amp;quot;&amp;lt;code&amp;gt;HG:&amp;lt;/code&amp;gt;&amp;quot;.  These are there to give you helpful reminders of what you&#039;ve changed while you write your log message and will be ignored by mercurial when you commit.  If you close the editor without writing anything, or of the editor quits with an error, mercurial will abort the commit.  So for our current example:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci&lt;br /&gt;
 ... [opens vim]&lt;br /&gt;
 HG: Enter commit message.  Lines beginning with &#039;HG:&#039; are removed.&lt;br /&gt;
 HG: Leave message empty to abort commit.&lt;br /&gt;
 HG: --&lt;br /&gt;
 HG: user: Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 HG: branch &#039;default&#039;&lt;br /&gt;
 HG: added gdv/l510/foo.F&lt;br /&gt;
 HG: changed gdv/l510/a1tdep.F&lt;br /&gt;
 ~&lt;br /&gt;
 ~&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For short messages you can skip the editor step by passing the &amp;lt;code&amp;gt;-m &amp;quot;Log message here&amp;quot;&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
Understanding what you are doing here is essential to knowing what to write in the log and, importantly, when to commit.  There are two schools of thought.  When you commit you are creating a new revision in your local repository.  Since it is your repository, and as I have previously mentioned, it is very simple to create new repositories, you should commit whenever you feel like it and feel free to write cryptic log messages that only you will understand.  On the other hand, you are engaged in a collaborative exercise with other people: creating what will be a single version of Gaussian that contains yours and others&#039; modifications and Gaussian&#039;s updates.  Therefore, you should only commit when your code satisfies pre-agreed group requirements, and your log message should be detailed and comprehensible to anybody who reads it, even 50 years in the future.  The correct approach, of course, is to do both.&lt;br /&gt;
&lt;br /&gt;
Mercurial is a distributed version control system which means that each repository is the responsibility of its owner who can feel free to commit as frequently (or infrequently) as needed.  Sometimes adding a feature or removing a bug might take weeks, and you might feel that there is no point taking snapshots of the code until it works.  Other modifications might proceed incrementally with naturally defined stopping points between the start and the end.  Committing at these points makes perfect sense: not only does it leave a history of the modification, it provides checkpoints, versions of the code that you can retreat to without having to start again.  The log messages may tersely explain what has happened since the last revision (and note there is no point listing modified, added, etc, files as this information is stored in the commit anyway) or they may contain detailed essays on how a bug arose and the steps you have taken to fix it.  Information in the logs is searchable and should be thought of as both an aide memoir for yourself and a journal entry for others.&lt;br /&gt;
&lt;br /&gt;
When the time comes to merge your changes into other people&#039;s repositories, you might start thinking about the quality of your commit.  Does the code compile?  Does it run the test suite?  Can it run any test?  Have you committed a test that checks the code you have added or altered?  The group may decide that revisions that are being shared must answer yes to some or all of these questions.  You may decide that some or all of your revisions must pass these quality checks.  Or, you may be satisfied with noting in the log entry what this particular revision can or can&#039;t do (such as compile or run).&lt;br /&gt;
&lt;br /&gt;
It should be said though, that if you ever think &amp;quot;perhaps I should check in at this point&amp;quot;, then go for it.  Revisions live in the history of your repository forever (although see &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;), but when you transfer them to other people&#039;s repositories multiple revisions can be collapsed into one, or fixed in other ways.&lt;br /&gt;
&lt;br /&gt;
Returning to our example I enter a simple message.  Since &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; only shows the first line of any log entry by default it is a good idea to make this line a summary of the rest of the message.  I close the editor and the commit is done.&lt;br /&gt;
&lt;br /&gt;
We can see the results in the repository with an &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command (the &amp;lt;code&amp;gt;-l 2&amp;lt;/code&amp;gt; flag shows the last two revisions):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -l 2&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 summary:     A test message.&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Alternatively we can use the &amp;lt;code&amp;gt;hg tip&amp;lt;/code&amp;gt; command to show the most recently added repository, whether by ourselves, or by pulling from another repository (see later).&lt;br /&gt;
&lt;br /&gt;
== Fixing mistakes (hg revert, hg rollback) ==&lt;br /&gt;
&lt;br /&gt;
You can return one or more files, or the entire repository, to the state they were in when you last checked them out with in the &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; command.  Let&#039;s make an ill-advised alteration to our now committed change to &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ sed -i &#039;s/super/super duper/&#039; a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 13ecff0136c2 gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 17:23:42 2012 +0000&lt;br /&gt;
 @@ -27,7 +27,7 @@&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
  c&lt;br /&gt;
 -c     Add super new feature&lt;br /&gt;
 +c     Add super duper new feature&lt;br /&gt;
  c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ? gdv/l510/a1tdep.F.orig&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 testrepo$ rm a1tdep.*&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ! gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I use revert to undo the modifications to a file.  Notice that &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; leaves a copy of the modified file in &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt;.  This shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as an unknown file (&amp;quot;?&amp;quot;).  Also notice that while trying to delete the .orig file I have accidentally deleted &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, which now shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as a missing file (&amp;quot;!&amp;quot;).  I can revert this mistake too:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 testrepo$ ls a1tdep.F&lt;br /&gt;
 a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; can also be used to cancel scheduled adds, removes, copies, and renames.&lt;br /&gt;
&lt;br /&gt;
If you have just committed a revision and then change your mind you may be able to undo the effect with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;.  Doing this for our example gives us:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg rollback&lt;br /&gt;
 repository tip rolled back to revision 23 (undo commit)&lt;br /&gt;
 working directory now based on revision 23&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This removes the revision we just checked in from the repository but does not alter the current working directory.  If we choose, we could now use &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; to restore these to their revision 23 state.  There are two important caveats with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;: it can only remove the last checked in revision, and that it is usually pointless to rollback a revision that has already been pushed or pulled (see later) into somebody else&#039;s repository, as we can only affect our repository.  For the purposes of this example, I will once more check in the changes I have made:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci -m &#039;A test message&#039;&lt;br /&gt;
 testrepo$ hg tip&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:38:52 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Collaboration (hg incoming, hg pull, hg outgoing, hg push, hg update, hg parent) ==&lt;br /&gt;
&lt;br /&gt;
The tools described are already quite useful, and form the basis of the very earliest revision control systems.  The benefits of being able to detect what you&#039;ve changed, and how you&#039;ve changed it, being able to undo the changes selectively, and being able to take a snapshot of your work at any point of your choosing should be apparent.  The true power, however, of a modern version control system is how it mediates different streams of changes, particularly those from other users.  Note that a DVCS does not solve problems of merging and so on, but provides you, the user, with tools to solve them.&lt;br /&gt;
&lt;br /&gt;
Revisions in the repository form a directed acyclic graph (DAG).  Every revision apart from the first has at least one parent revision and may have zero or more child revisions.  A revision with no children is called a &#039;&#039;head&#039;&#039;.  Generally development takes place at a head of the repository: checking in a new revision onto a head creates and consumes a head.  However, it is possible to add a child to any revision, possibly creating a new head.  This is known as a branch, and may be named or unnamed.  A revision with children may still be a branch head if it has no children on its branch.&lt;br /&gt;
&lt;br /&gt;
There are various ways of managing branches.  You can have a few repositories with many branches, named and unnamed.  Or you can have many repositories with largely unbranched graphs; it&#039;s up to you.  Since mercurial uses heads as the default targets for some of its operations the latter approach is probably best for beginners as it makes operations within each repository simpler.&lt;br /&gt;
&lt;br /&gt;
This is probably best illustrated with an example.  I&#039;ll make a copy of the original repository, make a different change, and then merge the changes.  Change directory out of the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussiandevel/example-gaussian-repo testmerge&lt;br /&gt;
 updating to branch default&lt;br /&gt;
 13427 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we go into the new repository and make some modifications.  This time I alter the files &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;a2tdep.F&amp;lt;/code&amp;gt;, and add a file &amp;lt;code&amp;gt;bar.F&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 …[alterations to a1tdep.F, a2tdep.F, and bar.F]...&lt;br /&gt;
 testmerge$ hg add gdv/l510/bar.F&lt;br /&gt;
 testmerge$ hg diff&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Some new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a2tdep.F&lt;br /&gt;
 --- a/gdv/l510/a2tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a2tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -16,6 +16,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **DETERMINE IF WE RUN THE TIMEDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Super duper feature here too&lt;br /&gt;
 +c&lt;br /&gt;
        LenTst=0&lt;br /&gt;
        CALL FILEIO(11,jTDep,LenTst,0,0)&lt;br /&gt;
        IF (LenTst.EQ.0.OR.iopv.NE.23)RETURN&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/bar.F&lt;br /&gt;
 --- /dev/null   Thu Jan 01 00:00:00 1970 +0000&lt;br /&gt;
 +++ b/gdv/l510/bar.F    Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -0,0 +1,1 @@&lt;br /&gt;
 +Stuff in here&lt;br /&gt;
 testmerge$&lt;br /&gt;
 testmerge$ hg ci -m &#039;Added second new feature&#039;&lt;br /&gt;
 testmerge$ hg log -l 2&lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The situation now is that we have two repositories where there are revisions whose parent is revision 23 (23:1de40efd1c4b, in fact).  This sort of scenario might arise because we have been working on two different features in two different repositories, or it may be that two users have been working separately.  At some point you may wish to merge the work.  It&#039;s up to you when and how you do this: you may wish to merge in bug fixes quite frequently, and incorporate brand-new features much less frequently.  You can of course clone another repository in which to do the merge so that if it isn&#039;t satisfactory you can just delete the repository.&lt;br /&gt;
&lt;br /&gt;
First we must pull the revisions from one repository to another.  We use the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pull&amp;lt;/code&amp;gt; commands to do this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg incoming ../testrepo&lt;br /&gt;
 comparing with ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testmerge$ hg pull ../testrepo&lt;br /&gt;
 pulling from ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 adding changesets&lt;br /&gt;
 adding manifests&lt;br /&gt;
 adding file changes&lt;br /&gt;
 added 1 changesets with 2 changes to 2 files (+1 heads)&lt;br /&gt;
 (run &#039;hg heads&#039; to see heads, &#039;hg merge&#039; to merge)&lt;br /&gt;
 testmerge$ hg log -l 3&lt;br /&gt;
 changeset:   25:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 &lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command takes another repository as its argument and shows a list of revisions that are not present in the current repository.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command brings those revisions over into the current repository.  The &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command shows changeset 25 in the testmerge repository corresponds to number 24 in the original &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository.  Note the long ID is the same in both cases.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command reports that it has created a new head.  We can see this clearly with the &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt; command (from the graphlog extension). The &amp;lt;code&amp;gt;-r 23:&amp;lt;/code&amp;gt; flag tells &amp;lt;code&amp;gt;glog&amp;lt;/code&amp;gt; to show revisions 23 and greater, for clarity:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -r 23:&lt;br /&gt;
 o  changeset:   25:13ecff0136c2&lt;br /&gt;
 |  tag:         tip&lt;br /&gt;
 |  parent:      23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 |  summary:     A test message&lt;br /&gt;
 |&lt;br /&gt;
 | @  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; command can also be used to copy revisions from one repository to another.  It works much as you would expect, except that by default it does not permit the creation of new heads in the destination repository.  The idea is that you tend to pull into your own repository, where you&#039;re expected to know what you&#039;re doing, while you might be pushing into someone else&#039;s repository, where creating a new head might cause confusion.  &amp;lt;code&amp;gt;hg outgoing&amp;lt;/code&amp;gt; is the corresponding analogue to the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
In our example we now have a situation where we have two heads.  This can arise from revisions being created in different repositories and then pulled together, as shown.  Alternatively you can just create new heads in one repository.  A disadvantage of the single repository technique is that if you decide branch is going nowhere and elect not to merge or proceed with it, it still remains in your repository.  With multiple repositories you can just delete the offending repository.&lt;br /&gt;
&lt;br /&gt;
== Merging two sets of changes (hg merge, hg resolve) ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say that I decide that these two features will work together and I want to merge the two branches.  I can use the &amp;lt;code&amp;gt;hg up&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;hg update&amp;lt;/code&amp;gt;) command to update the current working directory to a particular revision in the repository.  If no revision is specified it will update to the current branch head.  The revision updated to becomes the parent (as shown by &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg parent&amp;lt;/code&amp;gt;) of the working directory.  If there are modified files in the working directory the update may attempt a merge.  The revision of the working directory when you start to merge is called the base of the merge.  This is important if the two revisions you are merging are on different branches, because the newly merged revision will stay on the base branch.  Note that the &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command does not update the working directory, so in this case it will still be at revision 24.  Let&#039;s update to revision 25 and then merge the changes from revision 24:&lt;br /&gt;
&lt;br /&gt;
[Which revision to merge from: in general you merge changes into whatever is your current baseline.  So, if you&#039;re merging the latest updates from Gaussian (from H10 to H11 for example) into your code, you update to your code and merge in the H11 revision.  If you&#039;re merging in your changes into the soon to be sent to Gaussian group development version you&#039;d start with that and merge in the revision(s) containing your changes]&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg up 25&lt;br /&gt;
 3 files updated, 0 files merged, 1 files removed, 0 files unresolved&lt;br /&gt;
 testmerge$ hg merge 24&lt;br /&gt;
 merging gdv/l510/a1tdep.F&lt;br /&gt;
 warning: conflicts during merge.&lt;br /&gt;
 merging gdv/l510/a1tdep.F failed!&lt;br /&gt;
 2 files updated, 0 files merged, 0 files removed, 1 files unresolved&lt;br /&gt;
 use &#039;hg resolve&#039; to retry unresolved file merges or &#039;hg update -C .&#039; to abandon&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The software automatically brings in the changes to foo.F, bar.F, and a2tdep.F (as &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; will show).  However, in our contrived example &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; is subject to changes from both revisions.  Mercurial will attempt to merge automatically, and in this case it fails.  If you edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; you will see it contains the lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 =======&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
which were inserted during the failed merge.  There is also an &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt; file created as a result of the failed merge.  As the output from &amp;lt;code&amp;gt;hg merge&amp;lt;/code&amp;gt; says you can either now resolve this failed merge or use &amp;lt;code&amp;gt;hg update -C&amp;lt;/code&amp;gt; to undo it (the &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; file will remain).&lt;br /&gt;
&lt;br /&gt;
Since we want to resolve the merge we should edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; so that it works.  At a bare minimum we will have to remove the “&amp;lt;code&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&amp;lt;/code&amp;gt;”, “&amp;lt;code&amp;gt;=======&amp;lt;/code&amp;gt;”, and “&amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&amp;lt;/code&amp;gt;” marker lines.  In a more complex situation we might have to completely rewrite this and other files.  This is what I mean when I say that mercurial only provides tools to do merging.  Even a completely successful merge, from mercurial&#039;s point of view, may be completely bogus code.&lt;br /&gt;
&lt;br /&gt;
There are tools available to make this task easier.  For example I use &amp;lt;code&amp;gt;vimdiff&amp;lt;/code&amp;gt;, a part of the popular &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; package.  To enable this I have altered my &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file to look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 merge = vimdiff&lt;br /&gt;
 username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
 &lt;br /&gt;
 [merge-tools]&lt;br /&gt;
 vimdiff.executable = vim&lt;br /&gt;
 vimdiff.args = -d $base $local $output $other +close +close&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
as per http://mercurial.selenic.com/wiki/MergingWithVim.  The page http://mercurial.selenic.com/wiki/MergeProgram contains instructions for other tools, including Emacs, and graphical tools.  If you edit your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file in this way then you now can type &amp;lt;code&amp;gt;hg resolve --all&amp;lt;/code&amp;gt; to run your chosen tool on all unresolved files.  Note that by default if your chosen tool exits without an error then &amp;lt;code&amp;gt;hg resolve&amp;lt;/code&amp;gt; will regard that file as resolved.  To cause &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; to exit with an error use &amp;lt;code&amp;gt;:cq&amp;lt;/code&amp;gt;.  See &amp;lt;code&amp;gt;hg help resolve&amp;lt;/code&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
In the example my resolution is to have the relevant lines in &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 c&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have resolved all the files that mercurial thinks need fixing you should check that the final merged result makes sense.  Checking that it compiles, or runs tests appropriate to both of the original revisions, for example.  When you are satisfied, you should check in the merged revision:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg ci -m &#039;Merged super and duper features&#039;&lt;br /&gt;
 &lt;br /&gt;
 testmerge$ hg tip&lt;br /&gt;
 &lt;br /&gt;
 changeset:   26:857f81e59d66&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      25:13ecff0136c2&lt;br /&gt;
 parent:      24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 13:10:52 2012 +0000&lt;br /&gt;
 summary:     Merged super and new features&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 testmerge$&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can see that the new revision has &#039;&#039;two&#039;&#039; parent revisions; a merge always consumes a head.  This is clear from the output of:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -l 4&lt;br /&gt;
 o    changeset:   26:857f81e59d66&lt;br /&gt;
 |\   tag:         tip&lt;br /&gt;
 | |  parent:      25:13ecff0136c2&lt;br /&gt;
 | |  parent:      24:457db23c0b1a&lt;br /&gt;
 | |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 | |  date:        Thu Jan 26 13:10:52 2012 +0000&lt;br /&gt;
 | |  summary:     Merged super and new features&lt;br /&gt;
 | |&lt;br /&gt;
 | o  changeset:   25:13ecff0136c2&lt;br /&gt;
 | |  parent:      23:1de40efd1c4b&lt;br /&gt;
 | |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 | |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 | |  summary:     A test message&lt;br /&gt;
 | |&lt;br /&gt;
 o |  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Another example of merging here?  Perhaps Lee&#039;s code merging in changes on official version.&lt;br /&gt;
&lt;br /&gt;
== Tags and named branches (hg tag, hg tags, hg branch, hg branches) ==&lt;br /&gt;
&lt;br /&gt;
It is often useful to give a name to a particular revision.  This might be a changeset that corresponds to a given version of the code, or it might simply be a revision that marks a particular milestone.  In the &amp;lt;code&amp;gt;example-gaussian-repo&amp;lt;/code&amp;gt; you have probably noticed there are revisions in the history with descriptions like &amp;quot;Added tag h13 for changeset 6c81eb8dcbab&amp;quot;.  These are revisions corresponding to particular versions of the Gaussian development version, such as H01, H10, H13, etc.  You can see a list of the tags in a repository by doing:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg tags&lt;br /&gt;
 tip                               26:857f81e59d66&lt;br /&gt;
 h13                               22:6c81eb8dcbab&lt;br /&gt;
 h12p                              20:0ef14d7dff56&lt;br /&gt;
 h11                               18:7daba638a830&lt;br /&gt;
 h10                               16:e1d0af4e84d9&lt;br /&gt;
 h08                               14:656073c38db9&lt;br /&gt;
 h01                               12:737d1720e79a&lt;br /&gt;
 h13-raw                           10:b039f5c274e2&lt;br /&gt;
 h12p-raw                           8:522a8fe79d22&lt;br /&gt;
 h11-raw                            6:a28b789a9555&lt;br /&gt;
 h10-raw                            4:356081dab79d&lt;br /&gt;
 h08-raw                            2:9f69ed4616ad&lt;br /&gt;
 h01-raw                            0:073d6aa63ea7&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(the &amp;lt;code&amp;gt;tip&amp;lt;/code&amp;gt; tag is automatically assigned to the most recently checked in revision).  You may use a tag name anywhere where you might use a revision number, so for example, to check out the changeset corresponding to the official Gaussian development release H10, you would type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg up h10&lt;br /&gt;
 13887 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(this will look different if you have unchecked-in modifications in your working directory).  You could also pass h10 to the &amp;lt;code&amp;gt;hg clone -u&amp;lt;/code&amp;gt; flag, and so on.&lt;br /&gt;
You tag a revision with the &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt; command.  Issue it in a working directory and it will tag the revision that is the parent of the working directory.  Tags become part of the repository, that is they are shared during &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt;, so choose wisely.  If you&#039;d like to have tags that are only part of the local repository, use the &amp;lt;code&amp;gt;-l&amp;lt;/code&amp;gt; flag to &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Tags are stored in an &amp;lt;code&amp;gt;.hgtags&amp;lt;/code&amp;gt; file in the root directory of the repository.  Running &amp;lt;code&amp;gt;hg tag&amp;lt;/code&amp;gt; alters this file and then commits the change to the repository.  Sometimes you can see conflicts in this file during merges.  I normally just resolve them by keeping as much information in the merged file as possible.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg branches&amp;lt;/code&amp;gt; command can be used to show the named branches in the repository:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg branches&lt;br /&gt;
 default                       24:13ecff0136c2&lt;br /&gt;
 raw                           11:a0c273aeeb2b (inactive)&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I have two named branches, raw and default (the default branch is, er, the default).  If you examine the full output of &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt;, which is quite long and I won&#039;t reproduce it here, you&#039;ll see, starting at the bottom, revisions 0 to 11 are all in the raw branch.  I have created and named this branch to contain the official Gaussian development code as processed by the &amp;lt;code&amp;gt;old-to-new.sh&amp;lt;/code&amp;gt; script, without any of our makefiles or other alterations.  The default branch branches off from revision 1 and starts at revision 12.  Its descendants, revisions 12 to 23, are also in the default branch.  These were created by starting at revision 1, adding our makefiles and modifications to the build system, renaming this branch to the default branch, and then committing revision 12.  I tagged revision 12 as &amp;quot;H01&amp;quot;, which created revision 13.  I then merged revision 3, fixed the conflicts, and committed revision 14, and so on.  A more detailed guide on how to import a new official version of gdv exists in LINKY.&lt;br /&gt;
&lt;br /&gt;
You can use branch names just like tags wherever mercurial expects a revision identifier.  If you use a branch name mercurial will attempt to give you the revision that is most appropriate, this will usually be the newest head on that branch.&lt;br /&gt;
&lt;br /&gt;
To create a new branch you type &amp;lt;code&amp;gt;hg branch &amp;lt;branchname&amp;gt;&amp;lt;/code&amp;gt;.  This will take effect when you commit the working directory.  As I&#039;ve previously mentioned a simpler alternative to having branches, named or otherwise, in your repository is to have multiple repositories.&lt;br /&gt;
&lt;br /&gt;
== Ignoring files ==&lt;br /&gt;
&lt;br /&gt;
You may be wondering how the system will work when you start compiling files.  Won&#039;t all the &amp;lt;code&amp;gt;.o&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.a&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.exe&amp;lt;/code&amp;gt; files start showing up in the output to &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;?  The answer is that they will not, because I&#039;ve told mercurial to ignore such files.  This information is stored in the &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file in the root of the repository.  It&#039;s quite long but it starts like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 syntax: glob&lt;br /&gt;
 gdv.make&lt;br /&gt;
 *.o&lt;br /&gt;
 *.lo&lt;br /&gt;
 *.a&lt;br /&gt;
 *.exe&lt;br /&gt;
 *.exel&lt;br /&gt;
 .*.swp&lt;br /&gt;
 *~&lt;br /&gt;
 *.log&lt;br /&gt;
 *.log.gz&lt;br /&gt;
 *.chk&lt;br /&gt;
 gdv/arc&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Any file that matches either the shell patterns or the file names in &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; is ignored by mercurial.  This means it does not show up to &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt;, and so on will ignore it unless it is explicitly mentioned on the command line.  So &amp;lt;code&amp;gt;hg add gdv&amp;lt;/code&amp;gt; will add all non-ignored files in the gdv directory, while &amp;lt;code&amp;gt;hg add gdv/*&amp;lt;/code&amp;gt; will add all the files in the gdv directory.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;.hgignore&amp;lt;/code&amp;gt; file is tracked, so please only commit changes to it if you think they will be useful to everyone.&lt;br /&gt;
== Other commands ==&lt;br /&gt;
&lt;br /&gt;
There are quite a few other commands available to mercurial, I will cover just a few here, if you&#039;re interested in becoming a power user refer to the documentation I have mentioned.&lt;br /&gt;
&lt;br /&gt;
=== hg addremove ===&lt;br /&gt;
You can use this command when you have large numbers of files to add and remove.  It also includes the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; flag to attempt to detect when files have been moved or copied.  Using this flag does require some subtlety, as it&#039;s not helpful to mark files as moved or copied unless they have been.  Also note that it is possible to inadvertently include ignored files in a mass &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg addremove&amp;lt;/code&amp;gt;; check what&#039;s being added before you commit.&lt;br /&gt;
&lt;br /&gt;
=== hg grep and hg locate ===&lt;br /&gt;
Similar to the standard UNIX grep and locate commands, but cognisant of the mercurial repository.&lt;br /&gt;
&lt;br /&gt;
=== hg init ===&lt;br /&gt;
Creates a new mercurial repository in the current directory&lt;br /&gt;
&lt;br /&gt;
=== hg serve ===&lt;br /&gt;
This starts a mini web server serving information about the repository.  I would strongly recommend you do not use this while working on the Gaussian development version as it would be all too easy to allow any user on the system to view all of the files in your repository.  I only mention it here because some of the other documentation may refer to it.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=229225</id>
		<title>Resgrp:comp-photo-version control</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=229225"/>
		<updated>2012-02-06T22:18:54Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This document will teach you the basics of using mercurial, a distributed version control system (DVCS).  It is particularly directed towards using mercurial with the development version of Gaussian, so the examples will use Gaussian.  For more information on mercurial you can use the built-in help system &amp;lt;code&amp;gt;hg help&amp;lt;/code&amp;gt;, look at the official website: http://mercurial.selenic.com/wiki/Mercurial, or check out the official O&#039;Reilly book, the text of which is freely available at: http://hgbook.red-bean.com/.&lt;br /&gt;
&lt;br /&gt;
A version control system can sometimes seem an onerous imposition unless the user understands how it is going to help them in their work, so I&#039;ll try to briefly explain.  Version control is about tracking changes to data.  If one has a collection of files, say a distribution of Gaussian, then one is interested in changes that have been made to those files, whether from a new distribution from Gaussian or our own modifications.  We are particularly interested in cases where overlapping changes have been made.  These might be updates and bug fixes from Gaussian conflicting with our own modifications to a particular link, or it might be different researchers in a group working on the same piece of code independently.  A version control system will not only detect such cases but provide automated and safe methods for merging conflicting changes.&lt;br /&gt;
&lt;br /&gt;
Central to the idea of a VCS is the concept of a revision or changeset.  This is like a snapshot of some set of files and directories at some particular instant in their history.  A repository is where a VCS stores revisions.  So, using Gaussian as an example, some revisions in a particular repository might be the Gaussian source tree corresponding to Gaussian development versions H01, H08, H10, H11, etc.  The data that are actually kept inside the repository are the differences, or deltas, between the revisions.  This saves space compared to storing all the revisions.&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment (.hgrc)==&lt;br /&gt;
There are some one-off things you must do.  Firstly, edit your login scripts (&amp;lt;code&amp;gt;.bash_profile&amp;lt;/code&amp;gt; or similar) to include the command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 module load mercurial&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(If you&#039;re not on an IC HPC machine mercurial is available anywhere that runs Python.  It is generally available in distribution package systems, if not you can get it from http://mercurial.selenic.com/wiki/Mercurial)&lt;br /&gt;
&lt;br /&gt;
Next, create a file called &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; in your home directory and insert the following lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 username = Your Name &amp;lt;your@email.address&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(so for example, my &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; contains this line: &amp;lt;code&amp;gt;username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
Mercurial uses this username field to record who has changed what.  (If you&#039;re not on an IC HPC machine your version of mercurial may not&lt;br /&gt;
have the graphlog extension.  If it doesn&#039;t, don&#039;t worry, it&#039;s merely a tool for visualising changesets).&lt;br /&gt;
&lt;br /&gt;
== Checking out a repository (hg clone, hg log) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s get started and check out a repository.  Once you have loaded the mercurial module you will be able to type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussian-devel/example-gaussian-repo testrepo&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a copy of the repository at &amp;lt;code&amp;gt;/home/gaussian-devel/example-gaussian-repo&amp;lt;/code&amp;gt; and place it in a directory inside the current directory called &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt;.  You can give a full path as the second argument, or, you can leave it off altogether in which case mercurial will clone the repository into a directory named &amp;lt;code&amp;gt;example-gaussian-repo&amp;lt;/code&amp;gt;.  A note here for Imperial HPC users.  Copying a repository involves quite a bit of filesystem activity.  I have found that on cx1 this can be quite slow on the &amp;lt;code&amp;gt;/home&amp;lt;/code&amp;gt; filesystems.  You may wish to try these examples in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; filesystem which is a lot faster.  Be aware, however, that this raises two potentially serious problems.  The first is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is globally readable so before you clone you must make sure that your umask is set to &amp;lt;code&amp;gt;0077&amp;lt;/code&amp;gt;.  The second, of course, is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is periodically wiped.  If you plan on working in &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; there are simple ways of transferring information between repositories (&amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt;) that I will cover later.&lt;br /&gt;
&lt;br /&gt;
Now change into the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory.  Inside you will see three scripts and a &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory; also some hidden files and a hidden directory.  Inside the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory you will see the Gaussian source in the [[Resgrp:comp-photo-new gdv layout|new layout]].  The hidden &amp;lt;code&amp;gt;.hg&amp;lt;/code&amp;gt; directory inside the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory is the repository proper; you will almost never need to do anything in here.  The rest of the files and directories are called the working directory; this is where you will do your work.&lt;br /&gt;
&lt;br /&gt;
The first thing you might want to do is check the history of this repository to see past revisions that have been checked into it.  You do this with the &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log | head -20&lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 &lt;br /&gt;
 changeset:   22:6c81eb8dcbab&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      21:5b6ac3665a29&lt;br /&gt;
 parent:      11:a0c273aeeb2b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:08 2012 +0000&lt;br /&gt;
 summary:     Gaussian devel version H13 with our makefiles&lt;br /&gt;
 &lt;br /&gt;
 changeset:   21:5b6ac3665a29&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:41:40 2012 +0000&lt;br /&gt;
 summary:     Added tag h12p for changeset 0ef14d7dff56&lt;br /&gt;
 ...&lt;br /&gt;
 changeset:   1:515a93bfc3b5&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:10 2012 +0000&lt;br /&gt;
 summary:     Added tag h01-raw for changeset 073d6aa63ea7&lt;br /&gt;
 &lt;br /&gt;
 changeset:   0:073d6aa63ea7&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h01-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:09 2012 +0000&lt;br /&gt;
 summary:     Output from old-to-new.sh on version H01&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
You will see that there are various fields that may appear for each changeset.  The changeset field shows two numbers separated by a colon.  The second, longer, hexadecimal number is the unique identifier.  A particular hex identifier will always refer to the same changeset, even in different copies of the repository.  The first number is a local identifier.  These local IDs refer to particular changesets in one copy of the repository; if these changesets are present in another repository they may have a different local identifier.    You can use either identifier as an argument to &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands.  The user and date fields show who committed the change and when.  The summary field shows the first line of the log entry for that revision.  This means it is important to try to make the first line of your log entries a useful summary of what you have done!&lt;br /&gt;
&lt;br /&gt;
To see the entry for a particular revision use the &amp;lt;code&amp;gt;-r&amp;lt;/code&amp;gt; flag with a revision number, either short or long.  To see more information, including the full log entry and a complete list of all files involved in the change, use the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag, e.g.:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -r 2 -v | less&lt;br /&gt;
 changeset:   2:9f69ed4616ad&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h08-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:54:50 2012 +0000&lt;br /&gt;
 files:       gdv/archlib/arcvib.F gdv/archlib/brcpyw.F gdv/archlib/letset.F gdv/arctmp.F gdv/bsd/GauDiff_Compare.pm gdv/bsd/G&lt;br /&gt;
 ....&lt;br /&gt;
 at.F gdv/utilnz/xpndnb.F gdv/utilnz/zerock.F gdv/utilnz/zerod.F gdv/wrappers/ggeev.F gdv/wrappers/lappar.F gdv/wrappers/xgetrf.F  gdv/wrappers/xgetrs.F gdv/wrappers/ygeru.F gdv/wrappers/ytrsv.F&lt;br /&gt;
 description:&lt;br /&gt;
 Import of gdv H08.  See below for details.&lt;br /&gt;
 &lt;br /&gt;
 Result of these commands on the H01 raw rev:&lt;br /&gt;
 rm -fr gdv&lt;br /&gt;
 cp -pr h08/new-style-gdv .&lt;br /&gt;
 hg add gdv/bsd/*.a&lt;br /&gt;
 hg addremove -s 50&lt;br /&gt;
 &lt;br /&gt;
 h08/new-style is from old-to-new.sh on freshly untarred h08.tgz&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
As the log entry explains, this particular revision is the change from the H01 version of Gaussian to the H08 version, so there are a lot of changed files.  The description entry is intended to provide some human readable explanation of the changes.  When you start committing data to the repository you should aim to at least make your log entries understandable.&lt;br /&gt;
&lt;br /&gt;
As with all the commands that I will mention you can get more information by typing &amp;lt;code&amp;gt;hg help &amp;lt;command&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Committing changes (hg summary, hg status, hg diff) ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make some alterations to this repository.  This is quite safe; we can&#039;t break the original repository because our copy is an entirely separate clone.  In fact, this is a very common working practice with mercurial.  As long as the filesystem isn&#039;t slow cloning a repository can be quite quick.  Indeed, cloning a repository into a destination on the same filesystem as the source makes use of hard linking which is very fast and saves space.  Therefore, it is very common to clone a repository, make some alterations to it, and then decide whether to push them back to the original repository or just delete the new clone.&lt;br /&gt;
&lt;br /&gt;
First, we want to know where it is we are starting from.  To get a quick summary you use the &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; command.  This should show something like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg summary&lt;br /&gt;
 parent: 23:1de40efd1c4b tip&lt;br /&gt;
 Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 branch: default&lt;br /&gt;
 commit: (clean)&lt;br /&gt;
 update: (current)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows, on the parent line, the revision that has been checked out into the working directory.  Below that is the summary line from the log entry for that revision.  The commit line shows if any files have been modified since the check out.  The update line shows if there are any applicable newer revisions in the repository.  In this example the output shows us that we checked out the revision with the local identifier 23, and unique identifier of 1de40efd1c4b, that we have modified nothing and that there are no appropriate newer revisions.  This checkout occurred automatically as a part of the &amp;lt;code&amp;gt;hg clone&amp;lt;/code&amp;gt; command.  You can clone without checking anything out into the working directory (say to make a backup copy of the repository) by passing the &amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; flag, or you can check out a particular revision with the &amp;lt;code&amp;gt;-u REV&amp;lt;/code&amp;gt; flag.  See &amp;lt;code&amp;gt;hg help clone&amp;lt;/code&amp;gt; for how mercurial chooses what to check out by default.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say we&#039;re adding a feature to link 510.  If you have something in mind go ahead and do it. For this example I have just added a few lines to the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, and will assume that your current working directory is &amp;lt;code&amp;gt;gdv/l510&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As you work you may be curious to know what it is you have changed.  The command to show this is &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The output shows a list of files that have been altered in some way.  Here the capital M shows that the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified.  By default &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; does not report on unchanged files.  If we wish to see how &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified we can use the &amp;lt;code&amp;gt;hg diff&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 11:07:55 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Add super new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows the output in a unified different format, refer to the man page for diff for more information.&lt;br /&gt;
&lt;br /&gt;
== Adding, copying, renaming, and deleting file (hg add, hg forget, hg mv, hg rm, hg cp) ==&lt;br /&gt;
&lt;br /&gt;
If you have created a new file then you must let mercurial know about its existence with the &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ echo &amp;quot;a new subroutine&amp;quot; &amp;gt; foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 ? gdv/l510/foo.F&lt;br /&gt;
 testrepo$ hg add foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here, I create a new file called &amp;lt;code&amp;gt;foo.F&amp;lt;/code&amp;gt;.  &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with a ?,  to indicate that it is unknown to the repository.  I then run &amp;lt;code&amp;gt;hg add foo.F&amp;lt;/code&amp;gt;, after which &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with an A.  This indicates that the file is scheduled to be added at the next commit.  If you change your mind about the file before the next commit you can use &amp;lt;code&amp;gt;hg forget&amp;lt;/code&amp;gt; to undo the add.&lt;br /&gt;
&lt;br /&gt;
If you are renaming a file, including the situation where you move the file from one directory to another (e.g. from l510 to utilam) then you may use the &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; command.  This will actually perform the move just like the normal &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; command.  If you&#039;ve already moved the file you can give &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; the &amp;lt;code&amp;gt;-A&amp;lt;/code&amp;gt; flag to record the rename after the fact.  Similarly, the &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt; command removes files from the working directory and records this fact in the repository, and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; copies a file.&lt;br /&gt;
&lt;br /&gt;
It is important to realise that these commands act on the working directory immediately but only affect the repository when they are committed.  Also, they do not affect the repository&#039;s previous history, so removing a file and then committing that change does not affect that file&#039;s existence in previous revisions in the repository.  However, &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; create a relationship between the source and destination files.  This becomes useful when merging in changes from somewhere else.  So for example, above I have made changes to &amp;lt;code&amp;gt;l510/a1tdep.F&amp;lt;/code&amp;gt;.  Let&#039;s say that someone else has decided to make this into a utility routine and has done the command &amp;lt;code&amp;gt;hg mv l510/a1tdep.F utilam/a1tdep.F&amp;lt;/code&amp;gt;.  If I choose to merge my changes with this other person&#039;s, mercurial will correctly apply the changes &#039;&#039;&#039;and&#039;&#039;&#039; move the file.  If instead of &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; they had used &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; then my changes would be applied to both files.  This means that you should only use &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; when it is appropriate that changes that are recorded before the copy are applied to both files.  Note that this does not mean that changes to the source file are forever applied to the destination file; this will only occur when merging a revision that does not contain a copy with a revision that does.  In general, you can expect mercurial to do the right thing.&lt;br /&gt;
&lt;br /&gt;
== Committing the changes (hg commit, hg tip) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt; (like many &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands, &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commit has an alias, in this case &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;.  I tend to use &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;) command creates a new revision and records the differences between the entire working directory and the parent revision (as shown on the parent line of &amp;lt;code&amp;gt;hg summary).  This will be the same as the output from &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;.  When you run the command mercurial will open a text editor.  If you wish to specify which editor is used add an &amp;lt;code&amp;gt;editor=vim&amp;lt;/code&amp;gt; (for example) line to the &amp;lt;code&amp;gt;[ui]&amp;lt;/code&amp;gt; part of your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file.  The editor will start with a couple of empty lines and then some lines beginning with &amp;quot;&amp;lt;code&amp;gt;HG:&amp;lt;/code&amp;gt;&amp;quot;.  These are there to give you helpful reminders of what you&#039;ve changed while you write your log message and will be ignored by mercurial when you commit.  If you close the editor without writing anything, or of the editor quits with an error, mercurial will abort the commit.  So for our current example:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci&lt;br /&gt;
 ... [opens vim]&lt;br /&gt;
 HG: Enter commit message.  Lines beginning with &#039;HG:&#039; are removed.&lt;br /&gt;
 HG: Leave message empty to abort commit.&lt;br /&gt;
 HG: --&lt;br /&gt;
 HG: user: Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 HG: branch &#039;default&#039;&lt;br /&gt;
 HG: added gdv/l510/foo.F&lt;br /&gt;
 HG: changed gdv/l510/a1tdep.F&lt;br /&gt;
 ~&lt;br /&gt;
 ~&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For short messages you can skip the editor step by passing the &amp;lt;code&amp;gt;-m &amp;quot;Log message here&amp;quot;&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
Understanding what you are doing here is essential to knowing what to write in the log and, importantly, when to commit.  There are two schools of thought.  When you commit you are creating a new revision in your local repository.  Since it is your repository, and as I have previously mentioned, it is very simple to create new repositories, you should commit whenever you feel like it and feel free to write cryptic log messages that only you will understand.  On the other hand, you are engaged in a collaborative exercise with other people: creating what will be a single version of Gaussian that contains yours and others&#039; modifications and Gaussian&#039;s updates.  Therefore, you should only commit when your code satisfies pre-agreed group requirements, and your log message should be detailed and comprehensible to anybody who reads it, even 50 years in the future.  The correct approach, of course, is to do both.&lt;br /&gt;
&lt;br /&gt;
Mercurial is a distributed version control system which means that each repository is the responsibility of its owner who can feel free to commit as frequently (or infrequently) as needed.  Sometimes adding a feature or removing a bug might take weeks, and you might feel that there is no point taking snapshots of the code until it works.  Other modifications might proceed incrementally with naturally defined stopping points between the start and the end.  Committing at these points makes perfect sense: not only does it leave a history of the modification, it provides checkpoints, versions of the code that you can retreat to without having to start again.  The log messages may tersely explain what has happened since the last revision (and note there is no point listing modified, added, etc, files as this information is stored in the commit anyway) or they may contain detailed essays on how a bug arose and the steps you have taken to fix it.  Information in the logs is searchable and should be thought of as both an aide memoir for yourself and a journal entry for others.&lt;br /&gt;
&lt;br /&gt;
When the time comes to merge your changes into other people&#039;s repositories, you might start thinking about the quality of your commit.  Does the code compile?  Does it run the test suite?  Can it run any test?  Have you committed a test that checks the code you have added or altered?  The group may decide that revisions that are being shared must answer yes to some or all of these questions.  You may decide that some or all of your revisions must pass these quality checks.  Or, you may be satisfied with noting in the log entry what this particular revision can or can&#039;t do (such as compile or run).&lt;br /&gt;
&lt;br /&gt;
It should be said though, that if you ever think &amp;quot;perhaps I should check in at this point&amp;quot;, then go for it.  Revisions live in the history of your repository forever (although see &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;), but when you transfer them to other people&#039;s repositories multiple revisions can be collapsed into one, or fixed in other ways.&lt;br /&gt;
&lt;br /&gt;
Returning to our example I enter a simple message.  Since &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; only shows the first line of any log entry by default it is a good idea to make this line a summary of the rest of the message.  I close the editor and the commit is done.&lt;br /&gt;
&lt;br /&gt;
We can see the results in the repository with an &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command (the &amp;lt;code&amp;gt;-l 2&amp;lt;/code&amp;gt; flag shows the last two revisions):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -l 2&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 summary:     A test message.&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Alternatively we can use the &amp;lt;code&amp;gt;hg tip&amp;lt;/code&amp;gt; command to show the most recently added repository, whether by ourselves, or by pulling from another repository (see later).&lt;br /&gt;
&lt;br /&gt;
== Fixing mistakes (hg revert, hg rollback) ==&lt;br /&gt;
&lt;br /&gt;
You can return one or more files, or the entire repository, to the state they were in when you last checked them out with in the &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; command.  Let&#039;s make an ill-advised alteration to our now committed change to &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ sed -i &#039;s/super/super duper/&#039; a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 13ecff0136c2 gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 17:23:42 2012 +0000&lt;br /&gt;
 @@ -27,7 +27,7 @@&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
  c&lt;br /&gt;
 -c     Add super new feature&lt;br /&gt;
 +c     Add super duper new feature&lt;br /&gt;
  c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ? gdv/l510/a1tdep.F.orig&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 testrepo$ rm a1tdep.*&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ! gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I use revert to undo the modifications to a file.  Notice that &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; leaves a copy of the modified file in &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt;.  This shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as an unknown file (&amp;quot;?&amp;quot;).  Also notice that while trying to delete the .orig file I have accidentally deleted &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, which now shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as a missing file (&amp;quot;!&amp;quot;).  I can revert this mistake too:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 testrepo$ ls a1tdep.F&lt;br /&gt;
 a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; can also be used to cancel scheduled adds, removes, copies, and renames.&lt;br /&gt;
&lt;br /&gt;
If you have just committed a revision and then change your mind you may be able to undo the effect with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;.  Doing this for our example gives us:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg rollback&lt;br /&gt;
 repository tip rolled back to revision 23 (undo commit)&lt;br /&gt;
 working directory now based on revision 23&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This removes the revision we just checked in from the repository but does not alter the current working directory.  If we choose, we could now use &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; to restore these to their revision 23 state.  There are two important caveats with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;: it can only remove the last checked in revision, and that it is usually pointless to rollback a revision that has already been pushed or pulled (see later) into somebody else&#039;s repository, as we can only affect our repository.  For the purposes of this example, I will once more check in the changes I have made:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci -m &#039;A test message&#039;&lt;br /&gt;
 testrepo$ hg tip&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:38:52 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Collaboration (hg incoming, hg pull, hg outgoing, hg push, hg update, hg parent) ==&lt;br /&gt;
&lt;br /&gt;
The tools described are already quite useful, and form the basis of the very earliest revision control systems.  The benefits of being able to detect what you&#039;ve changed, and how you&#039;ve changed it, being able to undo the changes selectively, and being able to take a snapshot of your work at any point of your choosing should be apparent.  The true power, however, of a modern version control system is how it mediates different streams of changes, particularly those from other users.  Note that a DVCS does not solve problems of merging and so on, but provides you, the user, with tools to solve them.&lt;br /&gt;
&lt;br /&gt;
Revisions in the repository form a directed acyclic graph (DAG).  Every revision apart from the first has at least one parent revision and may have zero or more child revisions.  A revision with no children is called a &#039;&#039;head&#039;&#039;.  Generally development takes place at a head of the repository: checking in a new revision onto a head creates and consumes a head.  However, it is possible to add a child to any revision, possibly creating a new head.  This is known as a branch, and may be named or unnamed.  A revision with children may still be a branch head if it has no children on its branch.&lt;br /&gt;
&lt;br /&gt;
There are various ways of managing branches.  You can have a few repositories with many branches, named and unnamed.  Or you can have many repositories with largely unbranched graphs; it&#039;s up to you.  Since mercurial uses heads as the default targets for some of its operations the latter approach is probably best for beginners as it makes operations within each repository simpler.&lt;br /&gt;
&lt;br /&gt;
This is probably best illustrated with an example.  I&#039;ll make a copy of the original repository, make a different change, and then merge the changes.  Change directory out of the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussiandevel/example-gaussian-repo testmerge&lt;br /&gt;
 updating to branch default&lt;br /&gt;
 13427 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now we go into the new repository and make some modifications.  This time I alter the files &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;a2tdep.F&amp;lt;/code&amp;gt;, and add a file &amp;lt;code&amp;gt;bar.F&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 …[alterations to a1tdep.F, a2tdep.F, and bar.F]...&lt;br /&gt;
 testmerge$ hg add gdv/l510/bar.F&lt;br /&gt;
 testmerge$ hg diff&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Some new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a2tdep.F&lt;br /&gt;
 --- a/gdv/l510/a2tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a2tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -16,6 +16,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **DETERMINE IF WE RUN THE TIMEDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Super duper feature here too&lt;br /&gt;
 +c&lt;br /&gt;
        LenTst=0&lt;br /&gt;
        CALL FILEIO(11,jTDep,LenTst,0,0)&lt;br /&gt;
        IF (LenTst.EQ.0.OR.iopv.NE.23)RETURN&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/bar.F&lt;br /&gt;
 --- /dev/null   Thu Jan 01 00:00:00 1970 +0000&lt;br /&gt;
 +++ b/gdv/l510/bar.F    Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -0,0 +1,1 @@&lt;br /&gt;
 +Stuff in here&lt;br /&gt;
 testmerge$&lt;br /&gt;
 testmerge$ hg ci -m &#039;Added second new feature&#039;&lt;br /&gt;
 testmerge$ hg log -l 2&lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The situation now is that we have two repositories where there are revisions whose parent is revision 23 (23:1de40efd1c4b, in fact).  This sort of scenario might arise because we have been working on two different features in two different repositories, or it may be that two users have been working separately.  At some point you may wish to merge the work.  It&#039;s up to you when and how you do this: you may wish to merge in bug fixes quite frequently, and incorporate brand-new features much less frequently.  You can of course clone another repository in which to do the merge so that if it isn&#039;t satisfactory you can just delete the repository.&lt;br /&gt;
&lt;br /&gt;
First we must pull the revisions from one repository to another.  We use the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pull&amp;lt;/code&amp;gt; commands to do this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg incoming ../testrepo&lt;br /&gt;
 comparing with ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testmerge$ hg pull ../testrepo&lt;br /&gt;
 pulling from ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 adding changesets&lt;br /&gt;
 adding manifests&lt;br /&gt;
 adding file changes&lt;br /&gt;
 added 1 changesets with 2 changes to 2 files (+1 heads)&lt;br /&gt;
 (run &#039;hg heads&#039; to see heads, &#039;hg merge&#039; to merge)&lt;br /&gt;
 testmerge$ hg log -l 3&lt;br /&gt;
 changeset:   25:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 &lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command takes another repository as its argument and shows a list of revisions that are not present in the current repository.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command brings those revisions over into the current repository.  The &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command shows changeset 25 in the testmerge repository corresponds to number 24 in the original &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository.  Note the long ID is the same in both cases.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command reports that it has created a new head.  We can see this clearly with the &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt; command (from the graphlog extension). The &amp;lt;code&amp;gt;-r 23:&amp;lt;/code&amp;gt; flag tells &amp;lt;code&amp;gt;glog&amp;lt;/code&amp;gt; to show revisions 23 and greater, for clarity:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -r 23:&lt;br /&gt;
 o  changeset:   25:13ecff0136c2&lt;br /&gt;
 |  tag:         tip&lt;br /&gt;
 |  parent:      23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 |  summary:     A test message&lt;br /&gt;
 |&lt;br /&gt;
 | @  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; command can also be used to copy revisions from one repository to another.  It works much as you would expect, except that by default it does not permit the creation of new heads in the destination repository.  The idea is that you tend to pull into your own repository, where you&#039;re expected to know what you&#039;re doing, while you might be pushing into someone else&#039;s repository, where creating a new head might cause confusion.  &amp;lt;code&amp;gt;hg outgoing&amp;lt;/code&amp;gt; is the corresponding analogue to the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
In our example we now have a situation where we have two heads.  This can arise from revisions being created in different repositories and then pulled together, as shown.  Alternatively you can just create new heads in one repository.  A disadvantage of the single repository technique is that if you decide branch is going nowhere and elect not to merge or proceed with it, it still remains in your repository.  With multiple repositories you can just delete the offending repository.&lt;br /&gt;
&lt;br /&gt;
== Merging two sets of changes (hg merge, hg resolve) ==&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say that I decide that these two features will work together and I want to merge the two branches.  I can use the &amp;lt;code&amp;gt;hg up&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;hg update&amp;lt;/code&amp;gt;) command to update the current working directory to a particular revision in the repository.  If no revision is specified it will update to the current branch head.  The revision updated to becomes the parent (as shown by &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg parent&amp;lt;/code&amp;gt;) of the working directory.  If there are modified files in the working directory the update may attempt a merge.  The revision of the working directory when you start to merge is called the base of the merge.  This is important if the two revisions you are merging are on different branches, because the newly merged revision will stay on the base branch.  Note that the &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command does not update the working directory, so in this case it will still be at revision 24.  Let&#039;s update to revision 25 and then merge the changes from revision 24:&lt;br /&gt;
&lt;br /&gt;
[Which revision to merge from: in general you merge changes into whatever is your current baseline.  So, if you&#039;re merging the latest updates from Gaussian (from H10 to H11 for example) into your code, you update to your code and merge in the H11 revision.  If you&#039;re merging in your changes into the soon to be sent to Gaussian group development version you&#039;d start with that and merge in the revision(s) containing your changes]&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg up 25&lt;br /&gt;
 3 files updated, 0 files merged, 1 files removed, 0 files unresolved&lt;br /&gt;
 testmerge$ hg merge 24&lt;br /&gt;
 merging gdv/l510/a1tdep.F&lt;br /&gt;
 warning: conflicts during merge.&lt;br /&gt;
 merging gdv/l510/a1tdep.F failed!&lt;br /&gt;
 2 files updated, 0 files merged, 0 files removed, 1 files unresolved&lt;br /&gt;
 use &#039;hg resolve&#039; to retry unresolved file merges or &#039;hg update -C .&#039; to abandon&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The software automatically brings in the changes to foo.F, bar.F, and a2tdep.F (as &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; will show).  However, in our contrived example &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; is subject to changes from both revisions.  Mercurial will attempt to merge automatically, and in this case it fails.  If you edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; you will see it contains the lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 =======&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
which were inserted during the failed merge.  There is also an &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt; file created as a result of the failed merge.  As the output from &amp;lt;code&amp;gt;hg merge&amp;lt;/code&amp;gt; says you can either now resolve this failed merge or use &amp;lt;code&amp;gt;hg update -C&amp;lt;/code&amp;gt; to undo it (the &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; file will remain).&lt;br /&gt;
&lt;br /&gt;
Since we want to resolve the merge we should edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; so that it works.  At a bare minimum we will have to remove the “&amp;lt;code&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&amp;lt;/code&amp;gt;”, “&amp;lt;code&amp;gt;=======&amp;lt;/code&amp;gt;”, and “&amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&amp;lt;/code&amp;gt;” marker lines.  In a more complex situation we might have to completely rewrite this and other files.  This is what I mean when I say that mercurial only provides tools to do merging.  Even a completely successful merge, from mercurial&#039;s point of view, may be completely bogus code.&lt;br /&gt;
&lt;br /&gt;
There are tools available to make this task easier.  For example I use &amp;lt;code&amp;gt;vimdiff&amp;lt;/code&amp;gt;, a part of the popular &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; package.  To enable this I have altered my &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file to look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 merge = vimdiff&lt;br /&gt;
 username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
 &lt;br /&gt;
 [merge-tools]&lt;br /&gt;
 vimdiff.executable = vim&lt;br /&gt;
 vimdiff.args = -d $base $local $output $other +close +close&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
as per http://mercurial.selenic.com/wiki/MergingWithVim.  The page http://mercurial.selenic.com/wiki/MergeProgram contains instructions for other tools, including Emacs, and graphical tools.  If you edit your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file in this way then you now can type &amp;lt;code&amp;gt;hg resolve --all&amp;lt;/code&amp;gt; to run your chosen tool on all unresolved files.  Note that by default if your chosen tool exits without an error then &amp;lt;code&amp;gt;hg resolve&amp;lt;/code&amp;gt; will regard that file as resolved.  To cause &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; to exit with an error use &amp;lt;code&amp;gt;:cq&amp;lt;/code&amp;gt;.  See &amp;lt;code&amp;gt;hg help resolve&amp;lt;/code&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
In the example my resolution is to have the relevant lines in &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 c&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Tags and named branches ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other commands ==&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=228026</id>
		<title>Resgrp:comp-photo-version control</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=228026"/>
		<updated>2012-02-05T21:32:58Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction. ==&lt;br /&gt;
&lt;br /&gt;
This document will teach you the basics of using mercurial, a distributed version control system (DVCS).  It is particularly directed towards using mercurial with the development version of Gaussian, so the examples will use Gaussian.  For more information on mercurial you can use the built-in help system &amp;lt;code&amp;gt;hg help&amp;lt;/code&amp;gt;, look at the official website: &amp;lt;http://mercurial.selenic.com/wiki/Mercurial&amp;gt;, or check out the official O&#039;Reilly book, the text of which is freely available at: &amp;lt;http://hgbook.red-bean.com/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A version control system can sometimes seem an onerous imposition unless the user understands how it is going to help them in their work, so I&#039;ll try to briefly explain.  Version control is about tracking changes to data.  If one has a collection of files, say a distribution of Gaussian, then one is interested in changes that have been made to those files, whether from a new distribution from Gaussian or our own modifications.  We are particularly interested in cases where overlapping changes have been made.  These might be updates and bug fixes from Gaussian conflicting with our own modifications to a particular link, or it might be different researchers in a group working on the same piece of code independently.  A version control system will not only detect such cases but provide automated and safe methods of merging conflicting changes.&lt;br /&gt;
&lt;br /&gt;
Central to the idea of a VCS is the concept of a revision or changeset.  This is like a snapshot of some set of files and directories at some particular instant in their history.  A repository is where a VCS stores revisions.  So, using Gaussian as an example, some revisions in a particular repository might be the Gaussian source tree corresponding to Gaussian development versions H01, H08, H10, H11, etc.  The data that are actually kept inside the repository are the differences, or deltas, between the revisions.  This saves space compared to storing all the revisions.&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment (for hpc.ic). ==&lt;br /&gt;
There are some one-off things you must do.  Firstly, edit your login scripts (&amp;lt;code&amp;gt;.bash_profile&amp;lt;/code&amp;gt; or similar) to include the line:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 module load mercurial&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(If you&#039;re not on an IC HPC machine mercurial is available anywhere that runs Python.  It is generally available in distribution package systems, if not you can get it from &amp;lt;http://mercurial.selenic.com/wiki/Mercurial&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Next, create a file called &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; in your home directory and insert the following lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 username = Your Name &amp;lt;your@email.address&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(so for example, my &amp;lt;code&amp;gt;.hgrc&amp;lt;/code&amp;gt; contains this line: &amp;lt;code&amp;gt;username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
Mercurial uses this username field to record who has changed what.&lt;br /&gt;
&lt;br /&gt;
== Checking out a repository. ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s get started and check out a repository.  Once you have loaded the mercurial module you will be able to type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussian-devel/official-gaussian-version testrepo&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a copy of the repository at &amp;lt;code&amp;gt;/home/gaussian-devel/official-gaussian-version&amp;lt;/code&amp;gt; and place it in a directory inside the current directory called &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt;.  You can give a full path as the second argument, or, you can leave it off altogether in which case mercurial will clone the repository into a directory named &amp;lt;code&amp;gt;official-gaussian-version&amp;lt;/code&amp;gt;.  A note here for Imperial HPC users.  Copying a repository involves quite a bit of filesystem activity.  I have found that on cx1 this can be quite slow on the /home filesystems.  You may wish to try these examples in the &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; filesystem which is a lot faster.  Be aware, however, that there are two potentially serious problems.  The first is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is globally readable so before you clone you must make sure that your umask is set to &amp;lt;code&amp;gt;0077&amp;lt;/code&amp;gt;.  The second, of course, is that &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; is periodically wiped.  If you plan on working in &amp;lt;code&amp;gt;/tmp&amp;lt;/code&amp;gt; there are simple ways of transferring information between repositories (&amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt;) that I will cover later.&lt;br /&gt;
&lt;br /&gt;
Change into the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory.  Inside you will see three scripts and a &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory; also some hidden files and a hidden directory.  Inside the &amp;lt;code&amp;gt;gdv&amp;lt;/code&amp;gt; directory you will see the Gaussian source in the new layout.  The hidden &amp;lt;code&amp;gt;.hg&amp;lt;/code&amp;gt; directory inside the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; directory is the repository proper; you will almost never need to do anything in here.  The rest of the files and directories are called the working directory; this is where you will do your work.&lt;br /&gt;
&lt;br /&gt;
The first thing you might want to do is check the history of this repository to see past revisions that have been checked into it.  You do this with the &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log | head -20&lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 &lt;br /&gt;
 changeset:   22:6c81eb8dcbab&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      21:5b6ac3665a29&lt;br /&gt;
 parent:      11:a0c273aeeb2b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:08 2012 +0000&lt;br /&gt;
 summary:     Gaussian devel version H13 with our makefiles&lt;br /&gt;
 &lt;br /&gt;
 changeset:   21:5b6ac3665a29&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:41:40 2012 +0000&lt;br /&gt;
 summary:     Added tag h12p for changeset 0ef14d7dff56&lt;br /&gt;
 ...&lt;br /&gt;
 changeset:   1:515a93bfc3b5&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:10 2012 +0000&lt;br /&gt;
 summary:     Added tag h01-raw for changeset 073d6aa63ea7&lt;br /&gt;
 &lt;br /&gt;
 changeset:   0:073d6aa63ea7&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h01-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:09 2012 +0000&lt;br /&gt;
 summary:     Output from old-to-new.sh on version H01&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
You will see that there are various fields that may appear for each changeset.  The changeset field shows two numbers separated by a colon.  The second, longer, hexadecimal number is the unique identifier.  A particular hex identifier will always refer to the same changeset, even in different copies of the repository.  The first number is a local identifier.  These local IDs refer to particular changesets in one copy of the repository; if these changesets are present in another repository they may have a different local identifier.    You can use either identifier as an argument to &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands.  The user and date fields show who committed the change and when.  The summary field shows the first line of the log entry for that revision.  This means it is important to try to make the first line of your log entries a useful summary of what you have done!&lt;br /&gt;
&lt;br /&gt;
To see the log entry for a particular revision use the &amp;lt;code&amp;gt;-r&amp;lt;/code&amp;gt; flag with a revision number, either short or long.  To see more information, including the full log entry and a complete list of all files involved in the change, use the &amp;lt;code&amp;gt;-v&amp;lt;/code&amp;gt; flag, e.g.:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -r 2 -v | less&lt;br /&gt;
 changeset:   2:9f69ed4616ad&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h08-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:54:50 2012 +0000&lt;br /&gt;
 files:       gdv/archlib/arcvib.F gdv/archlib/brcpyw.F gdv/archlib/letset.F gdv/arctmp.F gdv/bsd/GauDiff_Compare.pm gdv/bsd/G&lt;br /&gt;
 ....&lt;br /&gt;
 at.F gdv/utilnz/xpndnb.F gdv/utilnz/zerock.F gdv/utilnz/zerod.F gdv/wrappers/ggeev.F gdv/wrappers/lappar.F gdv/wrappers/xgetrf.F  gdv/wrappers/xgetrs.F gdv/wrappers/ygeru.F gdv/wrappers/ytrsv.F&lt;br /&gt;
 description:&lt;br /&gt;
 Import of gdv H08.  See below for details.&lt;br /&gt;
 &lt;br /&gt;
 Result of these commands on the H01 raw rev:&lt;br /&gt;
 rm -fr gdv&lt;br /&gt;
 cp -pr h08/new-style-gdv .&lt;br /&gt;
 hg add gdv/bsd/*.a&lt;br /&gt;
 hg addremove -s 50&lt;br /&gt;
 &lt;br /&gt;
 h08/new-style is from old-to-new.sh on freshly untarred h08.tgz&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
As the log entry explains, this particular revision is the change from the H01 version of Gaussian to the H08 version, so there are a lot of changed files.  The full log entry is intended to provide some human readable explanation of the changes.  When you start committing data to the repository you should aim to at least make your log entries understandable.&lt;br /&gt;
&lt;br /&gt;
As with all the commands that I will mention you can get more information by typing &amp;lt;code&amp;gt;hg help&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
== Committing changes. ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make some alterations to this repository.  This is quite safe; we can&#039;t break the original repository because our copy is an entirely separate clone.  In fact, this is a very common working practice with mercurial.  As long as the filesystem isn&#039;t slow cloning a repository can be quite quick.  Indeed, cloning a repository into a destination on the same filesystem as the source makes use of hard linking which is very fast and saves space.  Therefore, it is very common to clone a repository, make some alterations to it, and then decide whether to push them back to the original repository or just delete the new clone.&lt;br /&gt;
&lt;br /&gt;
First, we want to know where it is we are starting from.  To get a quick summary you use the &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; command.  This should show something like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg summary&lt;br /&gt;
 parent: 23:1de40efd1c4b tip&lt;br /&gt;
 Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 branch: default&lt;br /&gt;
 commit: (clean)&lt;br /&gt;
 update: (current)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows, on the parent line, the revision that has been checked out into the working directory.  Below that is the summary line from the log entry for that revision.  The commit line shows if any files have been modified since the check out.  The update line shows if there are any applicable newer revisions in the repository.  In this example the output shows us that we checked out the revision with the local identifier 23, and unique identifier of 1de40efd1c4b, that we have modified nothing and that there are no appropriate newer revisions.  This checkout occurred automatically as a part of the &amp;lt;code&amp;gt;hg clone&amp;lt;/code&amp;gt; command.  You can clone without checking anything out into the working directory (say to make a backup copy of the repository) by passing the &amp;lt;code&amp;gt;-U&amp;lt;/code&amp;gt; flag, or you can check out a particular revision with the &amp;lt;code&amp;gt;-u REV&amp;lt;/code&amp;gt; flag.  See &amp;lt;code&amp;gt;hg help clone&amp;lt;/code&amp;gt; for how mercurial chooses what to check out by default.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say we&#039;re adding a feature to link 510.  If you have something in mind go ahead and do it. For this example I have just added a few lines to the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, and will assume that your current working directory is &amp;lt;code&amp;gt;gdv/l510&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
As you work you may be curious to know what it is you have changed.  The command to show this is &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The output shows a list of files that have been altered in some way.  Here the capital M shows that the file &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified.  By default &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; does not report on unchanged files.  If we wish to see how &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; has been modified we can use the &amp;lt;code&amp;gt;hg diff&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 11:07:55 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Add super new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows the output in a unified different format, refer to the man page for diff for more information.&lt;br /&gt;
&lt;br /&gt;
== Adding, copying, renaming, and deleting files. ==&lt;br /&gt;
&lt;br /&gt;
If you have created a new file then you must let mercurial know about its existence with the &amp;lt;code&amp;gt;hg add&amp;lt;/code&amp;gt; command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ echo &amp;quot;a new subroutine&amp;quot; &amp;gt; foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 ? gdv/l510/foo.F&lt;br /&gt;
 testrepo$ hg add foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here, I create a new file called &amp;lt;code&amp;gt;foo.F&amp;lt;/code&amp;gt;.  &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with a ?,  to indicate that it is unknown to the repository.  I then run &amp;lt;code&amp;gt;hg add foo.F&amp;lt;/code&amp;gt;, after which &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; shows the file with an A.  This indicates that the file is scheduled to be added at the next commit.  If you change your mind about the file before the next commit you can use &amp;lt;code&amp;gt;hg forget&amp;lt;/code&amp;gt; to undo the add.&lt;br /&gt;
&lt;br /&gt;
If you are renaming a file, including the situation where you move the file from one directory to another (e.g. from l510 to utilam) then you may use the &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; command.  This will actually perform the move just like the normal &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; command.  If you&#039;ve already moved the file you can give &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; the &amp;lt;code&amp;gt;-A&amp;lt;/code&amp;gt; flag to record the rename after the fact.  Similarly, the &amp;lt;code&amp;gt;hg rm&amp;lt;/code&amp;gt; command removes files from the working directory and records this fact in the repository, and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; copies a file.&lt;br /&gt;
&lt;br /&gt;
It is important to realise that these commands act on the working directory immediately but only affect the repository when they are committed.  Also, they do not affect the repository&#039;s previous history, so removing a file and then committing that change does not affect that file&#039;s existence in previous revisions in the repository.  However, &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; create a relationship between the source and destination files.  This becomes useful when merging in changes from somewhere else.  So for example, above I have made changes to &amp;lt;code&amp;gt;l510/a1tdep.F&amp;lt;/code&amp;gt;.  Let&#039;s say that someone else has decided to make this into a utility routine and has done the command &amp;lt;code&amp;gt;hg mv l510/a1tdep.F utilam/a1tdep.F&amp;lt;/code&amp;gt;.  If I choose to merge my changes with this other person&#039;s, mercurial will correctly apply the changes &#039;&#039;&#039;and&#039;&#039;&#039; move the file.  If instead of &amp;lt;code&amp;gt;hg mv&amp;lt;/code&amp;gt; they had used &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; then my changes would be applied to both files.  This means that you should only use &amp;lt;code&amp;gt;hg cp&amp;lt;/code&amp;gt; when it is appropriate that changes that are recorded before the copy are applied to both files.  Note that this does not mean that changes to the source file are forever applied to the destination file; this will only occur when merging a revision that does not contain a copy with a revision that does.  In general, you can expect mercurial to do the right thing.&lt;br /&gt;
&lt;br /&gt;
== Committing the changes. ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;hg commit&amp;lt;/code&amp;gt; (like many &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commands, &amp;lt;code&amp;gt;hg&amp;lt;/code&amp;gt; commit has an alias, in this case &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;.  I tend to use &amp;lt;code&amp;gt;hg ci&amp;lt;/code&amp;gt;) command creates a new revision and records the differences between the entire working directory and the parent revision (as shown on the parent line of &amp;lt;code&amp;gt;hg summary).  This will be the same as the output from &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt;.  When you run the command mercurial will open a text editor.  If you wish to specify which editor is used add an &amp;lt;code&amp;gt;editor=vim&amp;lt;/code&amp;gt; (for example) line to the &amp;lt;code&amp;gt;[ui]&amp;lt;/code&amp;gt; part of your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file.  The editor will start with a couple of empty lines and then some lines beginning with &amp;quot;&amp;lt;code&amp;gt;HG:&amp;lt;/code&amp;gt;&amp;quot;.  These are there to give you helpful reminders of what you&#039;ve changed while you write your log message and will be ignored by mercurial when you commit.  If you close the editor without writing anything, or of the editor quits with an error, mercurial will abort the commit.  So for our current example:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci&lt;br /&gt;
 ... [opens vim]&lt;br /&gt;
 HG: Enter commit message.  Lines beginning with &#039;HG:&#039; are removed.&lt;br /&gt;
 HG: Leave message empty to abort commit.&lt;br /&gt;
 HG: --&lt;br /&gt;
 HG: user: Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 HG: branch &#039;default&#039;&lt;br /&gt;
 HG: added gdv/l510/foo.F&lt;br /&gt;
 HG: changed gdv/l510/a1tdep.F&lt;br /&gt;
 ~&lt;br /&gt;
 ~&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For short messages you can skip the editor step by passing the &amp;lt;code&amp;gt;-m &amp;quot;Log message here&amp;quot;&amp;lt;/code&amp;gt; flag.&lt;br /&gt;
&lt;br /&gt;
Understanding what you are doing here is essential to knowing what to write in the log and, importantly, when to commit.  There are two schools of thought.  When you commit you are creating a new revision in your local repository.  Since it is your repository, and as I have previously mentioned, it is very simple to create new repositories, you should commit whenever you feel like it and feel free to write cryptic log messages that only you will understand.  On the other hand, you are engaged in a collaborative exercise with other people: creating what will be a single version of Gaussian that contains yours and others&#039; modifications and Gaussian&#039;s updates.  Therefore, you should only commit when your code satisfies pre-agreed group requirements, and your log message should be detailed and comprehensible to anybody who reads it, even 50 years in the future.  The correct approach, of course, is to do both.&lt;br /&gt;
&lt;br /&gt;
Mercurial is a distributed version control system which means that each repository is the responsibility of its owner who can feel free to commit as frequently (or infrequently) as needed.  Sometimes adding a feature or removing a bug might take weeks, and you might feel that there is no point taking snapshots of the code until it works.  Other modifications might proceed incrementally with naturally defined stopping points between the start and the end.  Committing at these points makes perfect sense: not only does it leave a history of the modification, it provides checkpoints, versions of the code that you can retreat to without having to start again.  The log messages may tersely explain what has happened since the last revision (and note there is no point listing modified, added, etc, files as this information is stored in the commit anyway) or they may contain detailed essays on how a bug arose and the steps you have taken to fix it.  Information in the logs is searchable and should be thought of as both an aide memoir for yourself and a journal entry for others.&lt;br /&gt;
&lt;br /&gt;
When the time comes to merge your changes into other people&#039;s repositories, you might start thinking about the quality of your commit.  Does the code compile?  Does it run the test suite?  Can it run any test?  Have you committed a test that checks the code you have added or altered?  The group may decide that revisions that are being shared must answer yes to some or all of these questions.  You may decide that some or all of your revisions must pass these quality checks.  Or, you may be satisfied with noting in the log entry what this particular revision can or can&#039;t do (such as compile or run).&lt;br /&gt;
&lt;br /&gt;
It should be said though, that if you ever think &amp;quot;perhaps I should check in at this point&amp;quot;, then go for it.  Revisions live in the history of your repository forever (although see &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;), but when you transfer them to other people&#039;s repositories multiple revisions can be collapsed into one, or fixed in other ways.&lt;br /&gt;
&lt;br /&gt;
Returning to our example I enter a simple message.  Since &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; only shows the first line of any log entry by default it is a good idea to make this line a summary of the rest of the message.  I close the editor and the commit is done.&lt;br /&gt;
&lt;br /&gt;
We can see the results in the repository with an &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command (the &amp;lt;code&amp;gt;-l 2&amp;lt;/code&amp;gt; flag shows the last two revisions):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -l 2&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 summary:     A test message.&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Alternatively we can use the &amp;lt;code&amp;gt;hg tip&amp;lt;/code&amp;gt; command to show the most recently added repository, whether by ourselves, or by pulling from another repository (see later).&lt;br /&gt;
&lt;br /&gt;
== Fixing mistakes. ==&lt;br /&gt;
&lt;br /&gt;
You can return one or more files, or the entire repository, to the state they were in when you last checked them out with in the &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; command.  Let&#039;s make an ill-advised alteration to our now committed change to &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ sed -i &#039;s/super/super duper/&#039; a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 13ecff0136c2 gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 17:23:42 2012 +0000&lt;br /&gt;
 @@ -27,7 +27,7 @@&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
  c&lt;br /&gt;
 -c     Add super new feature&lt;br /&gt;
 +c     Add super duper new feature&lt;br /&gt;
  c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ? gdv/l510/a1tdep.F.orig&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 testrepo$ rm a1tdep.*&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ! gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I use revert to undo the modifications to a file.  Notice that &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; leaves a copy of the modified file in &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt;.  This shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as an unknown file (&amp;quot;?&amp;quot;).  Also notice that while trying to delete the .orig file I have accidentally deleted &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt;, which now shows up in &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; as a missing file (&amp;quot;!&amp;quot;).  I can revert this mistake too:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 testrepo$ ls a1tdep.F&lt;br /&gt;
 a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; can also be used to cancel scheduled adds, removes, copies, and renames.&lt;br /&gt;
&lt;br /&gt;
If you have just committed a revision and then change your mind you may be able to undo the effect with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;.  Doing this for our example gives us:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg rollback&lt;br /&gt;
 repository tip rolled back to revision 23 (undo commit)&lt;br /&gt;
 working directory now based on revision 23&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This removes the revision we just checked in from the repository but does not alter the current working directory.  If we choose, we could now use &amp;lt;code&amp;gt;hg revert&amp;lt;/code&amp;gt; to restore these to their revision 23 state.  There are two important caveats with &amp;lt;code&amp;gt;hg rollback&amp;lt;/code&amp;gt;: it can only remove the last checked in revision, and that it is usually pointless to rollback a revision that has already been pushed or pulled (see later) into somebody else&#039;s repository, as we can only affect our repository.  For the purposes of this example, I will once more check in the changes I have made:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci -m &#039;A test message&#039;&lt;br /&gt;
 testrepo$ hg tip&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:38:52 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Collaboration. ==&lt;br /&gt;
&lt;br /&gt;
The tools described are already quite useful, and form the basis of the very earliest revision control systems.  The benefits of being able to detect what you&#039;ve changed, and how you&#039;ve changed it, being able to undo the changes selectively, and being able to take a snapshot of your work at any point of your choosing should be apparent.  The true power, however, of a modern version control system is how it mediates different streams of changes, particularly those from other users.  Note that a DVCS does not solve problems of merging and so on, but provides you, the user, with tools to solve them.&lt;br /&gt;
&lt;br /&gt;
Revisions in the repository form a directed acyclic graph (DAG).  Every revision apart from the first has at least one parent revision and may have zero or more child revisions.  A revision with no children is called a &amp;quot;head&amp;quot;.  Generally development takes place at a head of the repository: checking in a new revision onto a head creates and consumes a head.  However, it is possible to add a child to any revision, possibly creating a new head.  This is known as a branch, and may be named or unnamed.  A revision with children may still be a branch head if it has no children on its branch.&lt;br /&gt;
&lt;br /&gt;
There are various ways of managing branches.  You can have a few repositories with many branches, named and unnamed.  Or you can have many repositories with largely unbranched graphs; it&#039;s up to you.  Since mercurial uses heads as the default targets for some of its operations the latter approach is probably best for beginners as it makes operations within each repository simpler.&lt;br /&gt;
&lt;br /&gt;
This is probably best illustrated with an example.  Change directory out of the &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone -r 23 testrepo testmerge&lt;br /&gt;
 updating to branch default&lt;br /&gt;
 13427 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will clone a copy of &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; with revision 23 and all its ancestors.  This checks out everything except our test revision and is equivalent to cloning a fresh copy of the gaussian-official-version repository; this way is probably faster.&lt;br /&gt;
&lt;br /&gt;
Now we go into the new repository and make some modifications.  This time I alter the files &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;a2tdep.F&amp;lt;/code&amp;gt;, and add a file &amp;lt;code&amp;gt;bar.F&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;l510&amp;lt;/code&amp;gt; directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 …[some alterations]...&lt;br /&gt;
 testmerge$ hg add gdv/l510/bar.F&lt;br /&gt;
 testmerge$ hg diff&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Some new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a2tdep.F&lt;br /&gt;
 --- a/gdv/l510/a2tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a2tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -16,6 +16,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **DETERMINE IF WE RUN THE TIMEDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Super duper feature here too&lt;br /&gt;
 +c&lt;br /&gt;
        LenTst=0&lt;br /&gt;
        CALL FILEIO(11,jTDep,LenTst,0,0)&lt;br /&gt;
        IF (LenTst.EQ.0.OR.iopv.NE.23)RETURN&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/bar.F&lt;br /&gt;
 --- /dev/null   Thu Jan 01 00:00:00 1970 +0000&lt;br /&gt;
 +++ b/gdv/l510/bar.F    Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -0,0 +1,1 @@&lt;br /&gt;
 +Stuff in here&lt;br /&gt;
 testmerge$&lt;br /&gt;
 testmerge$ hg ci -m &#039;Added second new feature&#039;&lt;br /&gt;
 testmerge$ hg log -l 2&lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The situation now is that we have two repositories where there are revisions whose parent is revision 23 (23:1de40efd1c4b, in fact).  This sort of scenario might arise because we have been working on two different features in two different repositories, or it may be that two users have been working separately.  At some point you may wish to merge the work.  It&#039;s up to you when and how you do this: you may wish to merge in bug fixes quite frequently, and incorporate brand-new features much less frequently.  You can of course clone another repository in which to do the merge so that if it isn&#039;t satisfactory you can just delete the repository.&lt;br /&gt;
&lt;br /&gt;
First we must pull the revisions from one repository to another.  We use the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;pull&amp;lt;/code&amp;gt; commands to do this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg incoming ../testrepo&lt;br /&gt;
 comparing with ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testmerge$ hg pull ../testrepo&lt;br /&gt;
 pulling from ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 adding changesets&lt;br /&gt;
 adding manifests&lt;br /&gt;
 adding file changes&lt;br /&gt;
 added 1 changesets with 2 changes to 2 files (+1 heads)&lt;br /&gt;
 (run &#039;hg heads&#039; to see heads, &#039;hg merge&#039; to merge)&lt;br /&gt;
 testmerge$ hg log -l 3&lt;br /&gt;
 changeset:   25:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 &lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command takes another repository as its argument and shows a list of revisions that are not present in the current repository.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command brings those revisions over into the current repository.  The &amp;lt;code&amp;gt;hg log&amp;lt;/code&amp;gt; command shows changeset 25 in the testmerge repository corresponds to number 24 in the original &amp;lt;code&amp;gt;testrepo&amp;lt;/code&amp;gt; repository.  Note the long ID is the same in both cases.  The &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command reports that it has created a new head.  We can see this clearly with the &amp;lt;code&amp;gt;hg glog&amp;lt;/code&amp;gt; command (from the graphlog extension). The &amp;lt;code&amp;gt;-r 23:&amp;lt;/code&amp;gt; flag tells &amp;lt;code&amp;gt;glog&amp;lt;/code&amp;gt; to show revisions 23 and greater, for clarity:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -r 23:&lt;br /&gt;
 o  changeset:   25:13ecff0136c2&lt;br /&gt;
 |  tag:         tip&lt;br /&gt;
 |  parent:      23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 |  summary:     A test message&lt;br /&gt;
 |&lt;br /&gt;
 | @  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The &amp;lt;code&amp;gt;hg push&amp;lt;/code&amp;gt; command can also be used to copy revisions from one repository to another.  It works much as you would expect, except that by default it does not permit the creation of new heads in the destination repository.  The idea is that you tend to pull into your own repository, where you&#039;re expected to know what you&#039;re doing, while you might be pushing into someone else&#039;s repository, where creating a new head might cause confusion.  &amp;lt;code&amp;gt;hg outgoing&amp;lt;/code&amp;gt; is the corresponding analogue to the &amp;lt;code&amp;gt;hg incoming&amp;lt;/code&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
In our example we now have a situation where we have two heads.  This can arise from revisions being created in different repositories and then pulled together, as shown.  Alternatively you can just create new heads in one repository.  A disadvantage of the single repository technique is that if you decide branch is going nowhere and elect not to merge or proceed with it, it still remains in your repository.  With multiple repositories you can just delete the offending repository.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say that I decide that these two features will work together and I want to merge the two branches.  I can use the &amp;lt;code&amp;gt;hg up&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;hg update&amp;lt;/code&amp;gt;) command to update the current working directory to a particular revision in the repository.  If no revision is specified it will update to the current branch head.  The revision updated to becomes the parent (as shown by &amp;lt;code&amp;gt;hg summary&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;hg parent&amp;lt;/code&amp;gt;) of the working directory.  If there are modified files in the working directory the update may attempt a merge.  The revision of the working directory when you start to merge is called the base of the merge.  This is important if the two revisions you are merging are on different branches, because the newly merged revision will stay on the base branch.  Note that the &amp;lt;code&amp;gt;hg pull&amp;lt;/code&amp;gt; command does not update the working directory, so in this case it will still be at revision 24.  Let&#039;s update to revision 25 and then merge the changes from revision 24:&lt;br /&gt;
&lt;br /&gt;
[Which revision to merge from: in general you merge changes into whatever is your current baseline.  So, if you&#039;re merging the latest updates from Gaussian (from H10 to H11 for example) into your code, you update to your code and merge in the H11 revision.  If you&#039;re merging in your changes into the soon to be sent to Gaussian group development version you&#039;d start with that and merge in the revision(s) containing your changes]&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg up 25&lt;br /&gt;
 3 files updated, 0 files merged, 1 files removed, 0 files unresolved&lt;br /&gt;
 testmerge$ hg merge 24&lt;br /&gt;
 merging gdv/l510/a1tdep.F&lt;br /&gt;
 warning: conflicts during merge.&lt;br /&gt;
 merging gdv/l510/a1tdep.F failed!&lt;br /&gt;
 2 files updated, 0 files merged, 0 files removed, 1 files unresolved&lt;br /&gt;
 use &#039;hg resolve&#039; to retry unresolved file merges or &#039;hg update -C .&#039; to abandon&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The software automatically brings in the changes to foo.F, bar.F, and a2tdep.F (as &amp;lt;code&amp;gt;hg status&amp;lt;/code&amp;gt; will show).  However, in our deliberately contrived example &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; is subject to changes from both revisions.  Mercurial will attempt to merge automatically, and in this case it fails.  If you edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; you will see it contains the lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 =======&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
which were inserted during the failed merge.  There is also an &amp;lt;code&amp;gt;a1tdep.F.orig&amp;lt;/code&amp;gt; file created as a result of the failed merge.  As the output from &amp;lt;code&amp;gt;hg merge&amp;lt;/code&amp;gt; says you can either now resolve this failed merge or use &amp;lt;code&amp;gt;hg update -C&amp;lt;/code&amp;gt; to undo it (the &amp;lt;code&amp;gt;.orig&amp;lt;/code&amp;gt; file will remain).&lt;br /&gt;
&lt;br /&gt;
Since we want to resolve the merge we could edit &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; so that it works.  This would certainly involve removing the “&amp;lt;code&amp;gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&amp;lt;/code&amp;gt;”, “&amp;lt;code&amp;gt;=======&amp;lt;/code&amp;gt;”, and “&amp;lt;code&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&amp;lt;/code&amp;gt;” lines, but might involve a complete rewrite of this and other files.  This is what I mean when I say that mercurial only provides tools to do merging.  Even a completely successful merge, from mercurial&#039;s point of view, may be completely bogus code.  However, there are tools available to make this task easier.  For example I use &amp;lt;code&amp;gt;vimdiff&amp;lt;/code&amp;gt;, a part of the popular &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; package.  To enable this I have altered my &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file to look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 merge = vimdiff&lt;br /&gt;
 username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
 &lt;br /&gt;
 [merge-tools]&lt;br /&gt;
 vimdiff.executable = vim&lt;br /&gt;
 vimdiff.args = -d $base $local $output $other +close +close&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
as per &amp;lt;http://mercurial.selenic.com/wiki/MergingWithVim&amp;gt;.  The page &amp;lt;http://mercurial.selenic.com/wiki/MergeProgram&amp;gt; contains instructions for other tools, including Emacs, and graphical tools.  If you edit your &amp;lt;code&amp;gt;~/.hgrc&amp;lt;/code&amp;gt; file in this way then you now can type &amp;lt;code&amp;gt;hg resolve --all&amp;lt;/code&amp;gt; to run your chosen tool on all unresolved files.  Note that by default if your chosen tool exits without an error then mercurial will regard that file as resolved.  To cause &amp;lt;code&amp;gt;vim&amp;lt;/code&amp;gt; to exit with an error use &amp;lt;code&amp;gt;:cq&amp;lt;/code&amp;gt;.  See &amp;lt;code&amp;gt;hg help resolve&amp;lt;/code&amp;gt; for more details.&lt;br /&gt;
&lt;br /&gt;
In the example my resolution is to have the offending lines in &amp;lt;code&amp;gt;a1tdep.F&amp;lt;/code&amp;gt; look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 c&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=227537</id>
		<title>Resgrp:comp-photo-version control</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=227537"/>
		<updated>2012-02-04T22:58:03Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction. ==&lt;br /&gt;
&lt;br /&gt;
This document will teach you the basics of using mercurial, a distributed version control system (DVCS).  It is particularly directed towards using mercurial with the development version of Gaussian, so the examples will use Gaussian.  For more information on mercurial you can use the built-in help system &amp;quot;hg help&amp;quot;, look at the official website: &amp;lt;http://mercurial.selenic.com/wiki/Mercurial&amp;gt;, or check out the official O&#039;Reilly book, the text of which is freely available at: &amp;lt;http://hgbook.red-bean.com/&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A version control system can sometimes seem an onerous imposition unless the user understands how it is going to help them in their work, so I&#039;ll try to briefly explain.  Version control is about tracking changes to data.  If one has a collection of files, say a distribution of Gaussian, then one is interested in changes that have been made to those files, whether from a new distribution from Gaussian or our own modifications.  We are particularly interested in cases where overlapping changes have been made.  These might be updates and bug fixes from Gaussian conflicting with our own modifications to a particular link, or it might be different researchers in a group working on the same piece of code independently.  A version control system will not only detect such cases but provide automated and safe methods of merging conflicting changes.&lt;br /&gt;
&lt;br /&gt;
Central to the idea of a VCS is the concept of a revision or changeset.  This is like a snapshot of some set of files and directories at some particular instant in their history.  A repository is where a VCS stores revisions.  So, using Gaussian as an example, some revisions in a particular repository might be the Gaussian source tree corresponding to Gaussian development versions H01, H08, H10, H11, etc.  The data that are actually kept inside the repository are the differences, or deltas, between the revisions.  This saves space compared to storing all the revisions.&lt;br /&gt;
&lt;br /&gt;
== Setting up your environment (for hpc.ic). ==&lt;br /&gt;
&lt;br /&gt;
There are some one-off things you must do.  Firstly, edit your login scripts (.bash_profile or similar) to include the line:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 module load mercurial&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(If you&#039;re not on an IC HPC machine mercurial is available anywhere that runs Python.  It is generally available in distribution package systems, if not you can get it from &amp;lt;http://mercurial.selenic.com/wiki/Mercurial&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Next, create a file called .hgrc in your home directory and insert the following lines:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 username = Your Name &amp;lt;your@email.address&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
(so for example, my &amp;lt;code&amp;gt;.hgrc&amp;lt;/code contains this line: &amp;lt;code&amp;gt;username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
Mercurial uses this username field to record who has changed what.&lt;br /&gt;
&lt;br /&gt;
== Checking out a repository. ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s get started and check out a repository.  Once you have loaded the mercurial module you will be able to type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone /home/gaussian-devel/official-gaussian-version testrepo&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will create a copy of the repository at &amp;lt;code&amp;gt;/home/gaussian-devel/official-gaussian-version&amp;lt;/code&amp;gt; and place it in a directory inside the current directory called testrepo.  You can give a full path as the second argument, or, you can leave it off altogether in which case mercurial will clone the repository into a directory named official-gaussian-version.  A note here for Imperial HPC users.  Copying a repository involves quite a bit of filesystem activity.  I have found that on cx1 this can be quite slow on the /home filesystems.  You may wish to try these examples in the /tmp filesystem which is a lot faster.  Be aware, however, that there are two potentially serious problems.  The first is that /tmp is globally readable so before you clone you must make sure that your umask is set to 0077.  The second, of course, is that /tmp is periodically wiped.  If you plan on working in /tmp there are simple ways of transferring information between repositories (hg push and hg pull) that I will cover later.&lt;br /&gt;
&lt;br /&gt;
Change into the testrepo directory.  Inside you will see three scripts and a gdv directory; also some hidden files and a hidden directory.  Inside the gdv directory you will see the Gaussian source in the new layout.  The hidden .hg directory inside the testrepo directory is the repository proper; you will almost never need to do anything in here.  The rest of the files and directories are called the working directory; this is where you will do your work.&lt;br /&gt;
&lt;br /&gt;
The first thing you might want to do is check the history of this repository to see pat revisions that have been checked into it.  You do this with the hg log command.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log | head -20&lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 &lt;br /&gt;
 changeset:   22:6c81eb8dcbab&lt;br /&gt;
 tag:         h13&lt;br /&gt;
 parent:      21:5b6ac3665a29&lt;br /&gt;
 parent:      11:a0c273aeeb2b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:08 2012 +0000&lt;br /&gt;
 summary:     Gaussian devel version H13 with our makefiles&lt;br /&gt;
 &lt;br /&gt;
 changeset:   21:5b6ac3665a29&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:41:40 2012 +0000&lt;br /&gt;
 summary:     Added tag h12p for changeset 0ef14d7dff56&lt;br /&gt;
 ...&lt;br /&gt;
 changeset:   1:515a93bfc3b5&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:10 2012 +0000&lt;br /&gt;
 summary:     Added tag h01-raw for changeset 073d6aa63ea7&lt;br /&gt;
 &lt;br /&gt;
 changeset:   0:073d6aa63ea7&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h01-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:39:09 2012 +0000&lt;br /&gt;
 summary:     Output from old-to-new.sh on version H01&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
You will see that there are various fields that may appear for each changeset.  The changeset field shows two numbers separated by a colon.  The second, longer, hexadecimal number is the unique identifier.  A particular hex identifier will always refer to the same changeset, even in different copies of the repository.  The first number is a local identifier.  These local IDs refer to particular changesets in one copy of the repository; if these changesets are present in another repository they may have a different local identifier.    You can use either identifier as an argument to hg commands.  The user and date fields show who committed the change and when.  The summary field shows the first line of the log entry for that revision.  This means it is important to try to make the first line of your log entries a useful summary of what you have done!&lt;br /&gt;
&lt;br /&gt;
To see the log entry for a particular revision use the -r flag with a revision number, either short or long.  To see more information, including the full log entry and a complete list of all files involved in the change, use the -v flag, e.g.:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -r 2 -v | less&lt;br /&gt;
 changeset:   2:9f69ed4616ad&lt;br /&gt;
 branch:      raw&lt;br /&gt;
 tag:         h08-raw&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Sun Jan 15 11:54:50 2012 +0000&lt;br /&gt;
 files:       gdv/archlib/arcvib.F gdv/archlib/brcpyw.F gdv/archlib/letset.F gdv/arctmp.F gdv/bsd/GauDiff_Compare.pm gdv/bsd/G&lt;br /&gt;
 ....&lt;br /&gt;
 at.F gdv/utilnz/xpndnb.F gdv/utilnz/zerock.F gdv/utilnz/zerod.F gdv/wrappers/ggeev.F gdv/wrappers/lappar.F gdv/wrappers/xgetrf.F  gdv/wrappers/xgetrs.F gdv/wrappers/ygeru.F gdv/wrappers/ytrsv.F&lt;br /&gt;
 description:&lt;br /&gt;
 Import of gdv H08.  See below for details.&lt;br /&gt;
 &lt;br /&gt;
 Result of these commands on the H01 raw rev:&lt;br /&gt;
 rm -fr gdv&lt;br /&gt;
 cp -pr h08/new-style-gdv .&lt;br /&gt;
 hg add gdv/bsd/*.a&lt;br /&gt;
 hg addremove -s 50&lt;br /&gt;
 &lt;br /&gt;
 h08/new-style is from old-to-new.sh on freshly untarred h08.tgz&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
As the log entry explains, this particular revision is the change from the H01 version of Gaussian to the H08 version, so there are a lot of changed files.  The full log entry is intended to provide some human readable explanation of the changes.  When you start committing data to the repository you should aim to at least make your log entries understandable.&lt;br /&gt;
&lt;br /&gt;
As with all the commands that I will mention you can get more information by typing hg help command.&lt;br /&gt;
&lt;br /&gt;
== Committing changes. ==&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make some alterations to this repository.  This is quite safe; we can&#039;t break the original repository because our copy is an entirely separate clone.  In fact, this is a very common working practice with mercurial.  As long as the filesystem isn&#039;t slow cloning repository can be quite quick.  Indeed, cloning repository into a destination on the same filesystem as the source makes use of hard linking which is very fast and saves space.  Therefore, it is very common to clone a repository, make some alterations to it, and then decide whether to push them back to the original repository or just delete the new clone.&lt;br /&gt;
&lt;br /&gt;
First, we want to know where it is we are starting from.  To get a quick summary you use the &amp;quot;hg summary&amp;quot; command.  This should show something like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg summary&lt;br /&gt;
 parent: 23:1de40efd1c4b tip&lt;br /&gt;
 Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 branch: default&lt;br /&gt;
 commit: (clean)&lt;br /&gt;
 update: (current)&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows, on the parent line, the revision that has been checked out into the working directory.  Below that is the summary line from the log entry for that revision.  The commit line shows if any files have been modified since the check out.  The update line shows if there are any applicable newer revisions in the repository.  In this example the output shows us that we checked out the revision with the local identifier 23, and unique identifier of 1de40efd1c4b, that we have modified nothing and that there are no appropriate newer revisions.  This checkout occurred automatically as a part of the hg clone command.  You can clone without checking anything out into the working directory (say to make a backup copy of the repository) by passing the -U flag, or you can check out a particular revision with the -u REV flag.  See hg help clone for how hg chooses what to check out by default.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say we&#039;re adding a feature to link 510.  If you have something in mind go ahead and do it.  For this example I have just added a few lines to the file a1tdep.F, and will assume that your current working directory is gdv/l510.&lt;br /&gt;
&lt;br /&gt;
As you work you may be curious to know what it is you have changed.  The command to show this is hg status:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The output shows a list of files that have been altered in some way.  Here the capital M shows that the file a1tdep.F has been modified.  By default hg status does not report on unchanged files.  If we wish to see how a1tdep.F has been modified we can use the hg diff command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 11:07:55 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Add super new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This shows the output in a unified different format, refer to the man page for diff for more information.&lt;br /&gt;
&lt;br /&gt;
== Adding, copying, renaming, and deleting files. ==&lt;br /&gt;
&lt;br /&gt;
If you have created a new file then you must let mercurial know about its existence with the hg add command:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ echo &amp;quot;a new subroutine&amp;quot; &amp;gt; foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 ? gdv/l510/foo.F&lt;br /&gt;
 testrepo$ hg add foo.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here, I create a new file called foo.F.  hg status shows the file with a ?,  to indicate that it is unknown to the repository.  I then run &amp;quot;hg add foo.F&amp;quot;, after which hg status shows the file with an A.  This indicates that the file is scheduled to be added at the next commit.  If you change your mind about the file before the next commit you can use hg forget to undo the add.&lt;br /&gt;
&lt;br /&gt;
If you are renaming a file, including the situation where you move the file from one directory to another (e.g. from l510 to utilam) then you may use the hg mv command.  This will actually perform the move just like the normal mv command.  If you&#039;ve already moved the file you can give hg mv the -A flag to record the rename after the fact.  Similarly, the hg rm command removes files from the working directory and records this fact in the repository, and hg cp copies a file.&lt;br /&gt;
&lt;br /&gt;
It is important to realise that these commands (and hg copy) act on the working directory immediately but only affect the repository when they are committed.  Also, they do not affect the repository&#039;s previous history, so removing a file and then committing that change does not affect that file&#039;s existence in previous revisions in the repository.  However, hg mv and hg cp create a relationship between the source and destination files.  This becomes useful when merging in changes from somewhere else.  So for example, above I have made changes to l510/a1tdep.F.  Let&#039;s say that someone else has decided to make this into a utility routine and has done the command hg mv l510/a1tdep.F utilam/a1tdep.F.  If I choose to merge my changes with this other person&#039;s, mercurial will correctly apply the changes AND move the file.  If instead of hg mv they had used hg cp then my changes would be applied to both files.  This means that you should only use hg cp when it is appropriate that changes that are recorded before the copy are applied to both files.  Note that this does not mean that changes to the source file are forever applied to the destination file; this will only occur when merging a revision that does not contain a copy with a revision that does.  In general, you can expect mercurial to do the right thing.&lt;br /&gt;
&lt;br /&gt;
== Committing the changes. ==&lt;br /&gt;
&lt;br /&gt;
The hg commit (like many hg commands, hg commit has an alias, in this case hg ci.  I tend to use hg ci) command creates a new revision and records the differences between the entire working directory and the parent revision (as shown on the parent line of hg summary).  This will be the same as the output from hg status.  When you run the command mercurial will open a text editor.  If you wish to specify which editor is used add an editor=vim (for example) line to the [ui] part of your ~/.hgrc file.  The editor will start with a couple of empty lines and then some lines beginning with &amp;quot;HG:&amp;quot;.  These are there to give you helpful reminders of what you&#039;ve changed while you write your log message and will be ignored by mercurial when you commit.  If you close the editor without writing anything, or of the editor quits with an error, mercurial will abort the commit.  So for our current example:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci&lt;br /&gt;
 ... [opens vim]&lt;br /&gt;
 HG: Enter commit message.  Lines beginning with &#039;HG:&#039; are removed.&lt;br /&gt;
 HG: Leave message empty to abort commit.&lt;br /&gt;
 HG: --&lt;br /&gt;
 HG: user: Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 HG: branch &#039;default&#039;&lt;br /&gt;
 HG: added gdv/l510/foo.F&lt;br /&gt;
 HG: changed gdv/l510/a1tdep.F&lt;br /&gt;
 ~&lt;br /&gt;
 ~&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
For short messages you can skip the editor step by passing the -m &amp;quot;Log message here&amp;quot; flag.&lt;br /&gt;
&lt;br /&gt;
Understanding what you are doing here is essential to knowing what to write in the log and, importantly, when to commit.  There are two schools of thought.  When you commit you are creating a new revision in your local repository.  Since it is your repository, and as I have previously mentioned, it is very simple to create new repositories, you should commit whenever you feel like it and feel free to write cryptic log messages that only you will understand.  On the other hand, you are engaged in a collaborative exercise with other people: creating what will be a single version of Gaussian that contains yours and others&#039; modifications and Gaussian&#039;s updates.  Therefore, you should only commit when your code satisfies pre-agreed group requirements, and your log message should be detailed and comprehensible to anybody who reads it, even 50 years in the future.  The correct approach, of course, is to do both.&lt;br /&gt;
&lt;br /&gt;
Mercurial is a distributed version control system which means that each repository is the responsibility of its owner who can feel free to commit as frequently (or infrequently) as needed.  Sometimes adding a feature or removing a bug might take weeks, and you might feel that there is no point taking snapshots of the code until it works.  Other modifications might proceed incrementally with naturally defined stopping points between the start and the end.  Committing at these points makes perfect sense: not only does it leave a history of the modification, it provides checkpoints, versions of the code that you can retreat to without having to start again.  The log messages may tersely explain what has happened since the last revision (and note there is no point listing modified, added, etc, files as this information is stored in the commit anyway) or they may contain detailed essays on how a bug arose and the steps you have taken to fix it.  Information in the logs is searchable and should be thought of as both an aide memoir for yourself and a journal entry for others.&lt;br /&gt;
&lt;br /&gt;
When the time comes to merge your changes into other people&#039;s repositories, you might start thinking about the quality of your commit.  Does the code compile?  Does it run the test suite?  Can it run any test?  Have you committed a test that checks the code you have added or altered?  The group may decide that revisions that are being shared must answer yes to some or all of these questions.  You may decide that some or all of your revisions must pass these quality checks.  Or, you may be satisfied with noting in the log entry what this particular revision can or can&#039;t do (such as compile or run).&lt;br /&gt;
&lt;br /&gt;
It should be said though, that if you ever think &amp;quot;perhaps I should check in at this point&amp;quot;, then go for it.  Revisions live in the history of your repository forever (although see hg rollback), but when you transfer them to other people&#039;s repositories multiple revisions can be collapsed into one, or fixed in other ways.&lt;br /&gt;
&lt;br /&gt;
Returning to our example I enter a simple message.  Since hg log only shows the first line of any log entry by default it is a good idea to make this line a summary of the rest of the message.  I close the editor and the commit is done.&lt;br /&gt;
&lt;br /&gt;
We can see the results in the repository with an hg log command (the -l 2 flag shows the last five revisions):&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg log -l 2&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 summary:     A test message.&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Alternatively we can use the hg tip command to show the most recently added repository, whether by ourselves, or by pulling from another repository (see later).&lt;br /&gt;
&lt;br /&gt;
== Fixing mistakes. ==&lt;br /&gt;
&lt;br /&gt;
You can return one or more files, or the entire repository, to the state they were in when you last checked them out with in the hg revert command.  Let&#039;s make an ill-advised alteration to our now committed change to a1tdep.F:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ sed -i &#039;s/super/super duper/&#039; a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 diff -r 13ecff0136c2 gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 25 17:13:00 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Wed Jan 25 17:23:42 2012 +0000&lt;br /&gt;
 @@ -27,7 +27,7 @@&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
  c&lt;br /&gt;
 -c     Add super new feature&lt;br /&gt;
 +c     Add super duper new feature&lt;br /&gt;
  c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ? gdv/l510/a1tdep.F.orig&lt;br /&gt;
 testrepo$ hg diff a1tdep.F&lt;br /&gt;
 testrepo$ rm a1tdep.*&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 ! gdv/l510/a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Here I use revert to undo the modifications to a file.  Notice that hg revert leaves a copy of the modified file in a1tdep.F.orig.  This shows up in hg status as an unknown file (&amp;quot;?&amp;quot;).  Also notice that while trying to delete the .orig file I have accidentally deleted a1tdep.F, which now shows up in hg status as a missing file (&amp;quot;!&amp;quot;).  I can revert this mistake too:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg revert a1tdep.F&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 testrepo$ ls a1tdep.F&lt;br /&gt;
 a1tdep.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
hg revert can also be used to cancel scheduled adds, removes, copies, and renames.&lt;br /&gt;
&lt;br /&gt;
If you have just committed a revision and then change your mind you may be able to undo the effect with hg rollback.  Doing this for our example gives us:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg rollback&lt;br /&gt;
 repository tip rolled back to revision 23 (undo commit)&lt;br /&gt;
 working directory now based on revision 23&lt;br /&gt;
 testrepo$ hg status&lt;br /&gt;
 M gdv/l510/a1tdep.F&lt;br /&gt;
 A gdv/l510/foo.F&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This removes the revision we just checked in from the repository but does not alter the current working directory.  If we choose, we could now use hg revert to restore these to their revision 23 state.  There are two important caveats with hg rollback: it can only remove the last checked in revision, and that it is usually pointless to rollback a revision that has already been pushed or pulled (see later) into somebody else&#039;s repository, as we can only affect our repository.  For the purposes of this example, I will once more check in the changes I have made:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testrepo$ hg ci -m &#039;A test message&#039;&lt;br /&gt;
 testrepo$ hg tip&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:38:52 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testrepo$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Collaboration. ==&lt;br /&gt;
&lt;br /&gt;
The tools described are already quite useful, and form the basis of the very earliest revision control systems.  The benefits of being able to detect what you&#039;ve changed, and how you&#039;ve changed it, being able to undo the changes selectively, and being able to take a snapshot of your work at any point of your choosing should be apparent.  The true power, however, of a modern version control system is how it mediates different streams of changes, particularly those from other users.  Note that a DVCS does not solve problems of merging and so on, but provides you, the user, with tools to solve them.&lt;br /&gt;
&lt;br /&gt;
Revisions in the repository form a directed acyclic graph (DAG).  Every revision apart from the first has at least one parent revision and may have zero or more child revisions.  A revision with no children is called a &amp;quot;head&amp;quot;.  Generally development takes place at a head of the repository: checking in a new revision onto a head creates and consumes a head.  However, it is possible to add a child to any revision, possibly creating a new head.  This is known as a branch, and may be named or unnamed.  A revision with children may still be a branch head if it has no children on its branch.&lt;br /&gt;
&lt;br /&gt;
There are various ways of managing branches.  You can have a few repositories with many branches, named and unnamed.  Or you can have many repositories with largely unbranched graphs; it&#039;s up to you.  Since mercurial uses heads as the default targets for some of its operations the latter approach is probably best for beginners as it makes operations within each repository simpler.&lt;br /&gt;
&lt;br /&gt;
This is probably best illustrated with an example.  Change directory out of the testrepo repository and type:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 tmp$ hg clone -r 23 testrepo testmerge&lt;br /&gt;
 updating to branch default&lt;br /&gt;
 13427 files updated, 0 files merged, 0 files removed, 0 files unresolved&lt;br /&gt;
 tmp$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
This will clone a copy of testrepo with revision 23 and all its ancestors.  This checks out everything except our test revision and is equivalent to cloning a fresh copy of the gaussian-official-version repository; this way is probably faster.&lt;br /&gt;
&lt;br /&gt;
Now we go into the new repository and make some modifications.  This time I alter the files a1tdep.F and a2tdep.F, and add a file bar.F in the l510 directory:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 …[some alterations]...&lt;br /&gt;
 testmerge$ hg add gdv/l510/bar.F&lt;br /&gt;
 testmerge$ hg diff&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a1tdep.F&lt;br /&gt;
 --- a/gdv/l510/a1tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a1tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -26,6 +26,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **OPTIONS FOR TDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Some new feature&lt;br /&gt;
 +c&lt;br /&gt;
        iTDep=813&lt;br /&gt;
        iTrans=822&lt;br /&gt;
        jTDep=iTDep&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/a2tdep.F&lt;br /&gt;
 --- a/gdv/l510/a2tdep.F Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 +++ b/gdv/l510/a2tdep.F Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -16,6 +16,9 @@&lt;br /&gt;
  C&lt;br /&gt;
  C     **DETERMINE IF WE RUN THE TIMEDEP CODE&lt;br /&gt;
  C&lt;br /&gt;
 +c&lt;br /&gt;
 +c     Super duper feature here too&lt;br /&gt;
 +c&lt;br /&gt;
        LenTst=0&lt;br /&gt;
        CALL FILEIO(11,jTDep,LenTst,0,0)&lt;br /&gt;
        IF (LenTst.EQ.0.OR.iopv.NE.23)RETURN&lt;br /&gt;
 diff -r 1de40efd1c4b gdv/l510/bar.F&lt;br /&gt;
 --- /dev/null   Thu Jan 01 00:00:00 1970 +0000&lt;br /&gt;
 +++ b/gdv/l510/bar.F    Thu Jan 26 12:15:13 2012 +0000&lt;br /&gt;
 @@ -0,0 +1,1 @@&lt;br /&gt;
 +Stuff in here&lt;br /&gt;
 testmerge$&lt;br /&gt;
 testmerge$ hg ci -m &#039;Added second new feature&#039;&lt;br /&gt;
 testmerge$ hg log -l 2&lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The situation now is that we have two repositories where there are revisions whose parent is revision 23 (23:1de40efd1c4b, in fact).  This sort of scenario might arise because we have working on two different features in two different repositories, or it may be that two users have been working separately.  At some point you may wish to merge the work.  It&#039;s up to you when and how you do this: you may wish to merge in bug fixes quite frequently, and incorporate brand-new features much less frequently.  You can of course clone another repository in which to do the merge so that if it isn&#039;t satisfactory you can just delete the repository.&lt;br /&gt;
&lt;br /&gt;
First we must pull the revisions from one repository to another.  We use the hg incoming and pull commands to do this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg incoming ../testrepo&lt;br /&gt;
 comparing with ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 changeset:   24:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 testmerge$ hg pull ../testrepo&lt;br /&gt;
 pulling from ../testrepo&lt;br /&gt;
 searching for changes&lt;br /&gt;
 adding changesets&lt;br /&gt;
 adding manifests&lt;br /&gt;
 adding file changes&lt;br /&gt;
 added 1 changesets with 2 changes to 2 files (+1 heads)&lt;br /&gt;
 (run &#039;hg heads&#039; to see heads, &#039;hg merge&#039; to merge)&lt;br /&gt;
 testmerge$ hg log -l 3&lt;br /&gt;
 changeset:   25:13ecff0136c2&lt;br /&gt;
 tag:         tip&lt;br /&gt;
 parent:      23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 summary:     A test message&lt;br /&gt;
 &lt;br /&gt;
 changeset:   24:457db23c0b1a&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 summary:     Added second new feature&lt;br /&gt;
 &lt;br /&gt;
 changeset:   23:1de40efd1c4b&lt;br /&gt;
 user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The hg incoming command takes another repository as its argument and shows a list of revisions that are not present in the current repository.  The hg pull command brings those revisions over into the current repository.  The hg log command shows changeset 25 in the testmerge repository corresponds to number 24 in the original testrepo repository.  Note the long ID is the same in both cases.  The hg pull command reports that it has created a new head.  We can see this clearly with the hg glog command (from the graphlog extension). The &amp;quot;-r 23:&amp;quot; flag tells glog to show revisions 23 and greater, for clarity:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg glog -r 23:&lt;br /&gt;
 o  changeset:   25:13ecff0136c2&lt;br /&gt;
 |  tag:         tip&lt;br /&gt;
 |  parent:      23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 25 17:39:50 2012 +0000&lt;br /&gt;
 |  summary:     A test message&lt;br /&gt;
 |&lt;br /&gt;
 | @  changeset:   24:457db23c0b1a&lt;br /&gt;
 |/   user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |    date:        Thu Jan 26 12:15:54 2012 +0000&lt;br /&gt;
 |    summary:     Added second new feature&lt;br /&gt;
 |&lt;br /&gt;
 o  changeset:   23:1de40efd1c4b&lt;br /&gt;
 |  user:        Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 |  date:        Wed Jan 18 14:43:13 2012 +0000&lt;br /&gt;
 |  summary:     Added tag h13 for changeset 6c81eb8dcbab&lt;br /&gt;
 |&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The hg push command can also be used to copy revisions from one repository to another.  It works much as you would expect, except that by default it does not permit the creation of new heads in the destination repository.  The idea is that you tend to pull into your own repository, where you&#039;re expected to know what you&#039;re doing, while you might be pushing into someone else&#039;s repository, where creating a new head might cause confusion.  hg outgoing is the corresponding analogue to the hg incoming command.&lt;br /&gt;
&lt;br /&gt;
In our example we now have a situation where we have two heads.  This can arise from revisions being created in different repositories and then pulled together, as shown.  Alternatively you can just create new heads in one repository.  A disadvantage of the single repository technique is that if you decide branch is going nowhere and elect not to merge or proceed with it, it still remains in your repository.  With multiple repositories you can just delete the offending repository.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say that I decide that these two features will work together and I want to merge the two branches.  I can use the hg up (hg update) command to update the current working directory to a particular revision in the repository.  If no revision is specified it will update to the current branch head.  The revision updated to becomes the parent (as shown by hg summary or hg parent) of the working directory.  If there are modified files in the working directory the update may attempt a merge.  The revision of the working directory when you start to merge is called the base of the merge.  This is important if the two revisions you are merging are on different branches, because the newly merged revision will stay on the base branch.  Note that the hg pull command does not update the working directory, so in this case it will still be at revision 24.  Let&#039;s update to revision 25 and then merge the changes from revision 24:&lt;br /&gt;
&lt;br /&gt;
[Which revision to merge from: in general you merge changes into whatever is your current baseline.  So, if you&#039;re merging the latest updates from Gaussian (from H10 to H11 for example) into your code, you update to your code and merge in the H11 revision.  If you&#039;re merging in your changes into the soon to be sent to Gaussian group development version you&#039;d start with that and merge in the revision(s) containing your changes]&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 testmerge$ hg up 25&lt;br /&gt;
 3 files updated, 0 files merged, 1 files removed, 0 files unresolved&lt;br /&gt;
 testmerge$ hg merge 24&lt;br /&gt;
 merging gdv/l510/a1tdep.F&lt;br /&gt;
 warning: conflicts during merge.&lt;br /&gt;
 merging gdv/l510/a1tdep.F failed!&lt;br /&gt;
 2 files updated, 0 files merged, 0 files removed, 1 files unresolved&lt;br /&gt;
 use &#039;hg resolve&#039; to retry unresolved file merges or &#039;hg update -C .&#039; to abandon&lt;br /&gt;
 testmerge$&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The software automatically brings in the changes to foo.F, bar.F, and a2tdep.F (as hg status will show).  However, in our deliberately contrived example a1tdep.F is subject to changes from both revisions.  Mercurial will attempt to merge automatically, and in this case it fails.  If you edit a1tdep.F you will see it contains the lines:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 =======&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
which were inserted during the failed merge.  There is also an a1tdep.F.orig file created as a result of the failed merge.  As the output from hg merge says you can either now resolve this failed merge or use hg update -C to undo it (the .orig file will remain).&lt;br /&gt;
&lt;br /&gt;
Since we want to resolve the merge we could edit a1tdep.F so that it works.  This would certainly involve removing the “&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; local”, “=======”, and “&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; other” lines, but might involve a complete rewrite of this and other files.  This is what I mean when I say that mercurial only provides tools to do merging.  Even a completely successful merge, from mercurial&#039;s point of view, may be completely bogus code.  However, there are tools available to make this task easier.  For example I use vimdiff, a part of the popular vim package.  To enable this I have altered my ~/.hgrc file to look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 [ui]&lt;br /&gt;
 merge = vimdiff&lt;br /&gt;
 username = Simon Clifford &amp;lt;simon.j.clifford@gmail.com&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 [extensions]&lt;br /&gt;
 graphlog=&lt;br /&gt;
 &lt;br /&gt;
 [merge-tools]&lt;br /&gt;
 vimdiff.executable = vim&lt;br /&gt;
 vimdiff.args = -d $base $local $output $other +close +close&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
as per http://mercurial.selenic.com/wiki/MergingWithVim.  The page http://mercurial.selenic.com/wiki/MergeProgram contains instructions for other tools, including Emacs, and graphical tools.  If you edit your ~/.hgrc file in this way then you now can type hg resolve --all to run your chosen tool on all unresolved files.  Note that by default if your chosen tool exits without an error then mercurial will regard that file as resolved.  To cause vim to exit with an error use :cq.  See hg help resolve for more details.&lt;br /&gt;
&lt;br /&gt;
In the example my resolution is to have the offending lines in a1tdep.F look like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 c&lt;br /&gt;
 c     Add super new feature&lt;br /&gt;
 c     Some new feature&lt;br /&gt;
 c&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
	<entry>
		<id>https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=227534</id>
		<title>Resgrp:comp-photo-version control</title>
		<link rel="alternate" type="text/html" href="https://chemwiki.ch.ic.ac.uk/index.php?title=Resgrp:comp-photo-version_control&amp;diff=227534"/>
		<updated>2012-02-04T22:07:44Z</updated>

		<summary type="html">&lt;p&gt;Scliffor: Created page with &amp;quot;La la la.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;La la la.&lt;/div&gt;</summary>
		<author><name>Scliffor</name></author>
	</entry>
</feed>