Commits

php committed 5c004c5

Update 20111207

  • Participants
  • Parent commits 2929093

Comments (0)

Files changed (4)

File css/styles.css

     margin: 0.2em 1em 1em;
     font-size: 90%;
 }
+
+/*
+ * code and commands
+ */
+pre, .output {
+	font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif;
+}
+
+.output {
+    border-left: 1px #ccc solid;
+    border-right: 1px #ccc solid;
+	background-color: #eee;
+    margin: 0.2em 1em 1em;	
+    padding: 0.3em 1em;
+	white-space: pre-wrap;
+	font-size: 90%;
+}
+
+.output:first-line {
+	font-size: 90%;
+	font-style: italic;
+}
+

File guide/index.html

 
 <h5>Add files and track them</h5>
 
+<p>Enter the project folder, create some files, then add and commit them.</p>
+
 <pre>$ cd project
-$ (add files)
+$ echo 'print("Hello")' > hello.py
 $ hg add
 $ hg commit
 (enter the commit message)
 
 </pre>
 
+<div class="output">output of hg add:
+adding hello.py
+</div>
+
+<div class="output">display of hg commit (with your message):
+Initial commit.
+
+HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+HG: Leave message empty to abort commit.
+HG: --
+HG: user: Mr. Johnson &lt;johnson@smith.com&gt;
+HG: branch 'default'
+HG: added hello.py
+</div>
+
 <div class="note">
 <p class="note-title">Note:</p>
 You can also go into an existing directory with files and init the repository there.
 
 </pre>
 
-<p>Alternatively you can add only specific files instead of all files in the directory. Mercurial will then track only these files and won't know about the others. The following tells mercurial to track all files whose names begin with "file0" as well as file10, file11 and file12.</p>
+<p>Also you can add only specific files instead of all files in the directory. Mercurial will then track only these files and won't know about the others. The following tells mercurial to track all files whose names begin with "file0" as well as file10, file11 and file12.</p>
 
 <pre>$ hg add file0* file10 file11 file12
 
 
 <h5>Save changes</h5>
 
-<pre>$ (do some changes)
+<p>First do some changes:</p>
+
+<pre>$ echo 'print("Hello World") > hello.py
 
 </pre>
 
 
 </pre>
 
+<div class="output">output of hg status:
+M hello.py
+</div>
+
+
 <p>see the exact changes</p>
 
 <pre>$ hg diff
 
 </pre>
 
+<div class="output">output of hg diff:
+diff --git a/hello.py b/hello.py
+--- a/hello.py
++++ b/hello.py
+@@ -1,1 +1,1 @@
+-print("Hello")
++print("Hello World")
+</div>
+
+
 <p><em>commit</em> the changes.</p>
 
 <pre>$ hg commit
 
 <p>now an editor pops up and asks you for a commit message. Upon saving and closing the editor, your changes have been stored by Mercurial.</p>
 
+<div class="output">display of hg commit (with your message):
+Say Hello World, not just Hello.
+
+HG: Enter commit message.  Lines beginning with 'HG:' are removed.
+HG: Leave message empty to abort commit.
+HG: --
+HG: user: Mr. Johnson &lt;johnson@smith.com&gt;
+HG: branch 'default'
+HG: changed hello.py
+</div>
+
 <div class="note">
 <p class="note-title">Note:</p>
 You can also supply the commit message directly via <em>hg commit -m 'MESSAGE'</em>.
 </div>
 
-<h5>Move and copy files</h5>
+<h5>Copy and move files</h5>
 
 <p>When you copy or move files, you should tell Mercurial to do the copy or move for you, so it can track the relationship between the files.</p>
 
 <p>Remember to <em>commit</em> after moving or copying. From the basic commands only <em>commit</em> creates a new revision</p>
 
-<pre>$ hg cp original copy
-$ hg commit
-(enter the commit message)
-$ hg mv original target
+<pre>$ hg cp hello.py copy
+$ hg mv hello.py target
+$ hg diff # see the changes
 $ hg commit
 (enter the commit message)
 
 
 <p>Now you have two files, "copy" and "target", and Mercurial knows how they are related.</p>
 
