Mercurial > hg-website
changeset 239:ee2c1a02c693
workflow_guide: Use <em>command</em> to mark hg commands.
author | Arne Babenhauserheide <bab@draketo.de> |
---|---|
date | Tue, 08 Sep 2009 12:45:06 +0200 |
parents | b17731a54e2a |
children | 85a7a53db1a5 |
files | hgscm/templates/workflow_guide.html |
diffstat | 1 files changed, 48 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/hgscm/templates/workflow_guide.html Tue Sep 08 12:41:51 2009 +0200 +++ b/hgscm/templates/workflow_guide.html Tue Sep 08 12:45:06 2009 +0200 @@ -84,7 +84,7 @@ </pre> -<p><hg>commit</hg> the changes.</p> +<p><em>commit</em> the changes.</p> <pre>$ hg commit @@ -92,13 +92,13 @@ <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> -<p>Note: You can also supply the commit message directly via <hg>hg commit -m 'MESSAGE'</hg>.</p> +<p>Note: You can also supply the commit message directly via <em>hg commit -m 'MESSAGE'</em>.</p> <h5>Move and copy 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 <hg>commit</hg> after moving or copying. From the basic commands only <hg>commit</hg> creates a new revision</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 @@ -111,7 +111,7 @@ <p>Now you have two files, "copy" and "target", and Mercurial knows how they are related.</p> -<p>Note: Should you forget to do the explicit copy or 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.</p> +<p>Note: 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> <h5>Check your history</h5> @@ -121,7 +121,7 @@ <p>This prints a list of changesets along with their date, the user who committed them (you) and their commit message. </p> -<p>To see a certain revision, you can use the <hg>-r</hg> switch (--revision). To also see the diff of the displayed revisions, there's the <hg>-p</hg> switch (--patch)</p> +<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 @@ -169,13 +169,13 @@ </pre> <p>Now your code is back at revision 3, the fourth commit (Mercurial starts counting at 0). -To check if you're really at that revision, you can use <hg>identify -n</hg>.</p> +To check if you're really at that revision, you can use <em>identify -n</em>.</p> <pre>$ hg identify -n </pre> -<p>Note: <hg>identify</hg> 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 [basic concepts](). When you're at the most recent revision, <hg>hg identify -n</hg> will return "-1".</p> +<p>Note: <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 [basic concepts](). When you're at the most recent revision, <em>hg identify -n</em> will return "-1".</p> <p>To update to the most recent revision, you can use "tip" as revision name.</p> @@ -185,9 +185,9 @@ <p>Note: If at any place any command complains, your best bet is to read what it tells you and follow that advice.</p> -<p>Note: Instead of <hg>hg update</hg> you can also use the shorthand <hg>hg up</hg>. Similarly you can abbreviate <hg>hg commit</hg> to <hg>hg ci</hg>.</p> +<p>Note: Instead of <em>hg update</em> you can also use the shorthand <em>hg up</em>. Similarly you can abbreviate <em>hg commit</em> to <em>hg ci</em>.</p> -<p>Note: To get a revision devoid of files, just <hg>update</hg> to "null" via <hg>hg update null</hg>. That's the revision before any files were added.</p> +<p>Note: 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.</p> <h5>Fixing errors in earlier revisions</h5> @@ -209,7 +209,7 @@ </pre> -<p>If there are conflicts use <hg>hg resolve</hg> - that's also what merge tells you to do in case of conflicts.</p> +<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> @@ -217,7 +217,7 @@ </pre> -<p>Then resolve them one by one. <hg>resolve</hg> attempts the merge again</p> +<p>Then resolve them one by one. <em>resolve</em> attempts the merge again</p> <pre>$ hg resolve conflicting_file (fix it by hand, if necessary) @@ -238,11 +238,11 @@ <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> -<p>Note: Most merges will just work. You only need <hg>resolve</hg>, when <hg>merge</hg> complains.</p> +<p>Note: Most merges will just work. You only need <em>resolve</em>, when <em>merge</em> complains.</p> <p>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.</p> -<p>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>.</p> +<p>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 <em>hg cp</em> and <em>hg mv</em>.</p> <h2 id="separate_features">Separate features</h2> @@ -250,7 +250,7 @@ <p>At times you'll be working on several features in parallel. If you want to avoid mixing incomplete code versions, you can create clones of your local repository and work on each feature in its own code directory.</p> -<p>After finishing your feature you then <hg>pull</hg> it back into your main directory and <hg>merge</hg> the changes.</p> +<p>After finishing your feature you then <em>pull</em> it back into your main directory and <em>merge</em> the changes.</p> <h3>Workflow</h3> @@ -264,14 +264,14 @@ </pre> -<p>Now check what will come in when you <hg>pull</hg> from feature1, just like you can use <hg>diff</hg> before committing. The respective command for pulling is <hg>incoming</hg></p> +<p>Now check what will come in when you <em>pull</em> from feature1, just like you can use <em>diff</em> before committing. The respective command for pulling is <em>incoming</em></p> <pre>$ cd ../project $ hg incoming ../feature1 </pre> -<p>Note: If you want to see the diffs, you can use <hg>hg incoming --patch</hg> just as you can do with <hg>hg log --patch</hg> for the changes in the repository.</p> +<p>Note: 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> <p>If you like the changes, you pull them into the project</p> @@ -283,7 +283,7 @@ <p>Note: From now on we'll use the name "repository" for a directory which has a .hg directory with Mercurial history.</p> -<p>If you didn't do any changes in the project, while you were working on feature1, you can just update to tip (<hg>hg update tip</hg>), but it is more likely that you'll have done some other changes in between changes. In that case, it's time for merging.</p> +<p>If you didn't do any changes in the project, while you were working on feature1, you can just update to tip (<em>hg update tip</em>), but it is more likely that you'll have done some other changes in between changes. In that case, it's time for merging.</p> <p>Merge feature1 into the project code</p> @@ -291,7 +291,7 @@ </pre> -<p>If there are conflicts use <hg>hg resolve</hg> - that's also what merge tells you to do in case of conflicts. After you <hg>merge</hg>, you have to <hg>commit</hg> explicitely to make your <hg>merge</hg> final</p> +<p>If there are conflicts use <em>hg resolve</em> - that's also what merge tells you to do in case of conflicts. After you <em>merge</em>, you have to <em>commit</em> explicitely to make your <em>merge</em> final</p> <pre>$ hg commit (enter commit message, for example "merged feature1") @@ -304,7 +304,7 @@ <h5>Rollback mistakes</h5> -<p>Now you can work on different features in parallel, but from time to time a bad commit might sneak in. Naturally you could then just go back one revision and merge the stray error, keeping all mistakes out of the merged revision. However, there's an easier way, if you realize your error before you do another <hg>commit</hg> or <hg>pull</hg>: <hg>rollback</hg>.</p> +<p>Now you can work on different features in parallel, but from time to time a bad commit might sneak in. Naturally you could then just go back one revision and merge the stray error, keeping all mistakes out of the merged revision. However, there's an easier way, if you realize your error before you do another <em>commit</em> or <em>pull</em>: <em>rollback</em>.</p> <p>Rolling back means undoing the last operation which added something to your history.</p> @@ -320,13 +320,13 @@ </pre> -<p>If you can use the command history of your shell and you added the previous message via <hg>commit -m "message"</hg>, that following commit just means two clicks on the arrow-key "up" and one click on "enter".</p> +<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> -<p>But beware, that a rollback itself can't be undone. If you <hg>rollback</hg> and then forget to commit, you can't just say "give me my old commit back". You have to create a new commit.</p> +<p>But beware, that a rollback itself can't be undone. If you <em>rollback</em> and then forget to commit, you can't just say "give me my old commit back". You have to create a new commit.</p> -<p>Note: Rollback is possible, because Mercurial uses transactions when recording changes, and you can use the transaction record to undo the last transaction. This means that you can also use <hg>rollback</hg> to undo your last <hg>pull</hg>, if you didn't yet commit aything new.</p> +<p>Note: Rollback is possible, because Mercurial uses transactions when recording changes, and you can use the transaction record to undo the last transaction. This means that you can also use <em>rollback</em> to undo your last <em>pull</em>, if you didn't yet commit aything new.</p> <h2 id="sharing_changes">Sharing changes</h2> @@ -336,9 +336,9 @@ <p>The basic requirement for that is that you have to be able to see the changes of others.</p> -<p>Mercurial allows you to do that very easily by including a simple webserver from which you can <hg>pull</hg> changes just as you can pull changes from local clones.</p> +<p>Mercurial allows you to do that very easily by including a simple webserver from which you can <em>pull</em> changes just as you can pull changes from local clones.</p> -<p>Note: There are a few other ways to share changes, though. Instead of using the builtin webserver, you can also send the changes by email or setup a shared repository, to where you <hg>push</hg> changes instead of pulling them. We'll cover one of those later.</p> +<p>Note: There are a few other ways to share changes, though. Instead of using the builtin webserver, you can also send the changes by email or setup a shared repository, to where you <em>push</em> changes instead of pulling them. We'll cover one of those later.</p> <h3>Workflow</h3> @@ -374,7 +374,7 @@ <p>Another reason to send them by email can be that your policy requires manual review of the changes when the other developers are used to reading diffs in emails. I'm sure you can think of more reasons.</p> -<p>Sending the changes via email is pretty straightforward with Mercurial. You just <hg>export</hg> your changes and attach (or copy paste) it in your email. Your collegues can then just <hg>import</hg> them.</p> +<p>Sending the changes via email is pretty straightforward with Mercurial. You just <em>export</em> your changes and attach (or copy paste) it in your email. Your collegues can then just <em>import</em> them.</p> <p>First check which changes you want to export</p> @@ -390,9 +390,9 @@ </pre> -<p>Now attach them to an email and your collegues can just run <hg>import</hg> on both diffs to get your full changes, including your user information.</p> +<p>Now attach them to an email and your collegues can just run <em>import</em> on both diffs to get your full changes, including your user information.</p> -<p>To be careful, they first <hg>clone</hg> their repository to have an integration directory as sandbox</p> +<p>To be careful, they first <em>clone</em> their repository to have an integration directory as sandbox</p> <pre>$ hg clone project integration $ cd integration @@ -401,7 +401,7 @@ </pre> -<p>That's it. They can now test your changes in feature clones. If they accept them, they <hg>pull</hg> the changes into the main repository</p> +<p>That's it. They can now test your changes in feature clones. If they accept them, they <em>pull</em> the changes into the main repository</p> <pre>$ cd ../project $ hg pull ../integration @@ -423,15 +423,15 @@ <h5>Using a shared repository</h5> -<p>Sending changes by email might be the easiest way to reach people when you aren't yet part of the regular development team, but it creates additional workload: You have to <hg>bundle</hg> the changes, send mails and then <hg>import</hg> the bundles manually. Luckily there's an easier way which works quite well: The shared push repository.</p> +<p>Sending changes by email might be the easiest way to reach people when you aren't yet part of the regular development team, but it creates additional workload: You have to <em>bundle</em> the changes, send mails and then <em>import</em> the bundles manually. Luckily there's an easier way which works quite well: The shared push repository.</p> -<p>Till now we transferred all changes either via email or via <hg>pull</hg>. Now we use another otion: pushing. As the name suggests it's just the opposite of pulling: You <hg>push</hg> your changes into another repository.</p> +<p>Till now we transferred all changes either via email or via <em>pull</em>. Now we use another otion: pushing. As the name suggests it's just the opposite of pulling: You <em>push</em> your changes into another repository.</p> <p>But to make use of it, we first need something we can push to.</p> -<p>By default <hg>hg serve</hg> doesn't allow pushing, since that would be a major security hole. You can allow pushing in the server, but that's no solution when you live in different timezones, so we'll go with another approach here: Using a shared repository, either on an existing shared server or on a service like <a title="BitBucket" href="http://bitbucket.org">BitBucket</a>. Doing so has a bit higher starting cost and takes a bit longer to explain, but it's well worth the effort spent.</p> +<p>By default <em>hg serve</em> doesn't allow pushing, since that would be a major security hole. You can allow pushing in the server, but that's no solution when you live in different timezones, so we'll go with another approach here: Using a shared repository, either on an existing shared server or on a service like <a title="BitBucket" href="http://bitbucket.org">BitBucket</a>. Doing so has a bit higher starting cost and takes a bit longer to explain, but it's well worth the effort spent.</p> -<p>If you want to use an existing shared server, you can use <hg>serve</hg> there and <a title="How to allow pushing for hg serve" href="http://www.selenic.com/mercurial/wiki/HgWebDirStepByStep#head-746ca383e3a62df34279ec2fca888113497da022">allow pushing</a>. Also there are some other nice ways to <a title="Multiple Committers" href="http://www.selenic.com/mercurial/wiki/MultipleCommitters">allow pushing to a Mercurial repository</a>, including simple <a title="Setting up a shared Mercurial repository using SSH" href="http://www.selenic.com/mercurial/wiki/SharedSSH">access via SSH</a>.</p> +<p>If you want to use an existing shared server, you can use <em>serve</em> there and <a title="How to allow pushing for hg serve" href="http://www.selenic.com/mercurial/wiki/HgWebDirStepByStep#head-746ca383e3a62df34279ec2fca888113497da022">allow pushing</a>. Also there are some other nice ways to <a title="Multiple Committers" href="http://www.selenic.com/mercurial/wiki/MultipleCommitters">allow pushing to a Mercurial repository</a>, including simple <a title="Setting up a shared Mercurial repository using SSH" href="http://www.selenic.com/mercurial/wiki/SharedSSH">access via SSH</a>.</p> <p>Otherwise you first need to setup a BitBucket Account. Just signup at <a title="BitBucket" href="http://bitbucket.org">BitBucket</a>. After signing up (and login) hover your mouse over "Repositories". There click the item at the bottom of the opening dialog which say "Create new".</p> @@ -441,7 +441,7 @@ </pre> -<p>Now your repository is created and you see instructions for <hg>push</hg>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/ @@ -449,7 +449,7 @@ <p>(Replace the URL with the URL of your created repository. If your username is "Foo" and your repository is named "bar", the URL will be https://bitbucket.org/Foo/bar/)</p> -<p>Mercurial will ask for your BitBucket name and password, then <hg>push</hg> your code.</p> +<p>Mercurial will ask for your BitBucket name and password, then <em>push</em> your code.</p> <p>VoilĂ , your code is online.</p> @@ -457,11 +457,11 @@ <p>Now it's time to tell all your collegues to sign up at BitBucket, too.</p> -<p>After that you can click the "Admin" tab of your created repository and add the usernames of your collegues on the right side under "Permission: Writers". Now they are allowed to <hg>push</hg> code to the repository.</p> +<p>After that you can click the "Admin" tab of your created repository and add the usernames of your collegues on the right side under "Permission: Writers". Now they are allowed to <em>push</em> code to the repository.</p> <p>(If you chose to make the repository private, you'll need to add them to "Permission: Readers", too)</p> -<p>If one of you now wants to publish changes, he'll simply <hg>push</hg> them to the repository, and all others get them by <hg>pull</hg>ing.</p> +<p>If one of you now wants to publish changes, he'll simply <em>push</em> them to the repository, and all others get them by <em>pull</em>ing.</p> <p>Publish your changes</p> @@ -475,15 +475,15 @@ </pre> -<p>People who join you in development can also just <hg>clone</hg> this repository, as if one of you were using <hg>hg serve</hg></p> +<p>People who join you in development can also just <em>clone</em> this repository, as if one of you were using <em>hg serve</em></p> <pre>$ hg clone https://bitbucket.org/ArneBab/hello/ hello </pre> -<p>That local repository will automatically be configured to pull/push from/to the online repository, so new contributors can just use <hg>hg push</hg> and <hg>hg pull</hg> without an URL.</p> +<p>That local repository will automatically be configured to pull/push from/to the online repository, so new contributors can just use <em>hg push</em> and <em>hg pull</em> without an URL.</p> -<p>Note: To make this workflow more scaleable, each one of you can have his own BitBucket repository and you can simply <hg>pull</hg> from the others repositories. That way you can easily establish workflows in which certain people act as integrators and finally <hg>push</hg> checked code to a shared pull repository from which all others pull.</p> +<p>Note: To make this workflow more scaleable, each one of you can have his own BitBucket repository and you can simply <em>pull</em> from the others repositories. That way you can easily establish workflows in which certain people act as integrators and finally <em>push</em> checked code to a shared pull repository from which all others pull.</p> <p>Note: You can also use this workflow with a shared server instead of BitBucket, either via SSH or via a shared directory. An example for an SSH URL with Mercurial is be ssh://user@example.com/path/to/repo. When using a shared directory you just push as if the repository in the shared directory were on your local drive.</p> @@ -491,7 +491,7 @@ <p>Now let's take a step back and look where we are.</p> -<p>With the commands you already know, a bit reading of <hg>hg help <command></hg> and some evil script-fu you can already do almost everything you'll ever need to do when working with source code history. So from now on almost everything is convenience, and that's a good thing.</p> +<p>With the commands you already know, a bit reading of <em>hg help <command></em> and some evil script-fu you can already do almost everything you'll ever need to do when working with source code history. So from now on almost everything is convenience, and that's a good thing.</p> <p>First this is good, because it means, that you can now use most of the concepts which are utilized in more complex workflows.</p> @@ -591,14 +591,14 @@ <p>When you routinely pull code from others, it can happen that you overlook some bad change. As soon as others pull that change from you, you have little chance to get completely rid of it.</p> -<p>To resolve that problem, Mercurial offers you the <hg>backout</hg> command. Backing out a change means, that you tell Mercurial to create a commit which reverses the bad change. That way you don't get rid of the bad code in history, but you can remove it from new revisions.</p> +<p>To resolve that problem, Mercurial offers you the <em>backout</em> command. Backing out a change means, that you tell Mercurial to create a commit which reverses the bad change. That way you don't get rid of the bad code in history, but you can remove it from new revisions.</p> <p>Note: The basic commands don't directly rewrite history. If you want to do that, you need to activate some of the extensions which are shipped with mercurial. We'll come to that later on.</p> <h3>Workflow</h3> <p>Let's assume the bad change was revision 3, and you already have one more revision in your -repository. To remove the bad code, you can just <hg>backout</hg> of it. This creates a new +repository. To remove the bad code, you can just <em>backout</em> of it. This creates a new change which reverses the bad change. After backing out, you can then merge that new change into the current code.</p> @@ -650,11 +650,11 @@ </pre> -<p>Now you can <hg>commit</hg>, <hg>pull</hg>, <hg>push</hg> and <hg>merge</hg> (and anything else) as if you were working in a separate repository. If the history of the named branch is linear and you call "hg merge", Mercurial asks you to specify an explicit revision, since the branch in which you work doesn't have anything to merge.</p> +<p>Now you can <em>commit</em>, <em>pull</em>, <em>push</em> and <em>merge</em> (and anything else) as if you were working in a separate repository. If the history of the named branch is linear and you call "hg merge", Mercurial asks you to specify an explicit revision, since the branch in which you work doesn't have anything to merge.</p> <h5>Merge the named branch</h5> -<p>When you finished the feature, you <hg>merge</hg> the branch back into the default branch.</p> +<p>When you finished the feature, you <em>merge</em> the branch back into the default branch.</p> <pre>$ hg update default $ hg merge feature1 @@ -695,7 +695,7 @@ </pre> -<p>When you look at the log you'll now see a line in changeset 3 which marks the Tag. If someone wants to <hg>update</hg> to the tagged revision, he can just use the name of your tag</p> +<p>When you look at the log you'll now see a line in changeset 3 which marks the Tag. If someone wants to <em>update</em> to the tagged revision, he can just use the name of your tag</p> <pre>$ hg update v0.1 @@ -718,13 +718,13 @@ <p>Let's assume you want to get rid of revision 2 and the highest revision is 3.</p> -<p>The first step is to use the "--rev" option to <hg>clone</hg>: Create a clone which only contains the changes up to the specified revision. Since you want to keep revision 1, you only clone up to that</p> +<p>The first step is to use the "--rev" option to <em>clone</em>: Create a clone which only contains the changes up to the specified revision. Since you want to keep revision 1, you only clone up to that</p> <pre>$ hg clone -r 1 project stripped </pre> -<p>Now you can <hg>export</hg> the change 3 from the original repository (project) and <hg>import</hg> it into the stripped one</p> +<p>Now you can <em>export</em> the change 3 from the original repository (project) and <em>import</em> it into the stripped one</p> <pre>$ cd project $ hg export 3 > ../changes.diff @@ -742,7 +742,7 @@ </pre> -<p>That's it. <hg>hg export</hg> also includes the commit message, date, committer and similar metadata, so you are already done.</p> +<p>That's it. <em>hg export</em> also includes the commit message, date, committer and similar metadata, so you are already done.</p> <p>Note: removing history will change the revision IDs of revisions after the removed one, and if you pull from someone else who still has the revision you removed, you will pull the removed parts again. That's why rewriting history should most times only be done for changes which you didn't yet publicise.</p>