comparison hgscm/templates/workflow_guide.html @ 155:5451a67b896f

learning in workflows: Manually added linebreaks (<p> tags) and took the chance to do some more polishing.
author Arne Babenhauserheide <bab@draketo.de>
date Tue, 12 May 2009 08:59:38 +0200
parents 08f4b19d865e
children bc05b688ac06
comparison
equal deleted inserted replaced
154:08f4b19d865e 155:5451a67b896f
17 17
18 <h3>Log keeping</h3> 18 <h3>Log keeping</h3>
19 19
20 <h4>Use Case</h4> 20 <h4>Use Case</h4>
21 21
22 The first workflow is also the easiest one: You want to use Mercurial to be able to look back when you did which changes. 22 <p>The first workflow is also the easiest one: You want to use Mercurial to be able to look back when you did which changes.</p>
23 23
24 This workflow only requires an installed Mercurial and write access to some file storage (you almost definitely have that :) ). It shows the basic techniques for more complex workflows. 24 <p>This workflow only requires an installed Mercurial and write access to some file storage (you almost definitely have that :) ). It shows the basic techniques for more complex workflows.</p>
25 25
26 <h4>Workflow</h4> 26 <h4>Workflow</h4>
27 27
28 <h5>Prepare MercuriaL</h5> 28 <h5>Prepare MercuriaL</h5>
29 29
30 As first step, you should teach Mercurial your name. For that you open the file ~/.hgrc with a text-editor and add the ui section (user interaction) with your username: 30 <p>As first step, you should teach Mercurial your name. For that you open the file ~/.hgrc with a text-editor and add the ui section (user interaction) with your username:</p>
31 31
32 <pre>[ui] 32 <pre>[ui]
33 username = Mr. Johnson <johnson@smith.com></pre> 33 username = Mr. Johnson <johnson@smith.com></pre>
34 34
35 <h5>Initialize the project</h5> 35 <h5>Initialize the project</h5>
40 40
41 <pre>$ cd project 41 <pre>$ cd project
42 $ (add files) 42 $ (add files)
43 $ hg add </pre> 43 $ hg add </pre>
44 44
45 Note: You can also go into an existing directory with files and init the repository there. 45 <p>Note: You can also go into an existing directory with files and init the repository there. </p>
46 46
47 <pre>$ cd project 47 <pre>$ cd project
48 $ hg init</pre> 48 $ hg init</pre>
49 49
50 Alternatively you can add only 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 whose names begin with "file0" as well as file10, file11 and file12. 50 <p>Alternatively you can add only 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 whose names begin with "file0" as well as file10, file11 and file12.</p>
51 51
52 <pre>$ hg add file0* file10 file11 file12</pre> 52 <pre>$ hg add file0* file10 file11 file12</pre>
53 53
54 <h5>Save changes</h5> 54 <h5>Save changes</h5>
55 55
56 <pre>$ (do some changes)</pre> 56 <pre>$ (do some changes)</pre>
57 57
58 see which files changed, which have been added or removed, and which aren't tracked yet. 58 <p>see which files changed, which have been added or removed, and which aren't tracked yet</p>
59 59
60 <pre>$ hg status</pre> 60 <pre>$ hg status</pre>
61 61
62 see the exact changes. 62 <p>see the exact changes</p>
63 63
64 <pre>$ hg diff</pre> 64 <pre>$ hg diff</pre>
65 65
66 commit the changes. 66 commit the changes.
67 67
68 <pre>$ hg commit</pre> 68 <pre>$ hg commit</pre>
69 69
70 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. 70 <p>now an editor pops up and asks you for a commit message. Upon saving and closing the editor, your changes have been stored by Mercurial.</p>
71 71
72 Note: You can also supply the commit message directly via <hg>hg commit -m 'MESSAGE'</hg> 72 <p>Note: You can also supply the commit message directly via <hg>hg commit -m 'MESSAGE'</hg>.</p>
73 73
74 <h5>Move and copy files</h5> 74 <h5>Move and copy files</h5>
75 75
76 When you copy or move files, you should tell Mercurial to do the copy or move for you, so it can track the relationship between the files. 76 <p>When you copy or move files, you should tell Mercurial to do the copy or move for you, so it can track the relationship between the files.</p>
77 77
78 Remember to <hg>commit</hg> after moving or copying. From the basic commands only <hg>commit</hg> creates a new revision. 78 <p>Remember to <hg>commit</hg> after moving or copying. From the basic commands only <hg>commit</hg> creates a new revision</p>
79 79
80 <pre>$ hg cp original copy 80 <pre>$ hg cp original copy
81 $ hg commit 81 $ hg commit
82 (enter the commit message) 82 (enter the commit message)
83 $ hg mv original target 83 $ hg mv original target
84 $ hg commit 84 $ hg commit
85 (enter the commit message)</pre> 85 (enter the commit message)</pre>
86 86
87 Now you have two files, "copy" and "target", and Mercurial knows how they are related. 87 <p>Now you have two files, "copy" and "target", and Mercurial knows how they are related.</p>
88 88
89 Note: Should you forget to do the explicit copy or move, you can still tell Mercurial to detect the changes via <hg>hg addremove --similarity 100</hg>. Just use <hg>hg help addremove</hg> for details. 89 <p>Note: Should you forget to do the explicit copy or move, you can still tell Mercurial to detect the changes via <hg>hg addremove --similarity 100</hg>. Just use <hg>hg help addremove</hg> for details.</p>
90 90
91 <h5>Check your history</h5> 91 <h5>Check your history</h5>
92 92
93 <pre>$ hg log</pre> 93 <pre>$ hg log</pre>
94 94
100 100
101 <h3>Lone developer with linear history</h3> 101 <h3>Lone developer with linear history</h3>
102 102
103 <h4>Use case</h4> 103 <h4>Use case</h4>
104 104
105 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. 105 <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>
106 106
107 It works just like the log keeping workflow, with the difference that you go back to earlied changes at times. 107 <p>It works just like the log keeping workflow, with the difference that you go back to earlied changes at times.</p>
108 108
109 To start a new project, you initialize a repository, add your files and commit whenever you finished a part of your work. 109 <p>To start a new project, you initialize a repository, add your files and commit whenever you finished a part of your work.</p>
110 110
111 Also you check your history from time to time, so see how you progressed. 111 <p>Also you check your history from time to time, so see how you progressed.</p>
112 112
113 <h4>Workflow</h4> 113 <h4>Workflow</h4>
114 114
115 <h5>Basics from log keeping</h5> 115 <h5>Basics from log keeping</h5>
116 116
117 Init your project, add files, see changes and commit them. 117 <p>Init your project, add files, see changes and commit them.</p>
118 118
119 <pre>$ hg init project 119 <pre>$ hg init project
120 $ cd project 120 $ cd project
121 $ (add files) 121 $ (add files)
122 $ hg add # tell Mercurial to track all files 122 $ hg add # tell Mercurial to track all files
127 $ hg mv # move files or folders 127 $ hg mv # move files or folders
128 $ hg log # see history</pre> 128 $ hg log # see history</pre>
129 129
130 <h5>Seeing an earlier revision</h5> 130 <h5>Seeing an earlier revision</h5>
131 131
132 Different from the log keeping workflow, you'll want to go back in history at times and do some changes directly there, for example because an earlier change introduced a bug and you want to fix it where it occurred. 132 <p>Different from the log keeping workflow, you'll want to go back in history at times and do some changes directly there, for example because an earlier change introduced a bug and you want to fix it where it occurred.</p>
133 133
134 To look at a previous version of your code, you can use update. Let's assume that you want to see revision 3. 134 <p>To look at a previous version of your code, you can use update. Let's assume that you want to see revision 3.</p>
135 135
136 <pre>$ hg update 3</pre> 136 <pre>$ hg update 3</pre>
137 137
138 Now your code is back at revision 3, the fourth commit (Mercurial starts counting at 0). 138 <p>Now your code is back at revision 3, the fourth commit (Mercurial starts counting at 0).
139 To check if you're really at that revision, you can use <hg>identify -n</hg>. 139 To check if you're really at that revision, you can use <hg>identify -n</hg>.</p>
140 140
141 <pre>$ hg identify -n</pre> 141 <pre>$ hg identify -n</pre>
142 142
143 Note: <hg>identify</hg> without options gives you the short form of a unique revision ID. That ID is what Mercurial uses internally. If you tell someone about the version you updated to, you should use that ID, since the numbers can be different for other people. If you want to know the reasons behind that, please read up Mercurials [basic concepts](). When you're at the most recent revision, <hg>hg identify -n</hg> will return "-1". 143 <p>Note: <hg>identify</hg> without options gives you the short form of a unique revision ID. That ID is what Mercurial uses internally. If you tell someone about the version you updated to, you should use that ID, since the numbers can be different for other people. If you want to know the reasons behind that, please read up Mercurials [basic concepts](). When you're at the most recent revision, <hg>hg identify -n</hg> will return "-1".</p>
144 144
145 To update to the most recent revision, you can use "tip" as revision name. 145 <p>To update to the most recent revision, you can use "tip" as revision name.</p>
146 146
147 <pre>$ hg update tip</pre> 147 <pre>$ hg update tip</pre>
148 148
149 Note: If at any place any command complains, your best bet is to read what it tells you and follow that advice. 149 <p>Note: If at any place any command complains, your best bet is to read what it tells you and follow that advice.</p>
150 150
151 Note: Instead of <hg>hg update</hg> you can also use the shorthand <hg>hg up</hg>. Similarly you can abbreviate <hg>hg commit</hg> to <hg>hg ci</hg>. 151 <p>Note: Instead of <hg>hg update</hg> you can also use the shorthand <hg>hg up</hg>. Similarly you can abbreviate <hg>hg commit</hg> to <hg>hg ci</hg>.</p>
152 152
153 Note: To get a revision devoid of files, just <hg>update</hg> to "null" via <hg>hg update null</hg>. That's the revision before any files were added. 153 <p>Note: To get a revision devoid of files, just <hg>update</hg> to "null" via <hg>hg update null</hg>. That's the revision before any files were added.</p>
154 154
155 <h5>Fixing errors in earlier revisions</h5> 155 <h5>Fixing errors in earlier revisions</h5>
156 156
157 When you find a bug in some earlier revision you have two options: either you can fix it in the current code, or you can go back in history and fix the code exactly where you did it, which creates a cleaner history. 157 <p>When you find a bug in some earlier revision you have two options: either you can fix it in the current code, or you can go back in history and fix the code exactly where you did it, which creates a cleaner history.</p>
158 158
159 To do it the cleaner way, 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. 159 <p>To do it the cleaner way, 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.</p>
160 160
161 Let's assume the bug was introduced in revision 3. 161 <p>Let's assume the bug was introduced in revision 3.</p>
162 162
163 <pre>$ hg update 3 163 <pre>$ hg update 3
164 $ (fix the bug) 164 $ (fix the bug)
165 $ hg commit</pre> 165 $ hg commit</pre>
166 166
167 Now the fix is already stored in history. We just need to merge it with the current version of your code. 167 <p>Now the fix is already stored in history. We just need to merge it with the current version of your code.</p>
168 168
169 <pre>$ hg merge</pre> 169 <pre>$ hg merge</pre>
170 170
171 If there are conflicts use <hg>hg resolve</hg> - that's also what merge tells you to do in case of conflicts. 171 <p>If there are conflicts use <hg>hg resolve</hg> - that's also what merge tells you to do in case of conflicts.</p>
172 172
173 First list the files with conflicts: 173 <p>First list the files with conflicts</p>
174 174
175 <pre>$ hg resolve --list</pre> 175 <pre>$ hg resolve --list</pre>
176 176
177 Then resolve them one by one. <hg>resolve</hg> attempts the merge again: 177 <p>Then resolve them one by one. <hg>resolve</hg> attempts the merge again</p>
178 178
179 <pre>$ hg resolve conflicting_file 179 <pre>$ hg resolve conflicting_file
180 (fix it by hand, if necessary)</pre> 180 (fix it by hand, if necessary)</pre>
181 181
182 Mark the fixed file as resolved: 182 <p>Mark the fixed file as resolved</p>
183 183
184 <pre>$ hg resolve --mark conflicting_file</pre> 184 <pre>$ hg resolve --mark conflicting_file</pre>
185 185
186 Commit the merge, as soon as you resolved all conflicts. This step is also necessary if there were no conflicts! 186 <p>Commit the merge, as soon as you resolved all conflicts. This step is also necessary when there were no conflicts!</p>
187 187
188 <pre>$ hg commit</pre> 188 <pre>$ hg commit</pre>
189 189
190 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. 190 <p>At this point, your fix is merged with all your other work, and you can just go on coding. Additionally the history shows clearly where you fixed the bug, so you'll always be able to check where the bug was.</p>
191 191
192 Note: Most merges will just work. You only need <hg>resolve</hg>, when <hg>merge</hg> complains. 192 <p>Note: Most merges will just work. You only need <hg>resolve</hg>, when <hg>merge</hg> complains.</p>
193 193
194 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. 194 <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>
195 195
196 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>. 196 <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>
197 197
198 <h3>Seperate features</h3> 198 <h3>Seperate features</h3>
199 199
200 <h4>Use Case</h4> 200 <h4>Use Case</h4>
201 201
202 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. 202 <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>
203 203
204 After finishing your feature you then <hg>pull</hg> it back into your main directory and <hg>merge</hg> the changes. 204 <p>After finishing your feature you then <hg>pull</hg> it back into your main directory and <hg>merge</hg> the changes.</p>
205 205
206 <h4>Workflow</h4> 206 <h4>Workflow</h4>
207 207
208 First create the feature clone and do some changes 208 <p>First create the feature clone and do some changes</p>
209 209
210 <pre>$ hg clone project feature1 210 <pre>$ hg clone project feature1
211 $ cd feature1 211 $ cd feature1
212 $ (do some changes and commits)</pre> 212 $ (do some changes and commits)</pre>
213 213
214 Now check what will come in when you <hg>pull</hg> from feature1, just like you can use <hg>diff</hg> before committing. The respective command for pulling is <hg>incoming</hg> 214 <p>Now check what will come in when you <hg>pull</hg> from feature1, just like you can use <hg>diff</hg> before committing. The respective command for pulling is <hg>incoming</hg></p>
215 215
216 <pre>$ cd ../project 216 <pre>$ cd ../project
217 $ hg incoming ../feature1</pre> 217 $ hg incoming ../feature1</pre>
218 218
219 Note: If you want to see the diffs, you can use <hg>hg incoming --patch</hg> just as you can do with <hg>hg log --patch</hg> for the changes in the repository. 219 <p>Note: If you want to see the diffs, you can use <hg>hg incoming --patch</hg> just as you can do with <hg>hg log --patch</hg> for the changes in the repository.</p>
220 220
221 If you like the changes, you pull them into the project 221 <p>If you like the changes, you pull them into the project</p>
222 222
223 <pre>$ hg pull ../feature1</pre> 223 <pre>$ hg pull ../feature1</pre>
224 224
225 Now you have the history of feature1 inside your project, but the changes aren't yet visible. Instead they are only stored inside a ".hg" directory of the project (<a title="Behind the Scenes" href="http://hgbook.red-bean.com/read/behind-the-scenes.html">more information on the store</a>). 225 <p>Now you have the history of feature1 inside your project, but the changes aren't yet visible. Instead they are only stored inside a ".hg" directory of the project (<a title="Behind the Scenes" href="http://hgbook.red-bean.com/read/behind-the-scenes.html">more information on the store</a>).</p>
226 226
227 Note: From now on we'll use the name "repository" for a directory which has a .hg directory with Mercurial history. 227 <p>Note: From now on we'll use the name "repository" for a directory which has a .hg directory with Mercurial history.</p>
228 228
229 If you didn't do any changes in the project, while you were working on feature1, you can just update to tip (<hg>hg update tip</hg>), but it is more likely that you'll have done some other changes in between changes. In that case, it's time for merging. 229 <p>If you didn't do any changes in the project, while you were working on feature1, you can just update to tip (<hg>hg update tip</hg>), but it is more likely that you'll have done some other changes in between changes. In that case, it's time for merging.</p>
230 230
231 Merge feature1 into the project code: 231 <p>Merge feature1 into the project code</p>
232 232
233 <pre>$ hg merge</pre> 233 <pre>$ hg merge</pre>
234 234
235 If there are conflicts use <hg>hg resolve</hg> - that's also what merge tells you to do in case of conflicts. After you <hg>merge</hg>, you have to <hg>commit</hg> explicitely to make your <hg>merge</hg> final 235 <p>If there are conflicts use <hg>hg resolve</hg> - that's also what merge tells you to do in case of conflicts. After you <hg>merge</hg>, you have to <hg>commit</hg> explicitely to make your <hg>merge</hg> final</p>
236 236
237 <pre>$ hg commit 237 <pre>$ hg commit
238 (enter commit message, for example "merged feature1")</pre> 238 (enter commit message, for example "merged feature1")</pre>
239 239
240 You can create an arbitrary number of clones and also carry them around on USB sticks. Also you can use them to synchronize your files at home and at work, or between your desktop and your laptop. 240 <p>You can create an arbitrary number of clones and also carry them around on USB sticks. Also you can use them to synchronize your files at home and at work, or between your desktop and your laptop.</p>
241 241
242 Note: You also have to commit after a merge when there are no conflicts, because merging creates new history and you might want to attach a specific message to the merge (like "merge feature1"). 242 <p>Note: You also have to commit after a merge when there are no conflicts, because merging creates new history and you might want to attach a specific message to the merge (like "merge feature1").</p>
243 243
244 <h3>Sharing changes</h3> 244 <h3>Sharing changes</h3>
245 245
246 <h4>Use Case</h4> 246 <h4>Use Case</h4>
247 247
248 Now we go one step further: You are no longer alone, and you want to share your changes with others and include their changes. 248 <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>
249 249
250 The basic requirement for that is that you have to be able to see the changes of others. 250 <p>The basic requirement for that is that you have to be able to see the changes of others.</p>
251 251
252 Mercurial allows you to do that very easily by including a simple webserver from which you can <hg>pull</hg> changes just as you can pull changes from local clones. 252 <p>Mercurial allows you to do that very easily by including a simple webserver from which you can <hg>pull</hg> changes just as you can pull changes from local clones.</p>
253 253
254 Note: There are a few other ways to share changes, though. Instead of using the builtin webserver, you can also send the changes by email or setup a shared repository, to where you <hg>push</hg> changes instead of pulling them. We'll cover one of those later. 254 <p>Note: There are a few other ways to share changes, though. Instead of using the builtin webserver, you can also send the changes by email or setup a shared repository, to where you <hg>push</hg> changes instead of pulling them. We'll cover one of those later.</p>
255 255
256 <h4>Workflow</h4> 256 <h4>Workflow</h4>
257 257
258 <h5>Using the builtin webserver</h5> 258 <h5>Using the builtin webserver</h5>
259 259
260 This is the easiest way to quickly share changes. 260 <p>This is the easiest way to quickly share changes.</p>
261 261
262 First the one who wants to share his changes creates the webserver 262 <p>First the one who wants to share his changes creates the webserver</p>
263 263
264 <pre>$ hg serve</pre> 264 <pre>$ hg serve</pre>
265 265
266 Now all others can point their browsers to his IP address (for example 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. 266 <p>Now all others can point their browsers to his IP address (for example 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.</p>
267 267
268 <pre>$ firefox http://192.168.178.100:8000</pre> 268 <pre>$ firefox http://192.168.178.100:8000</pre>
269 269
270 If they decide to include the changes, they just pull from the same URL 270 <p>If they decide to include the changes, they just pull from the same URL</p>
271 271
272 <pre>$ hg pull http://192.168.178.100:8000</pre> 272 <pre>$ hg pull http://192.168.178.100:8000</pre>
273 273
274 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. 274 <p>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.</p>
275 275
276 <h5>Sending changes by email</h5> 276 <h5>Sending changes by email</h5>
277 277
278 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 (if you want additional protection, you can also encrypt the emails, for example with <a href="http://gnupg.org" title="GnuPG">GnuPG</a>). 278 <p>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 (if you want additional protection, you can also encrypt the emails, for example with <a href="http://gnupg.org" title="GnuPG">GnuPG</a>).</p>
279 279
280 In that case, you can easily export your changes as patches and send them by email. 280 <p>In that case, you can easily export your changes as patches and send them by email.</p>
281 281
282 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. 282 <p>Another reason to send them by email can be that your policy requires manual review of the changes when the other developers are used to reading diffs in emails. I'm sure you can think of more reasons.</p>
283 283
284 Sending the changes via email is pretty straightforward with Mercurial. You just <hg>export</hg> your changes and attach (or copy paste) it in your email. Your collegues can then just <hg>import</hg> them. 284 <p>Sending the changes via email is pretty straightforward with Mercurial. You just <hg>export</hg> your changes and attach (or copy paste) it in your email. Your collegues can then just <hg>import</hg> them.</p>
285 285
286 First check which changes you want to export 286 <p>First check which changes you want to export</p>
287 287
288 <pre>$ cd project 288 <pre>$ cd project
289 $ hg log</pre> 289 $ hg log</pre>
290 290
291 We assume that you want to export changeset 3 and 4: 291 <p>We assume that you want to export changeset 3 and 4</p>
292 292
293 <pre>$ hg export 3 > change3.diff 293 <pre>$ hg export 3 > change3.diff
294 $ hg export 4 > change4.diff</pre> 294 $ hg export 4 > change4.diff</pre>
295 295
296 Now attach them to an email and your collegues can just run <hg>import</hg> on both diffs to get your full changes, including your user information. 296 <p>Now attach them to an email and your collegues can just run <hg>import</hg> on both diffs to get your full changes, including your user information.</p>
297 297
298 To be careful, they first <hg>clone</hg> their repository to have an integration directory as sandbox 298 <p>To be careful, they first <hg>clone</hg> their repository to have an integration directory as sandbox</p>
299 299
300 <pre>$ hg clone project integration 300 <pre>$ hg clone project integration
301 $ cd integration 301 $ cd integration
302 $ hg import change3.diff 302 $ hg import change3.diff
303 $ hg import change4.diff</pre> 303 $ hg import change4.diff</pre>
304 304
305 That's it. They can now test your changes in feature clones. If they accept them, they <hg>pull</hg> the changes into the main repository 305 <p>That's it. They can now test your changes in feature clones. If they accept them, they <hg>pull</hg> the changes into the main repository</p>
306 306
307 <pre>$ cd ../project 307 <pre>$ cd ../project
308 $ hg pull ../integration</pre> 308 $ hg pull ../integration</pre>
309 309
310 Note: The <em>patchbomb</em> extension automates the email-sending, but you don't need it for this workflow. 310 <p>Note: The <em>patchbomb</em> extension automates the email-sending, but you don't need it for this workflow.</p>
311 311
312 Note 2: You can also send around bundles, which are snippets of your actual history. Just create them via 312 <p>Note 2: You can also send around bundles, which are snippets of your actual history. Just create them via </p>
313 <pre>$ hg bundle --base FIRST_REVISION_TO_BUNDLE changes.bundle</pre> 313 <pre>$ hg bundle --base FIRST_REVISION_TO_BUNDLE changes.bundle</pre>
314 Others can then get your changes by simply pulling them, as if your bundle were an actual repository 314 <p>Others can then get your changes by simply pulling them, as if your bundle were an actual repository</p>
315 <pre>$ hg pull path/to/changes.bundle</pre> 315 <pre>$ hg pull path/to/changes.bundle</pre>
316 316
317 <h5>Using a shared repository</h5> 317 <h5>Using a shared repository</h5>
318 318
319 Sending changes by email might be the easiest way to reach people when you aren't yet part of the regular development team, but it creates additional workload: You have to <hg>bundle</hg> the changes, send mails and then <hg>import</hg> the bundles manually. Luckily there's an easier way which works quite well: The shared push repository. 319 <p>Sending changes by email might be the easiest way to reach people when you aren't yet part of the regular development team, but it creates additional workload: You have to <hg>bundle</hg> the changes, send mails and then <hg>import</hg> the bundles manually. Luckily there's an easier way which works quite well: The shared push repository.</p>
320 320
321 Till now we transferred all changes either via email or via <hg>pull</hg>. Now we use another otion: pushing. As the name suggests it's just the opposite of pulling: You <hg>push</hg> your changes into another repository. 321 <p>Till now we transferred all changes either via email or via <hg>pull</hg>. Now we use another otion: pushing. As the name suggests it's just the opposite of pulling: You <hg>push</hg> your changes into another repository.</p>
322 322
323 But to make use of it, we first need something we can push to. 323 <p>But to make use of it, we first need something we can push to.</p>
324 324
325 By default <hg>hg serve</hg> doesn't allow pushing, since that would be a major security hole. You can allow pushing in the server, but that's no solution when you live in different timezones, so we'll go with another approach here: Using a shared repository, either on an existing shared server or on a service like <a title="BitBucket" href="http://bitbucket.org">BitBucket</a>. Doing so has a bit higher starting cost and takes a bit longer to explain, but it's well worth the effort spent. 325 <p>By default <hg>hg serve</hg> doesn't allow pushing, since that would be a major security hole. You can allow pushing in the server, but that's no solution when you live in different timezones, so we'll go with another approach here: Using a shared repository, either on an existing shared server or on a service like <a title="BitBucket" href="http://bitbucket.org">BitBucket</a>. Doing so has a bit higher starting cost and takes a bit longer to explain, but it's well worth the effort spent.</p>
326 326
327 If you want to use an existing shared server, you can use <hg>serve</hg> there and <a title="How to allow pushing for hg serve" href="http://www.selenic.com/mercurial/wiki/HgWebDirStepByStep#head-746ca383e3a62df34279ec2fca888113497da022">allow pushing</a>. Also there are some other nice ways to <a title="Multiple Committers" href="http://www.selenic.com/mercurial/wiki/MultipleCommitters">allow pushing to a Mercurial repository</a>, including simple <a title="Setting up a shared Mercurial repository using SSH" href="http://www.selenic.com/mercurial/wiki/SharedSSH">access via SSH</a>. 327 <p>If you want to use an existing shared server, you can use <hg>serve</hg> there and <a title="How to allow pushing for hg serve" href="http://www.selenic.com/mercurial/wiki/HgWebDirStepByStep#head-746ca383e3a62df34279ec2fca888113497da022">allow pushing</a>. Also there are some other nice ways to <a title="Multiple Committers" href="http://www.selenic.com/mercurial/wiki/MultipleCommitters">allow pushing to a Mercurial repository</a>, including simple <a title="Setting up a shared Mercurial repository using SSH" href="http://www.selenic.com/mercurial/wiki/SharedSSH">access via SSH</a>.</p>
328 328
329 Otherwise you first need to setup a BitBucket Account. Just signup at <a title="BitBucket" href="http://bitbucket.org">BitBucket</a>. After signing up (and login) hover your mouse over "Repositories". There click the item at the bottom of the opening dialog which say "Create new". 329 <p>Otherwise you first need to setup a BitBucket Account. Just signup at <a title="BitBucket" href="http://bitbucket.org">BitBucket</a>. After signing up (and login) hover your mouse over "Repositories". There click the item at the bottom of the opening dialog which say "Create new".</p>
330 330
331 Give it a name and a description. If you want to keep it hidden from the public, select "private". 331 <p>Give it a name and a description. If you want to keep it hidden from the public, select "private"</p>
332 332
333 <pre>$ firefox http://bitbucket.org</pre> 333 <pre>$ firefox http://bitbucket.org</pre>
334 334
335 Now your repository is created and you see instructions for <hg>push</hg>ing to it. for that you'll use a command similar to the following (just with a different URL): 335 <p>Now your repository is created and you see instructions for <hg>push</hg>ing to it. for that you'll use a command similar to the following (just with a different URL)</p>
336 336
337 <pre>$ hg push https://bitbucket.org/ArneBab/hello/</pre> 337 <pre>$ hg push https://bitbucket.org/ArneBab/hello/</pre>
338 338
339 (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/) 339 <p>(Replace the URL with the URL of your created repository. If your username is "Foo" and your repository is named "bar", the URL will be https://bitbucket.org/Foo/bar/)</p>
340 340
341 Mercurial will ask for your BitBucket password, then <hg>push</hg> your code. 341 <p>Mercurial will ask for your BitBucket password, then <hg>push</hg> your code.</p>
342 342
343 VoilĂ , your code is online. 343 <p>VoilĂ , your code is online.</p>
344 344
345 Note: You can also <a title="use SSH for pushing to BitBucket" href="http://bitbucket.org/help/UsingSSH">use SSH for pushing to BitBucket</a>. 345 <p>Note: You can also <a title="use SSH for pushing to BitBucket" href="http://bitbucket.org/help/UsingSSH">use SSH for pushing to BitBucket</a>.</p>
346 346
347 Now it's time to tell all your collegues to sign up at BitBucket, too. 347 <p>Now it's time to tell all your collegues to sign up at BitBucket, too.</p>
348 348
349 After that you can click the "Admin" tab of your created repository and add the usernames of your collegues on the right side under "Permission: Writers". Now they are allowed to <hg>push</hg> code to the repository. 349 <p>After that you can click the "Admin" tab of your created repository and add the usernames of your collegues on the right side under "Permission: Writers". Now they are allowed to <hg>push</hg> code to the repository.</p>
350 350
351 (If you chose to make the repository private, you'll need to add them to "Permission: Readers", too) 351 <p>(If you chose to make the repository private, you'll need to add them to "Permission: Readers", too)</p>
352 352
353 If one of you now wants to publish changes, he'll simply <hg>push</hg> them to the repository, and all others get them by <hg>pull</hg>ing. 353 <p>If one of you now wants to publish changes, he'll simply <hg>push</hg> them to the repository, and all others get them by <hg>pull</hg>ing.</p>
354 354
355 Publish your changes: 355 <p>Publish your changes</p>
356 356
357 <pre>$ hg push https://bitbucket.org/ArneBab/hello/</pre> 357 <pre>$ hg push https://bitbucket.org/ArneBab/hello/</pre>
358 358
359 Pull others changes into your local repository: 359 <p>Pull others changes into your local repository</p>
360 360
361 <pre>$ hg pull https://bitbucket.org/ArneBab/hello/</pre> 361 <pre>$ hg pull https://bitbucket.org/ArneBab/hello/</pre>
362 362
363 People who join you in development can also just <hg>clone</hg> this repository, as if one of you were using <hg>hg serve</hg>: 363 <p>People who join you in development can also just <hg>clone</hg> this repository, as if one of you were using <hg>hg serve</hg></p>
364 364
365 <pre>$ hg clone https://bitbucket.org/ArneBab/hello/ hello</pre> 365 <pre>$ hg clone https://bitbucket.org/ArneBab/hello/ hello</pre>
366 366
367 That local repository will automatically be configured to pull/push from/to the online repository, so new contributors can just use <hg>hg push</hg> and <hg>hg pull</hg> without an URL. 367 <p>That local repository will automatically be configured to pull/push from/to the online repository, so new contributors can just use <hg>hg push</hg> and <hg>hg pull</hg> without an URL.</p>
368 368
369 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. 369 <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>
370 370
371 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://hg@bitbucket.org/ArneBab/hello (for a shared server you'd replace the "hg" in the given URL with your username). When using a shared directory you just push as if the repository in the shared directory were on your local drive. 371 <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://hg@bitbucket.org/ArneBab/hello (for a shared server you'd replace the "hg" in the given URL with your username). When using a shared directory you just push as if the repository in the shared directory were on your local drive.</p>
372 372
373 <h3>Summary</h3> 373 <h3>Summary</h3>
374 374
375 Now let's take a step back and look where we are. 375 <p>Now let's take a step back and look where we are.</p>
376 376
377 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. 377 <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>
378 378
379 First this is good, because it means, that you can now use most of the concepts which are utilized in more complex workflows. 379 <p>First this is good, because it means, that you can now use most of the concepts which are utilized in more complex workflows.</p>
380 380
381 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. 381 <p>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.</p>
382 382
383 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: 383 <p>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.</p>
384 384
385 <h4>create a project</h4> 385 <h4>create a project</h4>
386 386
387 <pre>$ hg init project 387 <pre>$ hg init project
388 $ cd project 388 $ cd project
446 $ hg push https://bitbucket.org/USER/REPO 446 $ hg push https://bitbucket.org/USER/REPO
447 (enter name and password in the prompt) 447 (enter name and password in the prompt)
448 $ hg pull https://bitbucket.org/USER/REPO</pre> 448 $ hg pull https://bitbucket.org/USER/REPO</pre>
449 449
450 450
451 Let's move on towards useful features and a bit more advanced workflows. 451 <p>Let's move on towards useful features and a bit more advanced workflows.</p>
452 452
453 <h3>Backing out bad revisions</h3> 453 <h3>Backing out bad revisions</h3>
454 454
455 <h4>Use Case</h4> 455 <h4>Use Case</h4>
456 456
457 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. 457 <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>
458 458
459 To resolve that problem, Mercurial offers you the <hg>backout</hg> command. Backing out a change means, that you tell Mercurial to create a commit which reverses the bad change. That way you don't get rid of the bad code in history, but you can remove it from new revisions. 459 <p>To resolve that problem, Mercurial offers you the <hg>backout</hg> command. Backing out a change means, that you tell Mercurial to create a commit which reverses the bad change. That way you don't get rid of the bad code in history, but you can remove it from new revisions.</p>
460 460
461 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. 461 <p>Note: The basic commands don't directly rewrite history. If you want to do that, you need to activate some of the extensions which are shipped with mercurial. We'll come to that later on.</p>
462 462
463 <h4>Workflow</h4> 463 <h4>Workflow</h4>
464 464
465 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 <hg>backout</hg> of it. This creates a new change which reverses the bad change. After backing out, we merge that new change into the current code. 465 <p>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 <hg>backout</hg> of it. This creates a new change which reverses the bad change. After backing out, we merge that new change into the current code.</p>
466 466
467 <pre>$ hg backout 3 467 <pre>$ hg backout 3
468 $ hg merge 468 $ hg merge
469 (potentially resolve conflicts) 469 (potentially resolve conflicts)
470 $ hg commit 470 $ hg commit
471 (enter commit message. For example: "merged backout")</pre> 471 (enter commit message. For example: "merged backout")</pre>
472 472
473 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. 473 <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>
474 474
475 <h3>Collaborative feature development</h3> 475 <h3>Collaborative feature development</h3>
476 476
477 Now that we can share changes and reverse them if necessary, we go one step further: Using Mercurial to help in coordinating the coding. 477 <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>
478 478
479 The first part is an easy way to develop features together, without requiring every developer to keep track of several feature clones. 479 <p>The first part is an easy way to develop features together, without requiring every developer to keep track of several feature clones.</p>
480 480
481 <h4>Use Case</h4> 481 <h4>Use Case</h4>
482 482
483 When you want to split your development into several features, you need to keep track of who works on which feature and where to get which changes. 483 <p>When you want to split your development into several features, you need to keep track of who works on which feature and where to get which changes.</p>
484 484
485 Mercurial makes this easy for you by providing named branches. They are a part of the main repository, so they are available to everyone involved. At the same time, changes committed on a certain branch don't get mixed with the changes in the default branch, so features are kept separate, until they get merged into the default branch. 485 <p>Mercurial makes this easy for you by providing named branches. They are a part of the main repository, so they are available to everyone involved. At the same time, changes committed on a certain branch don't get mixed with the changes in the default branch, so features are kept separate, until they get merged into the default branch.</p>
486 486
487 Note: Cloning a repository always puts you onto the default branch at first. 487 <p>Note: Cloning a repository always puts you onto the default branch at first.</p>
488 488
489 <h4>Workflow</h4> 489 <h4>Workflow</h4>
490 490
491 When someone in your group wants to start coding on a feature without disturbing the others, he can create a named branch and commit there. When someone else wants to join in, he just updates to the branch and commits away. As soon as the feature is finished, someone merges the named branch into the default branch. 491 <p>When someone in your group wants to start coding on a feature without disturbing the others, he can create a named branch and commit there. When someone else wants to join in, he just updates to the branch and commits away. As soon as the feature is finished, someone merges the named branch into the default branch.</p>
492 492
493 <h5>Working in a named branch</h5> 493 <h5>Working in a named branch</h5>
494 494
495 Create the branch: 495 <p>Create the branch</p>
496 496
497 <pre>$ hg branch feature1 497 <pre>$ hg branch feature1
498 (do some changes) 498 (do some changes)
499 $ hg commit 499 $ hg commit
500 (write commit message)</pre> 500 (write commit message)</pre>
501 501
502 Update into the branch and work in it: 502 <p>Update into the branch and work in it</p>
503 503
504 <pre>$ hg update feature1 504 <pre>$ hg update feature1
505 (do some changes) 505 (do some changes)
506 $ hg commit 506 $ hg commit
507 (write commit message)</pre> 507 (write commit message)</pre>
508 508
509 Now you can <hg>commit</hg>, <hg>pull</hg>, <hg>push</hg> and <hg>merge</hg> (and anything else) as if you were working in a separate repository. If the history of the named branch is linear and you call "hg merge", Mercurial asks you to specify an explicit revision, since the branch in which you work doesn't have anything to merge. 509 <p>Now you can <hg>commit</hg>, <hg>pull</hg>, <hg>push</hg> and <hg>merge</hg> (and anything else) as if you were working in a separate repository. If the history of the named branch is linear and you call "hg merge", Mercurial asks you to specify an explicit revision, since the branch in which you work doesn't have anything to merge.</p>
510 510
511 <h5>Merge the named branch</h5> 511 <h5>Merge the named branch</h5>
512 512
513 When you finished the feature, you <hg>merge</hg> the branch back into the default branch. 513 <p>When you finished the feature, you <hg>merge</hg> the branch back into the default branch.</p>
514 514
515 <pre>$ hg update default 515 <pre>$ hg update default
516 $ hg merge feature1 516 $ hg merge feature1
517 $ hg commit 517 $ hg commit
518 (write commit message)</pre> 518 (write commit message)</pre>
519 519
520 And that's it. Now you can easily keep features separate without unnecessary bookkeeping. 520 <p>And that's it. Now you can easily keep features separate without unnecessary bookkeeping.</p>
521 521
522 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>. 522 <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>
523 523
524 <h3>Marking revisions: tag and sign</h3> 524 <h3>Tagging revisions</h3>
525 525
526 <h4>Use Case</h4> 526 <h4>Use Case</h4>
527 527
528 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. 528 <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>
529 529
530 For this Mercurial offers tags. Tags add a name to a revision and are part of the history. You can tag a change years after it was committed. The tag includes the information when it was added, and tags can be pulled, pushed and merged just like any other committed change. 530 <p>For this Mercurial offers tags. Tags add a name to a revision and are part of the history. You can tag a change years after it was committed. The tag includes the information when it was added, and tags can be pulled, pushed and merged just like any other committed change.</p>
531 531
532 Note: A tag must not contain the char ":", since that char is used for specifying multiple reivions - see "hg help revisions". 532 <p>Note: A tag must not contain the char ":", since that char is used for specifying multiple reivions - see "hg help revisions".</p>
533 533
534 Note: To securely mark a revision, you can use the <a title="Using GnuPG to securely sign revisions in Mercurial" href="http://www.selenic.com/mercurial/wiki/GpgExtension">gpg extension</a> to sign the tag. 534 <p>Note: To securely mark a revision, you can use the <a title="Using GnuPG to securely sign revisions in Mercurial" href="http://www.selenic.com/mercurial/wiki/GpgExtension">gpg extension</a> to sign the tag.</p>
535 535
536 <h4>Workflow</h4> 536 <h4>Workflow</h4>
537 537
538 Let's assume you want to give revision 3 the name "v0.1". 538 <p>Let's assume you want to give revision 3 the name "v0.1".</p>
539 539
540 Add the tag: 540 <p>Add the tag</p>
541 541
542 <pre>$ hg tag -r 3 v0.1</pre> 542 <pre>$ hg tag -r 3 v0.1</pre>
543 543
544 See all tags: 544 <p>See all tags</p>
545 545
546 <pre>$ hg tags</pre> 546 <pre>$ hg tags</pre>
547 547
548 When you look at the log you'll now see a line in changeset 3 which marks the Tag. If someone wants to <hg>update</hg> to the tagged revision, he can just use the name of your tag: 548 <p>When you look at the log you'll now see a line in changeset 3 which marks the Tag. If someone wants to <hg>update</hg> to the tagged revision, he can just use the name of your tag</p>
549 549
550 <pre>$ hg update v0.1</pre> 550 <pre>$ hg update v0.1</pre>
551 551
552 Now he'll be at the tagged revision and can work from there. 552 <p>Now he'll be at the tagged revision and can work from there.</p>
553 553
554 554
555 <h3>Removing history</h3> 555 <h3>Removing history</h3>
556 556
557 <h4>Use Case</h4> 557 <h4>Use Case</h4>
558 558
559 At times you will have changes in your repository, which you really don't want in it. 559 <p>At times you will have changes in your repository, which you really don't want in it.</p>
560 560
561 There are many advanced options for removing these, and most of them use great extensions (<a title="Mercurial Queues Extension" href="http://www.selenic.com/mercurial/wiki/MqExtension">Mercurial Queues</a> is the most often used one), but in this basic guide, we'll solve the problem with just the commands we already learned. But we'll use an option to clone which we didn't yet use. 561 <p>There are many advanced options for removing these, and most of them use great extensions (<a title="Mercurial Queues Extension" href="http://www.selenic.com/mercurial/wiki/MqExtension">Mercurial Queues</a> is the most often used one), but in this basic guide, we'll solve the problem with just the commands we already learned. But we'll use an option to clone which we didn't yet use.</p>
562 562
563 This workflow becomes inconvenient when you need to remove changes, which are buried below many new changes. If you spot the bad changes early enough, you can get rid of them without too much effort, though. 563 <p>This workflow becomes inconvenient when you need to remove changes, which are buried below many new changes. If you spot the bad changes early enough, you can get rid of them without too much effort, though.</p>
564 564
565 <h4>Workflow</h4> 565 <h4>Workflow</h4>
566 566
567 Let's assume you want to get rid of revision 2 and the highest revision is 3. 567 <p>Let's assume you want to get rid of revision 2 and the highest revision is 3.</p>
568 568
569 The first step is to use the "--rev" option to <hg>clone</hg>: Create a clone which only contains the changes up to the specified revision. Since you want to keep revision 1, you only clone up to that. 569 <p>The first step is to use the "--rev" option to <hg>clone</hg>: Create a clone which only contains the changes up to the specified revision. Since you want to keep revision 1, you only clone up to that</p>
570 570
571 $ hg clone -r 1 project stripped 571 <pre>$ hg clone -r 1 project stripped</pre>
572 572
573 Now you can <hg>export</hg> the change 3 from the original repository (project) and <hg>import</hg> it into the stripped one. 573 <p>Now you can <hg>export</hg> the change 3 from the original repository (project) and <hg>import</hg> it into the stripped one</p>
574 574
575 <pre>$ cd project 575 <pre>$ cd project
576 $ hg export 3 > ../changes.diff 576 $ hg export 3 > ../changes.diff
577 $ cd ../stripped 577 $ cd ../stripped
578 $ hg import ../changes.diff</pre> 578 $ hg import ../changes.diff</pre>
579 579
580 If a part of the changes couldn't be applied, you'll see that part in *.rej files. If you have *.rej files, you'll have to include or discard changes by hand. 580 <p>If a part of the changes couldn't be applied, you'll see that part in *.rej files. If you have *.rej files, you'll have to include or discard changes by hand</p>
581 581
582 <pre>$ cat *.rej 582 <pre>$ cat *.rej
583 (apply changes by hand) 583 (apply changes by hand)
584 $ hg commit 584 $ hg commit
585 (write commit message)</pre> 585 (write commit message)</pre>
586 586
587 That's it. <hg>hg export</hg> also includes the commit message, date, committer and similar metadata, so you are already done. 587 <p>That's it. <hg>hg export</hg> also includes the commit message, date, committer and similar metadata, so you are already done.</p>
588 588
589 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. 589 <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>
590 590
591 <h3>Summary</h3> 591 <h3>Summary</h3>
592 592
593 So now you can work with Mercurial in private, and also share your changes in a multitude of ways. 593 <p>So now you can work with Mercurial in private, and also share your changes in a multitude of ways.</p>
594 594
595 Additionally you can also 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. 595 <p>Additionally you can also 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>
596 596
597 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. 597 <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>
598 598
599 With this we can conclude our practical guide. 599 <p>With this we can conclude our practical guide.</p>
600 600
601 <h2>More Complex Workflows</h2> 601 <h2>More Complex Workflows</h2>
602 602
603 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>. 603 <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>
604 604
605 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>. 605 <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>
606 606
607 Have fun with Mercurial! 607 <p><em>Have fun with Mercurial!</em></p>
608 608
609 609
610 610
611 <div class="col"> 611 <div class="col">
612 {% download_button %} 612 {% download_button %}