comparison hgscm/templates/workflow_guide.html @ 176:f73d4e6949bf

Add index
author David Soria Parra <dsp@php.net>
date Sat, 23 May 2009 15:21:32 +0200
parents 8bb9f5869602
children 9fbcdb15513b
comparison
equal deleted inserted replaced
175:ab2a5f299c2a 176:f73d4e6949bf
12 <p>With Mercurial you can use a multitude of different workflows. This page shows some of them, including their use cases. It is intended to make it easy for beginners of version tracking to get going instantly and learn completely incrementally. It doesn't explain the concepts used, because there are already many other great resources doing that, for example <a title="Understanding Mercurial" href="http://www.selenic.com/mercurial/wiki/UnderstandingMercurial">the wiki</a> and <a title="Behind the Scenes" href="http://hgbook.red-bean.com/read/behind-the-scenes.html">the hgbook</a>.</p> 12 <p>With Mercurial you can use a multitude of different workflows. This page shows some of them, including their use cases. It is intended to make it easy for beginners of version tracking to get going instantly and learn completely incrementally. It doesn't explain the concepts used, because there are already many other great resources doing that, for example <a title="Understanding Mercurial" href="http://www.selenic.com/mercurial/wiki/UnderstandingMercurial">the wiki</a> and <a title="Behind the Scenes" href="http://hgbook.red-bean.com/read/behind-the-scenes.html">the hgbook</a>.</p>
13 13
14 <p>If you want a more exhaustive tutorial with the basics, please have a look at the <a title="Mercurial Tutorial" href="http://www.selenic.com/mercurial/wiki/Tutorial">Tutorial in the Mercurial Wiki</a>. For a really detailed and very nice to read description of Mercurial, please have a look at <a title="Mercurial: The definitive Guide" href="http://hgbook.red-bean.com/">Mercurial: The definitive Guide</a>.</p> 14 <p>If you want a more exhaustive tutorial with the basics, please have a look at the <a title="Mercurial Tutorial" href="http://www.selenic.com/mercurial/wiki/Tutorial">Tutorial in the Mercurial Wiki</a>. For a really detailed and very nice to read description of Mercurial, please have a look at <a title="Mercurial: The definitive Guide" href="http://hgbook.red-bean.com/">Mercurial: The definitive Guide</a>.</p>
15 15
16 <p>Note: This guide doesn't require any prior knowledge of version control systems (though subversion users will likely feel at home quite quickly). Basic commandline abilities are helpful, because we'll use the commandline client. <!--If you already know other systems, please check our transition guides: svn, cvs, git, bzr --></p> 16 <p>Note: This guide doesn't require any prior knowledge of version control systems (though subversion users will likely feel at home quite quickly). Basic commandline abilities are helpful, because we'll use the commandline client. <!--If you already know other systems, please check our transition guides: svn, cvs, git, bzr --></p>
17 17 <h1 id="basic_workflow">Basic workflows</h1>
18 <h1>Basic workflows</h1>
19 18
20 <h2>Log keeping</h2> 19 <h2>Log keeping</h2>
21 20
22 <h3>Use Case</h3> 21 <h3>Use Case</h3>
23 22
122 121
123 <pre>$ hg log -p -r 3 122 <pre>$ hg log -p -r 3
124 123
125 </pre> 124 </pre>
126 125
127 <h2>Lone developer with nonlinear history</h2> 126 <h2 id="lone_developer">Lone developer with nonlinear history</h2>
128 127
129 <h3>Use case</h3> 128 <h3>Use case</h3>
130 129
131 <p>The second workflow is still very easy: You're a lone developer and you want to use Mercurial to keep track of your own changes.</p> 130 <p>The second workflow is still very easy: You're a lone developer and you want to use Mercurial to keep track of your own changes.</p>
132 131
239 238
240 <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> 239 <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>
241 240
242 <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> 241 <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>
243 242
244 <h2>Seperate features</h2> 243 <h2 id="separate_features">Separate features</h2>
245 244
246 <h3>Use Case</h3> 245 <h3>Use Case</h3>
247 246
248 <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> 247 <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>
249 248
323 322
324 <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> 323 <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>
325 324
326 <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> 325 <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>
327 326
328 <h2>Sharing changes</h2> 327 <h2 id="sharing_changes">Sharing changes</h2>
329 328
330 <h3>Use Case</h3> 329 <h3>Use Case</h3>
331 330
332 <p>Now we go one step further: You are no longer alone, and you want to share your changes with others and include their changes.</p> 331 <p>Now we go one step further: You are no longer alone, and you want to share your changes with others and include their changes.</p>
333 332
482 481
483 <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> 482 <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>
484 483
485 <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> 484 <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>
486 485
487 <h2>Summary</h2> 486 <h2 id="basic_summary">Summary</h2>
488 487
489 <p>Now let's take a step back and look where we are.</p> 488 <p>Now let's take a step back and look where we are.</p>
490 489
491 <p>With the commands you already know, a bit reading of <hg>hg help &lt;command&gt;</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> 490 <p>With the commands you already know, a bit reading of <hg>hg help &lt;command&gt;</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>
492 491
578 </pre> 577 </pre>
579 578
580 579
581 <p>Let's move on towards useful features and a bit more advanced workflows.</p> 580 <p>Let's move on towards useful features and a bit more advanced workflows.</p>
582 581
583 <h2>Backing out bad revisions</h2> 582 <h1 id="advanced_workflows">Advanced workflows</h1>
583
584 <h2 id="backing_out">Backing out bad revisions</h2>
584 585
585 <h3>Use Case</h3> 586 <h3>Use Case</h3>
586 587
587 <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> 588 <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>
588 589
602 603
603 </pre> 604 </pre>
604 605
605 <p>That's it. You reversed the bad change. It's still recorded that it was once there (following the principle "don't rewrite history, if it's not really necessary"), but it doesn't affect future code anymore.</p> 606 <p>That's it. You reversed the bad change. It's still recorded that it was once there (following the principle "don't rewrite history, if it's not really necessary"), but it doesn't affect future code anymore.</p>
606 607
607 <h2>Collaborative feature development</h2> 608 <h2 id="collaborative_development">Collaborative feature development</h2>
608 609
609 <p>Now that you can share changes and reverse them if necessary, you can go one step further: Using Mercurial to help in coordinating the coding.</p> 610 <p>Now that you can share changes and reverse them if necessary, you can go one step further: Using Mercurial to help in coordinating the coding.</p>
610 611
611 <p>The first part is an easy way to develop features together, without requiring every developer to keep track of several feature clones.</p> 612 <p>The first part is an easy way to develop features together, without requiring every developer to keep track of several feature clones.</p>
612 613
657 658
658 <p>And that's it. Now you can easily keep features separate without unnecessary bookkeeping.</p> 659 <p>And that's it. Now you can easily keep features separate without unnecessary bookkeeping.</p>
659 660
660 <p>Note: Named branches stay in history as permanent record after you finished your work. If you don't like having that record in your history, please have a look at some of the advanced <a title="Mercurial Workflows" href="http://www.selenic.com/mercurial/wiki/Workflows">workflows</a>.</p> 661 <p>Note: Named branches stay in history as permanent record after you finished your work. If you don't like having that record in your history, please have a look at some of the advanced <a title="Mercurial Workflows" href="http://www.selenic.com/mercurial/wiki/Workflows">workflows</a>.</p>
661 662
662 <h2>Tagging revisions</h2> 663 <h2 id="tagging">Tagging revisions</h2>
663 664
664 <h3>Use Case</h3> 665 <h3>Use Case</h3>
665 666
666 <p>Since you can now code separate features more easily, you might want to mark certain revisions as fit for consumption (or similar). For example you might want to mark releases, or just mark off revisions as reviewed.</p> 667 <p>Since you can now code separate features more easily, you might want to mark certain revisions as fit for consumption (or similar). For example you might want to mark releases, or just mark off revisions as reviewed.</p>
667 668
694 </pre> 695 </pre>
695 696
696 <p>Now he'll be at the tagged revision and can work from there.</p> 697 <p>Now he'll be at the tagged revision and can work from there.</p>
697 698
698 699
699 <h2>Removing history</h2> 700 <h2 id="removing_history">Removing history</h2>
700 701
701 <h3>Use Case</h3> 702 <h3>Use Case</h3>
702 703
703 <p>At times you will have changes in your repository, which you really don't want in it.</p> 704 <p>At times you will have changes in your repository, which you really don't want in it.</p>
704 705
736 737
737 <p>That's it. <hg>hg export</hg> also includes the commit message, date, committer and similar metadata, so you are already done.</p> 738 <p>That's it. <hg>hg export</hg> also includes the commit message, date, committer and similar metadata, so you are already done.</p>
738 739
739 <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> 740 <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>
740 741
741 <h2>Summary</h2> 742 <h2 id="advanced_summary">Summary</h2>
742 743
743 <p>So now you can work with Mercurial in private, and also share your changes in a multitude of ways.</p> 744 <p>So now you can work with Mercurial in private, and also share your changes in a multitude of ways.</p>
744 745
745 <p>Additionally you can remove bad changes, either by creating a change in the repository which reverses the original change, or by really rewriting history, so it looks like the change never occured.</p> 746 <p>Additionally you can remove bad changes, either by creating a change in the repository which reverses the original change, or by really rewriting history, so it looks like the change never occured.</p>
746 747
747 <p>And you can separate the work on features in a single repository by using named branches and add tags to revisions which are visible markers for others and can be used to update to the tagged revisions.</p> 748 <p>And you can separate the work on features in a single repository by using named branches and add tags to revisions which are visible markers for others and can be used to update to the tagged revisions.</p>
748 749
749 <p>With this we can conclude our practical guide.</p> 750 <p>With this we can conclude our practical guide.</p>
750 751
751 <h1>More Complex Workflows</h1> 752 <h1 id="complex_workflows">More Complex Workflows</h1>
752 753
753 <p>If you now want to check some more complex workflows, please have a look at the general <a title="Mercurial Workflows" href="http://selenic.com/mercurial/wiki/Workflows">workflows wikipage</a>.</p> 754 <p>If you now want to check some more complex workflows, please have a look at the general <a title="Mercurial Workflows" href="http://selenic.com/mercurial/wiki/Workflows">workflows wikipage</a>.</p>
754 755
755 <p>To deepen your understanding, you should also check the <a title="Overview of the basic concepts of Mercurial" href="quick_start_concepts">basic concept overview</a>.</p> 756 <p>To deepen your understanding, you should also check the <a title="Overview of the basic concepts of Mercurial" href="quick_start_concepts">basic concept overview</a>.</p>
756 757
758 759
759 760
760 761
761 </div> 762 </div>
762 <div class="col"> 763 <div class="col">
763 {% download_button %} 764 <h2>Index</h2>
764 {% mercurial_tricks %} 765 <ul>
766 <li><a href="#basic_workflow">Basic workflows</a></li>
767 <ul>
768 <li><a href="#lone_developer">Lone developer with nonlinear history</a></li>
769 <li><a href="#separate_features">Separate features</a></li>
770 <li><a href="#sharing_changes">Sharing changes</a></li>
771 <li><a href="#basic_summary">Summary</a></li>
772 </ul>
773 <li><a href="#advanced_workflows">Advanced workflows</a></li>
774 <ul>
775 <li><a href="#backing_out">Backing out bad revisions</a></li>
776 <li><a href="#collaborative_development">Collaborative feature development</a></li>
777 <li><a href="#tagging">Tagging revisions</a></li>
778 <li><a href="#removing_history">Removing history</a></li>
779 <li><a href="#advanced_summary">Summary</a></li>
780 </ul>
781 <li><a href="#complex_workflows">More complex workflows</a></li>
782 </ul>
783
765 </div> 784 </div>
766 </div> 785 </div>
767 786
768 </div> 787 </div>
769 788