+<div class="output">output of hg diff (before the commit): 
+diff --git a/hello.py b/copy
+rename from hello.py
+rename to copy
+diff --git a/hello.py b/target
+copy from hello.py
+copy to target
+</div>
+
 <div class="note">
 <p class="note-title">Note:</p>
 Should you forget to do the explicit copy or move, you can still tell Mercurial to detect the changes via <em>hg addremove --similarity 100</em>. Just use <em>hg help addremove</em> for details.
 
 <p>This prints a list of changesets along with their date, the user who committed them (you) and their commit message. </p>
 
+<div class="output">output of hg log:
+changeset:   2:70eb0ca9d264
+tag:         tip
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 11:20:00 2011 +0100
+summary:     Copy and move.
+
+changeset:   1:487d7a20ccbc
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 11:11:00 2011 +0100
+summary:     Say Hello World, not just Hello.
+
+changeset:   0:a5ecbf5799c8
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 11:00:00 2011 +0100
+summary:     Initial commit.
+</div>
+
 <p>To see a certain revision, you can use the <em>-r</em> switch (--revision). To also see the diff of the displayed revisions, there's the <em>-p</em> switch (--patch)</p>
 
 <pre>$ hg log -p -r 3
 
 <p>Different from the log keeping workflow, you'll want to go back in history at times and do some changes directly there, for example because an earlier change introduced a bug and you want to fix it where it occurred.</p>
 
-<p>To look at a previous version of your code, you can use update. Let's assume that you want to see revision 3.</p>
+<p>To look at a previous version of your code, you can use update. Let's assume that you want to see revision 1.</p>
 
-<pre>$ hg update 3
+<pre>$ hg update 1
 
 </pre>
 
-<p>Now your code is back at revision 3, the fourth commit (Mercurial starts counting at 0).
+<p>Now your code is back at revision 1, the second commit (Mercurial starts counting at 0).
 To check if you're really at that revision, you can use <em>identify -n</em>.</p>
 
 <pre>$ hg identify -n
 
 </pre>
 
+<div class="output">output of hg identify -n:
+1
+</div>
+
+<div class="output">output of ls: 
+hello.py
+</div>
+
+
 <div class="note">
 <p class="note-title">Note:</p>
 <em>identify</em> without options gives you the short form of a unique revision ID. That ID is what Mercurial uses internally. If you tell someone about the version you updated to, you should use that ID, since the numbers can be different for other people. If you want to know the reasons behind that, please read up Mercurials [<a href="http://mercurial.selenic.com/wiki/UnderstandingMercurial">basic concepts</a>]. When you're at the most recent revision, <em>hg identify -n</em> will return "-1".
 To get a revision devoid of files, just <em>update</em> to "null" via <em>hg update null</em>. That's the revision before any files were added.
 </div>
 
+<div class="note">
+<p class="note-title">Note:</p>
+If the output of <em>hg identify</em> ends in a “+”, your repository has uncommitted changes.
+</div>
+
+
 <h5>Fixing errors in earlier revisions</h5>
 
 <p>When you find a bug in some earlier revision you have two options: either you can fix it in the current code, or you can go back in history and fix the code exactly where you did it, which creates a cleaner history.</p>
 
 <p>To do it the cleaner way, you first update to the old revision, fix the bug and commit it. Afterwards you merge this revision and commit the merge. Don't worry, though: Merging in mercurial is fast and painless, as you'll see in an instant.</p>
 
-<p>Let's assume the bug was introduced in revision 3.</p>
+<p>Let's assume the bug was introduced in revision 1.</p>
 
-<pre>$ hg update 3
-$ (fix the bug)
+<pre>$ hg update 1
+$ echo 'print("Hello Mercurial")' > hello.py
 $ hg commit
 
 </pre>
 
+<div class="output">output of hg commit (after entering the message):
+created new head
+</div>
+
+<div class="note">
+<p class="note-title">Note:</p>
+“created new head” means that there is now one more revision, which does not have children. Heads are current states of your project living side by side. It is good style to merge them together before propagating them.
+</div>
+
+
 <p>Now the fix is already stored in history. We just need to merge it with the current version of your code.</p>
 
 <pre>$ hg merge
 
 </pre>
 
+<div class="output">output of hg merge (here):
+merging hello.py and copy to copy
+merging hello.py and target to target
+</div>
+
 <p>If there are conflicts use <em>hg resolve</em> - that's also what merge tells you to do in case of conflicts.</p>
 
 <p>First list the files with conflicts</p>
 
 <p>At this point, your fix is merged with all your other work, and you can just go on coding. Additionally the history shows clearly where you fixed the bug, so you'll always be able to check where the bug was.</p>
 
