Mercurial > hg-website
annotate text/learning_mercurial_in_workflows.txt @ 115:8a603a9cbc04
learning in workflows: Minor addition to backout.
author | Arne Babenhauserheide <bab@draketo.de> |
---|---|
date | Fri, 24 Apr 2009 10:30:27 +0200 |
parents | 8b51ceb2d36b |
children | 0bee8982f334 |
rev | line source |
---|---|
102
fa153f85e455
workflows: Changed the title to 'Learning Mercurial in Workflows'.
Arne Babenhauserheide <bab@draketo.de>
parents:
101
diff
changeset
|
1 = Learning Mercurial in Workflows = |
97 | 2 |
3 With Mercurial you can use a multitude of different workflows. This page shows some of them, including their use cases. | |
4 | |
5 It is intended to make it easier for you to create your own workflow. | |
6 | |
103
2bbea4b68181
workflows: minor text polishing.
Arne Babenhauserheide <bab@draketo.de>
parents:
102
diff
changeset
|
7 To write this page we gathered [real life workflows](wiki - workflows), so every more complex workflow in here has proven itself in real life usage. We begin with basic workflows and then go on to more complex examples. |
99
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
8 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
9 <!--Structure: |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
10 * For whom? -> Why? |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
11 * What do you need? -> Resources + extensions |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
12 * Single Developer workflow |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
13 * Sharing changes. --> |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
14 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
15 <!-- Plan |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
16 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
17 * Simple workflows without extensions |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
18 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
19 * Complex Workflows, including collaborative patch development and similar. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
20 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
21 * Smoothing workflows with extensions -> i.e. shelve before merging. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
22 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
23 --> |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
24 |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
25 = Basic workflows = |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
26 |
99
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
27 == Sysadmin workflow == |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
28 |
101
7bcdd8b947fe
workflows: small fixes.
Arne Babenhauserheide <bab@draketo.de>
parents:
100
diff
changeset
|
29 === Use Case === |
7bcdd8b947fe
workflows: small fixes.
Arne Babenhauserheide <bab@draketo.de>
parents:
100
diff
changeset
|
30 |
99
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
31 The first workflow is also the easiest one: You're a sysadmin and you want to use Mercurial to be able to look back when you did which changes. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
32 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
33 This workflow only requires an installed Mercurial and write access to some file storage (you almost definitely have that :) ). It shows the basic technics for more complex workflows. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
34 |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
35 Note: The name doesn't mean that every sysadmin will only need this simple workflow. It was chosen in honor of a [mail]() which reminded us, that this simple usage is already a workflow in its own right. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
36 |
99
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
37 === Workflow === |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
38 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
39 ==== Initialize the project ==== |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
40 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
41 <code>$ hg init project</code> |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
42 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
43 ==== Add files and track them ==== |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
44 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
45 <code>$ cd project |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
46 $ (add files) |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
47 $ hg add </code> |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
48 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
49 Note: You can also go into an existing directory with files and init the repository there. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
50 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
51 $ cd project |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
52 $ hg init |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
53 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
54 You can also just add 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 beginning with "file0" as well as file10, file11 and file12. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
55 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
56 $ hg add file0* file10 file11 file12 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
57 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
58 ==== Save changes ==== |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
59 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
60 $ (do some changes) |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
61 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
62 see which files changed, which have been added or removed, and which aren't tracked yet. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
63 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
64 $ hg status |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
65 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
66 see the exact changes. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
67 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
68 $ hg diff |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
69 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
70 commit the changes. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
71 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
72 $ hg commit |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
73 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
74 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. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
75 |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
76 Note: You can also supply teh commit message directly via "hg commit -m 'MESSAGE'" |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
77 |
99
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
78 ==== Check your history ==== |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
79 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
80 $ hg log |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
81 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
82 This prints a list of changesets along with their data, the user who committed them (you) and their commit message. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
83 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
84 == Lone developer with linear history == |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
85 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
86 === Use case === |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
87 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
88 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. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
89 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
90 It works just like the sysadmin workflow, with the difference that you go back to earlied changes at times. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
91 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
92 To start a new project, you initialize a repository, add your files and commit whenever you finished a part of your work (atomic commits). |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
93 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
94 Also you check your history from time to time, so see how you progressed. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
95 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
96 === Workflow === |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
97 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
98 ==== Basics from sysadmin ==== |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
99 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
100 Init your project, add files, see changes and commit them. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
101 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
102 <code>$ hg init project |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
103 $ cd project |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
104 $ (add files) |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
105 $ hg add # tell Mercurial to track all files |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
106 $ (do some changes) |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
107 $ hg diff # see changes |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
108 $ hg commit # save changes |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
109 $ hg log # see history |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
110 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
111 ==== Seeing an earlier revision ==== |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
112 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
113 Different from the sysadmin workflow, you'll want to go back in history at times and undo some changes, for example because it introduced a bug. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
114 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
115 To look at a previous version of your code, you can use update. Let's assume that you want to see revision 3. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
116 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
117 $ hg update 3 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
118 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
119 Now your code is back at revision 3, the fourth commit (Mercurial starts couting at 0). |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
120 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
121 To update to the most recent revision, you can use "tip" as revision name. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
122 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
123 $ hg update tip |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
124 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
125 Note: If at any place any command complains, your best bet is to read what it tells you and follow that advice. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
126 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
127 Note: Instead of "hg update" you can also use the shorthand "hg up". Similarly you can abbreviate "hg commit" to "hg ci". |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
128 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
129 ==== Fixing errors in earlier revisions ==== |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
130 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
131 When you find a bug in some earlier revision you have two options: eaither you can fix it in the current code, or you can go back in history and fix the code exactly where you did it. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
132 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
133 To do so, 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. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
134 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
135 Let's assume the bug was introduced in revision 3. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
136 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
137 $ hg update 3 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
138 $ (fix the bug) |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
139 $ hg commit |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
140 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
141 Now the fix is already stored in history. We just need to merge it with the current version of your code. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
142 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
143 $ hg merge |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
144 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
145 If there are conflicts use "hg resolve" - that's also what merge tells you to do in case of conflicts. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
146 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
147 $ hg commit |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
148 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
149 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. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
150 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
151 |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
152 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. |
99
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
153 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
154 == Seperate features == |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
155 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
156 === Use Case === |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
157 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
158 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. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
159 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
160 After finishing your feature you then "pull" it back into your main directory and "merge" the changes. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
161 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
162 === Workflow === |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
163 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
164 $ hg clone project feature1 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
165 $ cd feature1 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
166 $ (do some changes and commits) |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
167 $ cd ../project |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
168 $ hg pull ../feature1 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
169 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
170 Now you have the history of feature1 inside your project, but they aren't yet visible. Instead they are only stored inside the .hg directory inside the project. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
171 |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
172 Note: From now on we'll use the name "repository" for a directory which has a .hg directory with Mercurial history. |
101
7bcdd8b947fe
workflows: small fixes.
Arne Babenhauserheide <bab@draketo.de>
parents:
100
diff
changeset
|
173 |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
174 If you didn't do any changes in the project, while you were working on feature1, you can just update to tip ("hg update tip"), but it is more likely that you'll have done some other changes in between changes. In that case, it's time for merging. |
99
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
175 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
176 Merge feature1 into the project code: |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
177 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
178 $ hg merge |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
179 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
180 If there are conflicts use "hg resolve" - that's also what merge tells you to do in case of conflicts. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
181 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
182 $ hg commit -m "merged feature1" |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
183 |
101
7bcdd8b947fe
workflows: small fixes.
Arne Babenhauserheide <bab@draketo.de>
parents:
100
diff
changeset
|
184 You can create an arbitrary number of clones and also carry them around on USB sticks. Also you can use them to synchronize your work at home and at work. |
99
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
185 |
104
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
186 == Sharing changes == |
100
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
187 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
188 === Use Case === |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
189 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
190 Now we go one step further: You are no longer alone, and you want to share your changes with others and include their changes. |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
191 |
104
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
192 The basic requirement for that is that you have to be able to see the changes of others. |
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
193 |
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
194 Mercurial allows you to do that very easily by including a simple webserver from which you can pull changes just as you can pull changes from local clones. |
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
195 |
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
196 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 "push" changes instead of pulling them. |
100
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
197 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
198 === Workflow === |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
199 |
104
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
200 ==== Using the builtin webserver ==== |
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
201 |
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
202 This is the easiest way to quickly share changes. |
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
203 |
100
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
204 First the one who wants to share his changes creates the webserver |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
205 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
206 $ hg serve |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
207 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
208 Now all others can point their browsers to his IP address (i.e. 192.168.178.100) at port 8000. They will then see all his history there and can sdecide if they want to pull his changes. |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
209 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
210 $ firefox http://192.168.178.100:8000 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
211 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
212 If they decide to include the changes, they just pull from the same URL |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
213 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
214 $ hg pull http://192.168.178.100:8000 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
215 |
106
cdcc94ca41e7
workflows: just polishing.
Arne Babenhauserheide <bab@draketo.de>
parents:
104
diff
changeset
|
216 At this point you all can work as if you had pulled from a local repository. All the data is now in your individual repositories and you can merge the changes and work with them without needing any connection to the served repository. |
100
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
217 |
104
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
218 ==== Sending changes by email ==== |
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
219 |
108
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
220 Often you won't have direct access to the repository of someone else, be it because he's behind a restrictive firewall, or because you live in different timezones. You might also want to keep your changes confidential and prefer internal email (be sure to encrypt your emails with GnuPG!). |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
221 |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
222 In that case, you can easily export your changes as patches and send them by email. |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
223 |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
224 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. |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
225 |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
226 Sending the changes via email is pretty straightforward with Mercurial. You just "export" your changes and attach (or copy paste) it in your email. Your collegues can then just "import" them. |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
227 |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
228 First check which changes you want to export |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
229 |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
230 $ cd project |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
231 $ hg log |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
232 |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
233 We assume that you want to export changeset 3 and 4: |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
234 |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
235 $ hg export 3 > change3.diff |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
236 $ hg export 4 > change4.diff |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
237 |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
238 Now attach them to an email and your collegues can just run "import" on both diffs to get your full changes, including your user information. |
108
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
239 |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
240 To be careful, they first clone their repository to have an integration directory: |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
241 |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
242 $ hg clone project integration |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
243 $ cd integration |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
244 $ hg import change3.diff |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
245 $ hg import change4.diff |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
246 |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
247 That's it. They can now test your changes in feature clones. If they accept them, they pull the changes into the main repository. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
248 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
249 $ cd ../project |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
250 $ hg pull ../integration |
108
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
251 |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
252 Note: The patchbomb extension automates the email-sending, but you don't need it for this workflow. |
ed683ad3947f
learning in workflows: Send changes by email.
Arne Babenhauserheide <bab@draketo.de>
parents:
107
diff
changeset
|
253 |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
254 Note 2: You can also send around bundles, which are snippets of your actual history. Just create them via |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
255 $ hg bundle --base FIRST_REVISION_TO_BUNDLE changes.bundle |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
256 Others can then get your changes by simply pulling them, as if your bundle were an actual repository |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
257 $ hg pull path/to/changes.bundle |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
258 |
104
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
259 ==== Using a shared repository ==== |
03591004ed44
workflows: Added plan for sharing via email and via shared repo (bitbucket).
Arne Babenhauserheide <bab@draketo.de>
parents:
103
diff
changeset
|
260 |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
261 Sending changes by mail 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 send mails and then import the changes manually. Luckily there's an easier way which works quite well: The shared push repository. |
110
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
262 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
263 Till now we transferred all changes either via email or via pull, but there's yet another way: pushing. As the name suggests it's just the opposite of pulling: You push your changes into another repository. |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
264 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
265 But to make use of it, we first need something we can push to. |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
266 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
267 By default "hg serve" 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 on BitBucket. Doing so has a bit higher starting cost and takes a bit longer to explain, but it's well worth the effort spent. |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
268 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
269 For it you first need to setup a BitBucket Account. Just signup there and then hover your mouse over "Repositories". There click the item at the bottom of the opening dialog which say "Create new". |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
270 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
271 Give it a name and a description, and if you want to keep it hidden from the public, select "private". |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
272 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
273 $ firefox http://bitbucket.org |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
274 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
275 Now your repository is created and you see instructions to "push" code to it. for that you'll use a command similar to the following (just with a different URL): |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
276 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
277 $ hg push https://bitbucket.org/ArneBab/1w6/ |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
278 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
279 (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/) |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
280 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
281 Mercurial will ask for your BitBucket password, then push your code. |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
282 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
283 Voilà , your code is online. |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
284 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
285 Now it's time to tell all your collegues to sign up at BitBucket, too. |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
286 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
287 After that you can click the "Admin" tab of your created repository and add the names of your collegues on the right side under "Permission: Writers". Now they are allowed to push code to the repository. |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
288 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
289 (If you chose to make the repository private, you'll need to add them to "Permission: Readers", too) |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
290 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
291 If one of you now wants to publish changes, he'll simply push them to the repository, and all others get them by pulling. |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
292 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
293 Publish your changes: |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
294 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
295 $ hg push https://bitbucket.org/ArneBab/1w6/ |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
296 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
297 Pull others changes into your local repository: |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
298 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
299 $ hg pull https://bitbucket.org/ArneBab/1w6/ |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
300 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
301 People who join you in development can also just clone this repository, as if one of you were using "hg serve": |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
302 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
303 $ hg clone https://bitbucket.org/ArneBab/1w6/ 1w6 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
304 |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
305 That local repository will automatically be configured to pull/push from/to the online repository, so new contributors can just use "hg push" and "hg pull" without an URL. |
8c8c8aaaaad7
learning in workflows: added sharing changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
108
diff
changeset
|
306 |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
307 Note: To make this workflow more scaleable, each one of you can have his own BitBucket repository and you can simply pull from the others repositories. That way you can easily establish workflows in which certain people act as integrators and finally push checked code to a shared pull repository from which all others pull. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
308 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
309 == Summary == |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
310 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
311 Now let's take a step back and look where we are. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
312 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
313 With the commands you already know, a bit reading of "hg help <command>" 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. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
314 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
315 First this is good, because it means, that you can now use most of the concepts which are used in more complex workflows. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
316 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
317 Second it aids you, because convenience lets you focus on your task instead of focussing on your tool. It helps you concentrate on the coding itself. Still you can always go back to the basics, if you want to. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
318 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
319 A short summary of what you can do which can also act as a short check, if you still remember the meaning of the commands: |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
320 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
321 create a project |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
322 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
323 $ hg init project |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
324 $ cd project |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
325 $ (add some files) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
326 $ hg add |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
327 $ hg commit |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
328 (enter the commit message) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
329 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
330 do nonlinear development |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
331 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
332 $ (do some changes) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
333 $ hg commit |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
334 (enter the commit message) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
335 $ hg update 0 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
336 $ (do some changes) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
337 $ hg commit |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
338 (enter the commit message) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
339 $ hg merge |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
340 $ (optionally hg resolve) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
341 $ hg commit |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
342 (enter the commit message) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
343 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
344 use feature clones |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
345 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
346 $ cd .. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
347 $ hg clone project feature1 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
348 $ cd feature1 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
349 $ (do some changes) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
350 $ hg commit |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
351 (enter the commit message) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
352 $ cd ../project |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
353 $ hg pull ../feature1 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
354 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
355 share your repository via the integrated webserver |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
356 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
357 $ hg serve & |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
358 $ cd .. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
359 $ hg clone http://127.0.0.1:8000 project-clone |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
360 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
361 export changes to files |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
362 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
363 $ cd project-clone |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
364 $ (do some changes) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
365 $ hg commit |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
366 (enter the commit message) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
367 $ hg export tip > ../changes.diff |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
368 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
369 import changes from files |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
370 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
371 $ cd ../project |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
372 $ hg import ../changes.diff |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
373 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
374 pull changes from a served repository (hg serve still runs on project) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
375 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
376 $ cd ../feature1 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
377 $ hg pull http://127.0.0.1:8000 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
378 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
379 Use shared repositories on BitBucket |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
380 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
381 $ (setup bitbucket repo) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
382 $ hg push https://bitbucket.org/USER/REPO |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
383 (enter name and password in the prompt) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
384 $ hg pull https://bitbucket.org/USER/REPO |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
385 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
386 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
387 Let's move on towards useful features and a bit more advanced workflows. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
388 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
389 == Backing out bad revisions == |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
390 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
391 === Use Case === |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
392 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
393 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. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
394 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
395 To resolve that problem, Mercurial offers you the backout 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. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
396 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
397 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. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
398 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
399 === Workflow === |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
400 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
401 Let's assume the bad change was revision 3, and we already have one more revision in our repository. To remove the bad code, we just backout of it. This creates a new change which reverses the bad change. After backing out, we merge that new change into the current code. |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
402 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
403 $ hg backout 3 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
404 $ hg merge |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
405 (potentially resolve conflicts) |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
406 $ hg commit |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
407 (enter commit message. For example: "merged backout") |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
408 |
115
8a603a9cbc04
learning in workflows: Minor addition to backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
111
diff
changeset
|
409 That's it. You reversed the bad change. It's still recorded that it was once there (don't rewrite history, if it's not really necessary), but it doesn't affect future code anymore. |
111
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
410 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
411 == Collaborative feature development == |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
412 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
413 -> branches |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
414 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
415 == Tagging revisions == |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
416 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
417 -> hg tag |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
418 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
419 == Removing history == |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
420 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
421 -> hg clone -r , hg export, hg import, ... |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
422 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
423 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
424 = More Complex Workflows = |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
425 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
426 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
427 |
8b51ceb2d36b
learning in workflows: Added backout.
Arne Babenhauserheide <bab@draketo.de>
parents:
110
diff
changeset
|
428 = Smoothing workflows with extensions = |