diff hgscm/templates/workflow_guide.html @ 150:6d5a62a9821e

learning in workflows: Added section on explicit file copy and move.
author Arne Babenhauserheide <bab@draketo.de>
date Tue, 12 May 2009 08:23:18 +0200
parents 2d6b15433c60
children 60be1cc49ae7
line wrap: on
line diff
--- a/hgscm/templates/workflow_guide.html	Tue May 12 08:00:08 2009 +0200
+++ b/hgscm/templates/workflow_guide.html	Tue May 12 08:23:18 2009 +0200
@@ -71,6 +71,23 @@
 
 Note: You can also supply the commit message directly via <hg>hg commit -m 'MESSAGE'</hg>
 
+<h5>Move and copy files</h5>
+
+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. 
+
+Remember to <hg>commit</hg> after moving or copying. From the basic commands only <hg>commit</hg> creates a new revision. 
+
+<pre>$ hg cp original copy
+$ hg commit
+(enter the commit message)
+$ hg mv original target
+$ hg commit
+(enter the commit message)</pre>
+
+Now you have two files, "copy" and "target", and Mercurial knows how they are related. 
+
+Note: Should you forget to do the explicit move, you can still tell Mercurial to detect the changes via <hg>hg addremove --similarity 100</hg>. Just use <hg>hg help addremove</hg> for details. 
+
 <h5>Check your history</h5>
 
 <pre>$ hg log</pre>
@@ -174,6 +191,8 @@
 
 So now you can initialize repositories, save changes, update to previous changes and develop in a nonlinear history by committing in earlier changesets and merging the changes into the current code. 
 
+Note: If you fix a bug in an earlier revision, and some later revision copied or moved that file, the fix will be propagated to the target file(s) when you merge. This is the main reason why you should always use <hg>hg cp</hg> and <hg>hg mv</hg>. 
+
 <h3>Seperate features</h3>
 
 <h4>Use Case</h4>