+<div class="output">output of hg log (after the final commit):
+changeset:   4:3b06bba7c1a9
+tag:         tip
+parent:      3:7ff5cd572d80
+parent:      2:70eb0ca9d264
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 20:11:00 2011 +0100
+summary:     merge greeting and copy+move.
+
+changeset:   3:7ff5cd572d80
+parent:      1:487d7a20ccbc
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 20:00:00 2011 +0100
+summary:     Greet Mercurial
+
+changeset:   2:70eb0ca9d264
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 11:20:00 2011 +0100
+summary:     Copy and move.
+
+changeset:   1:487d7a20ccbc
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 11:11:00 2011 +0100
+summary:     Say Hello World, not just Hello.
+
+changeset:   0:a5ecbf5799c8
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 11:00:00 2011 +0100
+summary:     Initial commit.
+</div>
+
+
 <div class="note">
 <p class="note-title">Note:</p>
 Most merges will just work. You only need <em>resolve</em>, when <em>merge</em> complains.
 
 <pre>$ hg clone project feature1
 $ cd feature1
-$ (do some changes and commits)
+$ hg update 3
+$ echo 'print("Hello feature1")' > hello.py
+$ hg commit -m "Greet feature1"
 
 </pre>
 
 
 </pre>
 
+<div class="output">output of hg incoming ../feature1:
+comparing with ../feature1
+searching for changes
+changeset:   5:3eb7b39fcf57
+tag:         tip
+parent:      3:7ff5cd572d80
+user:        Arne Babenhauserheide <bab@draketo.de>
+date:        Sun Nov 20 20:11:11 2011 +0100
+summary:     Greet feature1
+</div>
+
+
 <div class="note">
 <p class="note-title">Note:</p>
 If you want to see the diffs, you can use <em>hg incoming --patch</em> just as you can do with <em>hg log --patch</em> for the changes in the repository.
 
 <p>Now you have the history of feature1 inside your project, but the changes aren't yet visible. Instead they are only stored inside a ".hg" directory of the project (<a title="Behind the Scenes" href="http://hgbook.red-bean.com/read/behind-the-scenes.html">more information on the store</a>).</p>
 
+<div class="output">output of hg pull:
+pulling from ../feature1
+searching for changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files (+1 heads)
+(run 'hg heads' to see heads, 'hg merge' to merge)
+</div>
+
 <div class="note">
 <p class="note-title">Note:</p>
 From now on we'll use the name "repository" for a directory which has a .hg directory with Mercurial history.
 
 </pre>
 
+<div class="output">output of hg log -r -1:-3 (the last 3 changesets):
+changeset:   6:e8a33691171a
+tag:         tip
+parent:      4:3b06bba7c1a9
+parent:      5:3eb7b39fcf57
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 20:20:00 2011 +0100
+summary:     merged feature1
+
+changeset:   5:3eb7b39fcf57
+parent:      3:7ff5cd572d80
+user:        Arne Babenhauserheide <bab@draketo.de>
+date:        Sun Nov 20 20:11:11 2011 +0100
+summary:     Greet feature1
+
+changeset:   4:3b06bba7c1a9
+parent:      3:7ff5cd572d80
+parent:      2:70eb0ca9d264
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 20:11:00 2011 +0100
+summary:     merge greeting and copy+move.
+</div>
+
+
+<div class="note">
+<p class="note-title">Note:</p>
+Mercurial offers powerful ways specify revisions. Too see them all, use <em>hg help revsets</em>.
+</div>
+
+
 <p>You can create an arbitrary number of clones and also carry them around on USB sticks. Also you can use them to synchronize your files at home and at work, or between your desktop and your laptop.</p>
 
 <div class="note">
 
 <p>Rolling back means undoing the last operation which added something to your history.</p>
 
-<p>Imagine you just realized that you did a bad commit - for example you didn't see a spelling error in a label. To fix it you would use</p>
+<p>Imagine you just realized that you did a bad commit - for example you didn't see a spelling error in a commit message. To fix it you would use</p>
 
-<pre>hg rollback
+<pre>$ hg rollback
 
 </pre>
 
+<div class="output">output of hg rollback:
+repository tip rolled back to revision 5 (undo commit)
+working directory now based on revisions 4 and 5
+</div>
+
 <p>And then redo the commit</p>
 
