hgbook

diff en/ch05-daily.xml @ 567:8fcd44708f41

Uncomment all the mangled interaction examples.
author Bryan O'Sullivan <bos@serpentine.com>
date Mon Mar 09 23:22:09 2009 -0700 (2009-03-09)
parents b90b024729f1
children 13513d2a128d
line diff
     1.1 --- a/en/ch05-daily.xml	Wed Feb 18 00:22:09 2009 -0800
     1.2 +++ b/en/ch05-daily.xml	Mon Mar 09 23:22:09 2009 -0700
     1.3 @@ -18,8 +18,9 @@
     1.4        file, the entry in the output of <command role="hg-cmd">hg
     1.5  	status</command> for that file changes from
     1.6        <quote><literal>?</literal></quote> to
     1.7 -      <quote><literal>A</literal></quote>. <!--
     1.8 -      &interaction.daily.files.add; --></para>
     1.9 +      <quote><literal>A</literal></quote>.</para>
    1.10 +
    1.11 +      &interaction.daily.files.add;
    1.12  
    1.13      <para>After you run a <command role="hg-cmd">hg commit</command>,
    1.14        the files that you added before the commit will no longer be
    1.15 @@ -45,11 +46,14 @@
    1.16        <para>A useful behaviour that Mercurial has is that if you pass
    1.17  	the name of a directory to a command, every Mercurial command
    1.18  	will treat this as <quote>I want to operate on every file in
    1.19 -	  this directory and its subdirectories</quote>. <!--
    1.20 -	&interaction.daily.files.add-dir; --> Notice in this example
    1.21 -	that Mercurial printed the names of the files it added,
    1.22 -	whereas it didn't do so when we added the file named
    1.23 -	<filename>a</filename> in the earlier example.</para>
    1.24 +	  this directory and its subdirectories</quote>.</para>
    1.25 +
    1.26 +      &interaction.daily.files.add-dir;
    1.27 +
    1.28 +      <para>Notice in this example that Mercurial printed the names of
    1.29 +	the files it added, whereas it didn't do so when we added the
    1.30 +	file named <filename>a</filename> in the earlier
    1.31 +	example.</para>
    1.32  
    1.33        <para>What's going on is that in the former case, we explicitly
    1.34  	named the file to add on the command line, so the assumption
    1.35 @@ -92,7 +96,7 @@
    1.36  	most commands and GUI tools.  This approach is illustrated
    1.37  	below.</para>
    1.38  
    1.39 -<!-- &interaction.daily.files.hidden; -->
    1.40 +&interaction.daily.files.hidden;
    1.41  
    1.42        <para>Another way to tackle a need for an empty directory is to
    1.43  	simply create one in your automated build scripts before they
    1.44 @@ -108,8 +112,9 @@
    1.45        command; this deletes the file, and tells Mercurial to stop
    1.46        tracking it.  A removed file is represented in the output of
    1.47        <command role="hg-cmd">hg status</command> with a
    1.48 -      <quote><literal>R</literal></quote>. <!--
    1.49 -      &interaction.daily.files.remove; --></para>
    1.50 +      <quote><literal>R</literal></quote>.</para>
    1.51 +
    1.52 +    &interaction.daily.files.remove;
    1.53  
    1.54      <para>After you <command role="hg-cmd">hg remove</command> a file,
    1.55        Mercurial will no longer track changes to that file, even if you
    1.56 @@ -152,7 +157,9 @@
    1.57  	represented with <quote><literal>!</literal></quote> in the
    1.58  	output of <command role="hg-cmd">hg status</command>.
    1.59  	Mercurial commands will not generally do anything with missing
    1.60 -	files. <!-- &interaction.daily.files.missing; --></para>
    1.61 +	files.</para>
    1.62 +
    1.63 +      &interaction.daily.files.missing;
    1.64  
    1.65        <para>If your repository contains a file that <command
    1.66  	  role="hg-cmd">hg status</command> reports as missing, and
    1.67 @@ -160,15 +167,16 @@
    1.68  	  role="hg-cmd">hg remove <option
    1.69  	    role="hg-opt-remove">--after</option></command> at any
    1.70  	time later on, to tell Mercurial that you really did mean to
    1.71 -	remove the file. <!-- &interaction.daily.files.remove-after;
    1.72 -	--></para>
    1.73 +	remove the file.</para>
    1.74 +
    1.75 +      &interaction.daily.files.remove-after;
    1.76  
    1.77        <para>On the other hand, if you deleted the missing file by
    1.78  	accident, give <command role="hg-cmd">hg revert</command> the
    1.79  	name of the file to recover.  It will reappear, in unmodified
    1.80  	form.</para>
    1.81  
    1.82 -<!-- &interaction.daily.files.recover-missing; -->
    1.83 +&interaction.daily.files.recover-missing;
    1.84  
    1.85      </sect2>
    1.86      <sect2>
    1.87 @@ -191,12 +199,16 @@
    1.88  
    1.89        <para>Mercurial offers a combination command, <command
    1.90  	  role="hg-cmd">hg addremove</command>, that adds untracked
    1.91 -	files and marks missing files as removed. <!--
    1.92 -	&interaction.daily.files.addremove; --> The <command
    1.93 -	  role="hg-cmd">hg commit</command> command also provides a
    1.94 -	<option role="hg-opt-commit">-A</option> option that performs
    1.95 -	this same add-and-remove, immediately followed by a commit.
    1.96 -	<!-- &interaction.daily.files.commit-addremove; --></para>
    1.97 +	files and marks missing files as removed.</para>
    1.98 +
    1.99 +      &interaction.daily.files.addremove;
   1.100 +
   1.101 +      <para>The <command role="hg-cmd">hg commit</command> command
   1.102 +	also provides a <option role="hg-opt-commit">-A</option>
   1.103 +	option that performs this same add-and-remove, immediately
   1.104 +	followed by a commit.</para>
   1.105 +
   1.106 +      &interaction.daily.files.commit-addremove;
   1.107  
   1.108      </sect2>
   1.109    </sect1>
   1.110 @@ -216,34 +228,49 @@
   1.111        <para>What happens during a merge is that changes
   1.112  	<quote>follow</quote> a copy.  To best illustrate what this
   1.113  	means, let's create an example.  We'll start with the usual
   1.114 -	tiny repository that contains a single file. <!--
   1.115 -	&interaction.daily.copy.init; --> We need to do some work in
   1.116 +	tiny repository that contains a single file.</para>
   1.117 +
   1.118 +      &interaction.daily.copy.init;
   1.119 +
   1.120 +      <para>We need to do some work in
   1.121  	parallel, so that we'll have something to merge.  So let's
   1.122 -	clone our repository. <!-- &interaction.daily.copy.clone; -->
   1.123 -	Back in our initial repository, let's use the <command
   1.124 +	clone our repository.</para>
   1.125 +
   1.126 +      &interaction.daily.copy.clone;
   1.127 +
   1.128 +      <para>Back in our initial repository, let's use the <command
   1.129  	  role="hg-cmd">hg copy</command> command to make a copy of
   1.130 -	the first file we created. <!-- &interaction.daily.copy.copy;
   1.131 -	--></para>
   1.132 +	the first file we created.</para>
   1.133 +
   1.134 +      &interaction.daily.copy.copy;
   1.135  
   1.136        <para>If we look at the output of the <command role="hg-cmd">hg
   1.137  	  status</command> command afterwards, the copied file looks
   1.138 -	just like a normal added file. <!--
   1.139 -	&interaction.daily.copy.status; --> But if we pass the <option
   1.140 +	just like a normal added file.</para>
   1.141 +
   1.142 +      &interaction.daily.copy.status;
   1.143 +
   1.144 +      <para>But if we pass the <option
   1.145  	  role="hg-opt-status">-C</option> option to <command
   1.146  	  role="hg-cmd">hg status</command>, it prints another line of
   1.147  	output: this is the file that our newly-added file was copied
   1.148 -	<emphasis>from</emphasis>. <!--
   1.149 -	&interaction.daily.copy.status-copy; --></para>
   1.150 +	<emphasis>from</emphasis>.</para>
   1.151 +
   1.152 +      &interaction.daily.copy.status-copy;
   1.153  
   1.154        <para>Now, back in the repository we cloned, let's make a change
   1.155  	in parallel.  We'll add a line of content to the original file
   1.156 -	that we created. <!-- &interaction.daily.copy.other; --> Now
   1.157 -	we have a modified <filename>file</filename> in this
   1.158 +	that we created.</para>
   1.159 +
   1.160 +      &interaction.daily.copy.other;
   1.161 +
   1.162 +      <para>Now we have a modified <filename>file</filename> in this
   1.163  	repository.  When we pull the changes from the first
   1.164  	repository, and merge the two heads, Mercurial will propagate
   1.165  	the changes that we made locally to <filename>file</filename>
   1.166 -	into its copy, <filename>new-file</filename>. <!--
   1.167 -	&interaction.daily.copy.merge; --></para>
   1.168 +	into its copy, <filename>new-file</filename>.</para>
   1.169 +
   1.170 +      &interaction.daily.copy.merge;
   1.171  
   1.172      </sect2>
   1.173      <sect2 id="sec:daily:why-copy">
   1.174 @@ -327,22 +354,33 @@
   1.175  	<emphasis>destination</emphasis>, and all prior arguments are
   1.176  	<emphasis>sources</emphasis>.  If you pass it a single file as
   1.177  	the source, and the destination does not exist, it creates a
   1.178 -	new file with that name. <!-- &interaction.daily.copy.simple;
   1.179 -	--> If the destination is a directory, Mercurial copies its
   1.180 -	sources into that directory. <!--
   1.181 -	&interaction.daily.copy.dir-dest; --> Copying a directory is
   1.182 +	new file with that name.</para>
   1.183 +
   1.184 +      &interaction.daily.copy.simple;
   1.185 +      
   1.186 +      <para>If the destination is a directory, Mercurial copies its
   1.187 +	sources into that directory.</para>
   1.188 +
   1.189 +      &interaction.daily.copy.dir-dest;
   1.190 +
   1.191 +      <para>Copying a directory is
   1.192  	recursive, and preserves the directory structure of the
   1.193 -	source. <!-- &interaction.daily.copy.dir-src; --> If the
   1.194 -	source and destination are both directories, the source tree
   1.195 -	is recreated in the destination directory. <!--
   1.196 -	&interaction.daily.copy.dir-src-dest; --></para>
   1.197 +	source.</para>
   1.198 +
   1.199 +      &interaction.daily.copy.dir-src;
   1.200 +
   1.201 +      <para>If the source and destination are both directories, the
   1.202 +	source tree is recreated in the destination directory.</para>
   1.203 +
   1.204 +	&interaction.daily.copy.dir-src-dest;
   1.205  
   1.206        <para>As with the <command role="hg-cmd">hg rename</command>
   1.207  	command, if you copy a file manually and then want Mercurial
   1.208  	to know that you've copied the file, simply use the <option
   1.209  	  role="hg-opt-copy">--after</option> option to <command
   1.210 -	  role="hg-cmd">hg copy</command>. <!--
   1.211 -	&interaction.daily.copy.after; --></para>
   1.212 +	  role="hg-cmd">hg copy</command>.</para>
   1.213 +
   1.214 +      &interaction.daily.copy.after;
   1.215  
   1.216      </sect2>
   1.217    </sect1>
   1.218 @@ -359,17 +397,24 @@
   1.219  
   1.220      <para>When you use the <command role="hg-cmd">hg rename</command>
   1.221        command, Mercurial makes a copy of each source file, then
   1.222 -      deletes it and marks the file as removed. <!--
   1.223 -      &interaction.daily.rename.rename; --> The <command
   1.224 -	role="hg-cmd">hg status</command> command shows the newly
   1.225 -      copied file as added, and the copied-from file as removed. <!--
   1.226 -      &interaction.daily.rename.status; --> As with the results of a
   1.227 -      <command role="hg-cmd">hg copy</command>, we must use the
   1.228 -      <option role="hg-opt-status">-C</option> option to <command
   1.229 +      deletes it and marks the file as removed.</para>
   1.230 +
   1.231 +      &interaction.daily.rename.rename;
   1.232 +
   1.233 +    <para>The <command role="hg-cmd">hg status</command> command shows
   1.234 +      the newly copied file as added, and the copied-from file as
   1.235 +      removed.</para>
   1.236 +
   1.237 +    &interaction.daily.rename.status;
   1.238 +
   1.239 +    <para>As with the results of a <command role="hg-cmd">hg
   1.240 +	copy</command>, we must use the <option
   1.241 +	role="hg-opt-status">-C</option> option to <command
   1.242  	role="hg-cmd">hg status</command> to see that the added file
   1.243        is really being tracked by Mercurial as a copy of the original,
   1.244 -      now removed, file. <!-- &interaction.daily.rename.status-copy;
   1.245 -      --></para>
   1.246 +      now removed, file.</para>
   1.247 +
   1.248 +    &interaction.daily.rename.status-copy;
   1.249  
   1.250      <para>As with <command role="hg-cmd">hg remove</command> and
   1.251        <command role="hg-cmd">hg copy</command>, you can tell Mercurial
   1.252 @@ -410,11 +455,16 @@
   1.253  	<filename>foo</filename>&emdash;in their respective
   1.254  	repositories.</para>
   1.255  
   1.256 -      <para><!-- &interaction.rename.divergent.clone; --> Anne renames
   1.257 -	the file to <filename>bar</filename>. <!--
   1.258 -	&interaction.rename.divergent.rename.anne; --> Meanwhile, Bob
   1.259 -	renames it to <filename>quux</filename>. <!--
   1.260 -	&interaction.rename.divergent.rename.bob; --></para>
   1.261 +      &interaction.rename.divergent.clone;
   1.262 +
   1.263 +      <para>Anne renames the file to <filename>bar</filename>.</para>
   1.264 +
   1.265 +      &interaction.rename.divergent.rename.anne;
   1.266 +
   1.267 +      <para>Meanwhile, Bob renames it to
   1.268 +	<filename>quux</filename>.</para>
   1.269 +
   1.270 +	&interaction.rename.divergent.rename.bob;
   1.271  
   1.272        <para>I like to think of this as a conflict because each
   1.273  	developer has expressed different intentions about what the
   1.274 @@ -423,8 +473,9 @@
   1.275        <para>What do you think should happen when they merge their
   1.276  	work? Mercurial's actual behaviour is that it always preserves
   1.277  	<emphasis>both</emphasis> names when it merges changesets that
   1.278 -	contain divergent renames. <!--
   1.279 -	&interaction.rename.divergent.merge; --></para>
   1.280 +	contain divergent renames.</para>
   1.281 +
   1.282 +      &interaction.rename.divergent.merge;
   1.283  
   1.284        <para>Notice that Mercurial does warn about the divergent
   1.285  	renames, but it leaves it up to you to do something about the
   1.286 @@ -449,7 +500,9 @@
   1.287  	while another has a directory with the same name.  This is
   1.288  	documented as <ulink role="hg-bug"
   1.289  	  url="http://www.selenic.com/mercurial/bts/issue29">issue
   1.290 -	  29</ulink>. <!-- &interaction.issue29.go; --></para>
   1.291 +	  29</ulink>.</para>
   1.292 +
   1.293 +      &interaction.issue29.go;
   1.294  
   1.295      </sect2>
   1.296    </sect1>