Mercurial > hg-website
annotate text/workflows.txt @ 100:6e29cdea7b3a
Workflows: Added basic sharing of changes.
author | Arne Babenhauserheide <bab@draketo.de> |
---|---|
date | Wed, 22 Apr 2009 12:52:44 +0200 |
parents | 71ff3b94b20d |
children | 7bcdd8b947fe |
rev | line source |
---|---|
97 | 1 = (Some) Mercurial Workflows = |
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 | |
99
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
7 To write this page we gathered [real life workflows](wiki - workflows), so every workflow in here has proven itself in real life usage. We begin with basic workflows and then go on to more complex examples. |
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 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
25 == Sysadmin workflow == |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
26 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
27 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
|
28 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
29 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
|
30 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
31 === Workflow === |
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 ==== Initialize the project ==== |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
34 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
35 <code>$ hg init project</code> |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
36 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
37 ==== Add files and track them ==== |
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 <code>$ cd project |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
40 $ (add files) |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
41 $ hg add </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 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
|
44 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
45 $ cd project |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
46 $ hg init |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
47 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
48 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
|
49 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
50 $ hg add file0* file10 file11 file12 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
51 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
52 ==== Save changes ==== |
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 $ (do some changes) |
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 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
|
57 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
58 $ hg status |
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 see the exact 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 $ hg diff |
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 commit the changes. |
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 $ hg commit |
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 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
|
69 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
70 ==== Check your history ==== |
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 log |
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 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
|
75 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
76 == Lone developer with linear history == |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
77 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
78 === Use case === |
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 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
|
81 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
82 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
|
83 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
84 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
|
85 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
86 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
|
87 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
88 === Workflow === |
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 ==== Basics from sysadmin ==== |
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 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
|
93 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
94 <code>$ hg init project |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
95 $ cd project |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
96 $ (add files) |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
97 $ 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
|
98 $ (do some changes) |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
99 $ hg diff # see changes |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
100 $ hg commit # save changes |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
101 $ hg log # see history |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
102 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
103 ==== Seeing an earlier revision ==== |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
104 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
105 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
|
106 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
107 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
|
108 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
109 $ hg update 3 |
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 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
|
112 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
113 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
|
114 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
115 $ hg update tip |
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 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
|
118 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
119 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
|
120 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
121 ==== Fixing errors in earlier revisions ==== |
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 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
|
124 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
125 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
|
126 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
127 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
|
128 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
129 $ hg update 3 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
130 $ (fix the bug) |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
131 $ hg commit |
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 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
|
134 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
135 $ hg merge |
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 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
|
138 |
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 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
|
142 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
143 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
144 So now you can initialize repositories, save changes, |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
145 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
146 == Seperate features == |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
147 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
148 === Use Case === |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
149 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
150 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
|
151 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
152 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
|
153 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
154 === Workflow === |
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 $ hg clone project feature1 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
157 $ cd feature1 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
158 $ (do some changes and commits) |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
159 $ cd ../project |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
160 $ hg pull ../feature1 |
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 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
|
163 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
164 If you didn't do any changes in the project, while you were working on feature1, you can just update, but it is more likely that you'll have done some changes. In that case, it's time for merging. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
165 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
166 Merge feature1 into the project code: |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
167 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
168 $ hg merge |
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 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
|
171 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
172 $ hg commit -m "merged feature1" |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
173 |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
174 You can create an arbitrary number of clones and also carry them around on USB sticks, so you an also synchronize your work at home and at work. |
71ff3b94b20d
Added workflows sysadmin, lone developer and seperate features.
Arne Babenhauserheide <bab@draketo.de>
parents:
97
diff
changeset
|
175 |
100
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
176 == Sharing changes really easily == |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
177 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
178 === Use Case === |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
179 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
180 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
|
181 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
182 The basic requirement for that is that you have to be able to see the changes of others. 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. |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
183 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
184 === Workflow === |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
185 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
186 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
|
187 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
188 $ hg serve |
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 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
|
191 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
192 $ firefox http://192.168.178.100:8000 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
193 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
194 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
|
195 |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
196 $ hg pull http://192.168.178.100:8000 |
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 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. You can merge the changes and work with them without needing any connection to the served repository. |
6e29cdea7b3a
Workflows: Added basic sharing of changes.
Arne Babenhauserheide <bab@draketo.de>
parents:
99
diff
changeset
|
199 |