-<pre>hg commit -m "message"
+<pre>$ hg commit -m "Merged Feature 1"
 
 </pre>
 
+<div class="output">output of hg log -r -1:-2 (after rollback and commit):
+changeset:   6:3f549b33c7ef
+tag:         tip
+parent:      4:3b06bba7c1a9
+parent:      5:3eb7b39fcf57
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 20:20:11 2011 +1100
+summary:     Merged Feature 1
+
+changeset:   5:3eb7b39fcf57
+parent:      3:7ff5cd572d80
+user:        Arne Babenhauserheide <bab@draketo.de>
+date:        Sun Nov 20 20:11:11 2011 +0100
+summary:     Greet feature1
+</div>
+
+
+
 <p>If you can use the command history of your shell and you added the previous message via <em>commit -m "message"</em>, that following commit just means two clicks on the arrow-key "up" and one click on "enter".</p>
 
 <p>Though it changes your history, rolling back doesn't change your files. It only undoes the last addition to your history.</p>
 
 </pre>
 
-<p>Now your repository is created and you see instructions for <em>push</em>ing to it. For that you'll use a command similar to the following (just with a different URL)</p>
+<p>Now your repository is created and you see instructions for <em>push</em>ing to it. For that you'll use a command similar to the following (just with a different URL):</p>
 
 <pre>$ hg push https://bitbucket.org/ArneBab/hello/
 
 
 <p>Voilà, your code is online.</p>
 
+<p>To see what you would get if you would push, you can use outgoing. It works with local repositories in the same way as with shared ones, so you can test it with a local one:</p>
+
+<pre>$ hg outgoing ../feature1
+
+</pre>
+
+<div class="output">output of hg outgoing ../feature1 (our feature seperation repo):
+comparing with ../feature1
+searching for changes
+changeset:   6:3f549b33c7ef
+tag:         tip
+parent:      4:3b06bba7c1a9
+parent:      5:3eb7b39fcf57
+user:        Mr. Johnson <johnson@smith.com>
+date:        Sun Nov 20 20:20:11 2011 +1100
+summary:     Merged Feature 1
+</div>
+
+
 <div class="note">
 <p class="note-title">Note:</p>
 You can also <a title="use SSH for pushing to BitBucket" href="http://bitbucket.org/help/UsingSSH">use SSH for pushing to BitBucket</a>.
         <!-- The three sections should now grow more compact as you go down, with power and speed the longest and just works only two simple, clean sentences. -->
             <li class="i-1">
                 It is <a href="/about/">fast and powerful</a>
-                <p>Mercurial efficiently handles <a href="/who/">projects of any size and kind</a><!--Reference: http://mercurial.selenic.com/wiki/ProjectsUsingMercurial -->. Every clone contains the whole project history, so most actions are local, fast and convenient. You can use it for a multitude of <a href="http://mercurial.selenic.com/wiki/WorkingPractices">workflows</a> and easily enhance its functionality with <a href="http://mercurial.selenic.com/wiki/UsingExtensions">extensions</a>.</p>
+                <p>Mercurial efficiently handles <a href="/who/">projects of any size and kind</a><!--Reference: http://mercurial.selenic.com/wiki/ProjectsUsingMercurial -->. Every clone contains the whole project history, so most actions are local, fast and convenient. Mercurial supports a multitude of <a href="http://mercurial.selenic.com/wiki/WorkingPractices">workflows</a> and you can easily enhance its functionality with <a href="http://mercurial.selenic.com/wiki/UsingExtensions">extensions</a>.</p>
             </li>
             <li class="i-2">
                 It is <a href="/learn/">easy to learn</a><!-- point to a site which begins with a random "easy to learn" testimonial and then shows ways to learn Mercurial, from quick start to indepth -->

File sponsors/index.html

 <p>
 The Mercurial project is raising money for the project and to sponsor Matt Mackall, the primary
 Mercurial author and project leader, to work full-time on Mercurial development.</p>
+<p>The current status is tracked in <a href="/wiki/mpm" title="mpm in the Mercurial wiki">his wikipage</a>.</p>
 <p>For information on sponsorship, contact Matt Mackall (mpm@selenic.com). For individual donations, see our <a href="http://www.selenic.com/mercurial/donations.html">donations page</a>.</p> 
 
                     </div>