Mercurial > evolve
comparison tests/test-topic-tutorial.t @ 2825:7608f1e04205 stable
doc: fix test2rst
Previous versions used to break on multi-lines texts and miss entirely single
lines of texts.
Use a simplest version without regex.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 27 Jul 2017 17:16:02 +0200 |
parents | 91516be7c034 |
children | 93588d219f2f |
comparison
equal
deleted
inserted
replaced
2824:d0e3a8e0b62c | 2825:7608f1e04205 |
---|---|
40 their unfinished work. | 40 their unfinished work. |
41 | 41 |
42 Topic Basics | 42 Topic Basics |
43 ============ | 43 ============ |
44 | 44 |
45 Let's say we use Mercurial to manage our shopping list:: | 45 Let's say we use Mercurial to manage our shopping list: |
46 | 46 |
47 $ hg log --graph | 47 $ hg log --graph |
48 @ changeset: 0:38da43f0a2ea | 48 @ changeset: 0:38da43f0a2ea |
49 tag: tip | 49 tag: tip |
50 user: test | 50 user: test |
51 date: Thu Jan 01 00:00:00 1970 +0000 | 51 date: Thu Jan 01 00:00:00 1970 +0000 |
52 summary: Shopping list | 52 summary: Shopping list |
53 | 53 |
54 | 54 |
55 We are about to make some additions to this list and would like to do them | 55 We are about to make some additions to this list and would like to do them |
56 within a topic. Creating a new topic is done using the ``topic`` command:: | 56 within a topic. Creating a new topic is done using the ``topic`` command: |
57 | 57 |
58 $ hg topic food | 58 $ hg topic food |
59 | 59 |
60 Much like a named branch, our topic is active but it does not contain any | 60 Much like a named branch, our topic is active but it does not contain any |
61 changesets yet:: | 61 changesets yet: |
62 | 62 |
63 $ hg topic | 63 $ hg topic |
64 * food | 64 * food |
65 $ hg summary | 65 $ hg summary |
66 parent: 0:38da43f0a2ea tip | 66 parent: 0:38da43f0a2ea tip |
75 user: test | 75 user: test |
76 date: Thu Jan 01 00:00:00 1970 +0000 | 76 date: Thu Jan 01 00:00:00 1970 +0000 |
77 summary: Shopping list | 77 summary: Shopping list |
78 | 78 |
79 | 79 |
80 Our next commit will be part of the active topic:: | 80 Our next commit will be part of the active topic: |
81 | 81 |
82 $ cat >> shopping << EOF | 82 $ cat >> shopping << EOF |
83 > Egg | 83 > Egg |
84 > Suggar | 84 > Suggar |
85 > Vinegar | 85 > Vinegar |
93 user: test | 93 user: test |
94 date: Thu Jan 01 00:00:00 1970 +0000 | 94 date: Thu Jan 01 00:00:00 1970 +0000 |
95 summary: adding condiments | 95 summary: adding condiments |
96 | 96 |
97 | 97 |
98 And future commits will be part of that topic too:: | 98 And future commits will be part of that topic too: |
99 | 99 |
100 $ cat >> shopping << EOF | 100 $ cat >> shopping << EOF |
101 > Bananas | 101 > Bananas |
102 > Pear | 102 > Pear |
103 > Apple | 103 > Apple |
117 date: Thu Jan 01 00:00:00 1970 +0000 | 117 date: Thu Jan 01 00:00:00 1970 +0000 |
118 summary: adding condiments | 118 summary: adding condiments |
119 | 119 |
120 | 120 |
121 We can get a compact view of the content of our topic using the ``stack`` | 121 We can get a compact view of the content of our topic using the ``stack`` |
122 command:: | 122 command: |
123 | 123 |
124 $ hg stack | 124 $ hg stack |
125 ### topic: food | 125 ### topic: food |
126 ### branch: default | 126 ### branch: default |
127 t2@ adding fruits (current) | 127 t2@ adding fruits (current) |
128 t1: adding condiments | 128 t1: adding condiments |
129 t0^ Shopping list (base) | 129 t0^ Shopping list (base) |
130 | 130 |
131 The topic deactivates when we update away from it:: | 131 The topic deactivates when we update away from it: |
132 | 132 |
133 $ hg up default | 133 $ hg up default |
134 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 134 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
135 $ hg topic | 135 $ hg topic |
136 food | 136 food |
137 | 137 |
138 Note that ``default`` (name of the branch) now refers to the tipmost | 138 Note that ``default`` (name of the branch) now refers to the tipmost |
139 changeset of default without a topic:: | 139 changeset of default without a topic: |
140 | 140 |
141 $ hg log --graph | 141 $ hg log --graph |
142 o changeset: 2:287de11b401f | 142 o changeset: 2:287de11b401f |
143 | tag: tip | 143 | tag: tip |
144 | topic: food | 144 | topic: food |
155 @ changeset: 0:38da43f0a2ea | 155 @ changeset: 0:38da43f0a2ea |
156 user: test | 156 user: test |
157 date: Thu Jan 01 00:00:00 1970 +0000 | 157 date: Thu Jan 01 00:00:00 1970 +0000 |
158 summary: Shopping list | 158 summary: Shopping list |
159 | 159 |
160 And updating back to the topic reactivates it:: | 160 And updating back to the topic reactivates it: |
161 | 161 |
162 $ hg up food | 162 $ hg up food |
163 switching to topic food | 163 switching to topic food |
164 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 164 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
165 $ hg topic | 165 $ hg topic |
166 * food | 166 * food |
167 | 167 |
168 Updating to any changeset that is part of a topic activates the topic | 168 Updating to any changeset that is part of a topic activates the topic |
169 regardless of how the revision was specified:: | 169 regardless of how the revision was specified: |
170 | 170 |
171 $ hg up default | 171 $ hg up default |
172 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 172 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
173 $ hg up --rev 'desc("condiments")' | 173 $ hg up --rev 'desc("condiments")' |
174 switching to topic food | 174 switching to topic food |
175 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 175 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
176 $ hg topic | 176 $ hg topic |
177 * food | 177 * food |
178 | 178 |
179 .. server side activity:: | 179 .. server side activity: |
180 | 180 |
181 $ cd ../server/ | 181 $ cd ../server/ |
182 $ cat > shopping << EOF | 182 $ cat > shopping << EOF |
183 > T-Shirt | 183 > T-Shirt |
184 > Trousers | 184 > Trousers |
192 > EOF | 192 > EOF |
193 $ hg commit -A -m "Adding clothes" | 193 $ hg commit -A -m "Adding clothes" |
194 $ cd ../client | 194 $ cd ../client |
195 | 195 |
196 The topic will also affect the rebase and the merge destinations. Let's pull | 196 The topic will also affect the rebase and the merge destinations. Let's pull |
197 the latest update from the main server:: | 197 the latest update from the main server: |
198 | 198 |
199 $ hg pull | 199 $ hg pull |
200 pulling from $TESTTMP/server (glob) | 200 pulling from $TESTTMP/server (glob) |
201 searching for changes | 201 searching for changes |
202 adding changesets | 202 adding changesets |
229 date: Thu Jan 01 00:00:00 1970 +0000 | 229 date: Thu Jan 01 00:00:00 1970 +0000 |
230 summary: Shopping list | 230 summary: Shopping list |
231 | 231 |
232 | 232 |
233 The topic head will not be considered when merging from the new head of the | 233 The topic head will not be considered when merging from the new head of the |
234 branch:: | 234 branch: |
235 | 235 |
236 $ hg up default | 236 $ hg up default |
237 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 237 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
238 $ hg merge | 238 $ hg merge |
239 abort: branch 'default' has one head - please merge with an explicit rev | 239 abort: branch 'default' has one head - please merge with an explicit rev |
240 (run 'hg heads' to see all heads) | 240 (run 'hg heads' to see all heads) |
241 [255] | 241 [255] |
242 | 242 |
243 But the topic will see that branch head as a valid destination:: | 243 But the topic will see that branch head as a valid destination: |
244 | 244 |
245 $ hg up food | 245 $ hg up food |
246 switching to topic food | 246 switching to topic food |
247 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 247 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
248 $ hg rebase | 248 $ hg rebase |
275 user: test | 275 user: test |
276 date: Thu Jan 01 00:00:00 1970 +0000 | 276 date: Thu Jan 01 00:00:00 1970 +0000 |
277 summary: Shopping list | 277 summary: Shopping list |
278 | 278 |
279 | 279 |
280 The topic information will disappear when we publish the changesets:: | 280 The topic information will disappear when we publish the changesets: |
281 | 281 |
282 $ hg topic | 282 $ hg topic |
283 * food | 283 * food |
284 $ hg push | 284 $ hg push |
285 pushing to $TESTTMP/server (glob) | 285 pushing to $TESTTMP/server (glob) |
323 In the above example, topics do not bring much benefit since you only have one | 323 In the above example, topics do not bring much benefit since you only have one |
324 line of development. Topics start to be more useful when you have to work on | 324 line of development. Topics start to be more useful when you have to work on |
325 multiple features at the same time. | 325 multiple features at the same time. |
326 | 326 |
327 We might go shopping in a hardware store in the same go, so let's add some | 327 We might go shopping in a hardware store in the same go, so let's add some |
328 tools to the shopping list within a new topic:: | 328 tools to the shopping list within a new topic: |
329 | 329 |
330 $ hg topic tools | 330 $ hg topic tools |
331 $ echo hammer >> shopping | 331 $ echo hammer >> shopping |
332 $ hg ci -m 'Adding hammer' | 332 $ hg ci -m 'Adding hammer' |
333 $ echo saw >> shopping | 333 $ echo saw >> shopping |
335 $ echo drill >> shopping | 335 $ echo drill >> shopping |
336 $ hg ci -m 'Adding drill' | 336 $ hg ci -m 'Adding drill' |
337 | 337 |
338 But we are not sure we will actually go to the hardware store, so in the | 338 But we are not sure we will actually go to the hardware store, so in the |
339 meantime, we want to extend the list with drinks. We go back to the official | 339 meantime, we want to extend the list with drinks. We go back to the official |
340 default branch and start a new topic:: | 340 default branch and start a new topic: |
341 | 341 |
342 $ hg up default | 342 $ hg up default |
343 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 343 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
344 $ hg topic drinks | 344 $ hg topic drinks |
345 $ echo 'apple juice' >> shopping | 345 $ echo 'apple juice' >> shopping |
346 $ hg ci -m 'Adding apple juice' | 346 $ hg ci -m 'Adding apple juice' |
347 $ echo 'orange juice' >> shopping | 347 $ echo 'orange juice' >> shopping |
348 $ hg ci -m 'Adding orange juice' | 348 $ hg ci -m 'Adding orange juice' |
349 | 349 |
350 We now have two topics:: | 350 We now have two topics: |
351 | 351 |
352 $ hg topic | 352 $ hg topic |
353 * drinks | 353 * drinks |
354 tools | 354 tools |
355 | 355 |
356 The information displayed by ``hg stack`` adapts to the active topic:: | 356 The information displayed by ``hg stack`` adapts to the active topic: |
357 | 357 |
358 $ hg stack | 358 $ hg stack |
359 ### topic: drinks | 359 ### topic: drinks |
360 ### branch: default | 360 ### branch: default |
361 t2@ Adding orange juice (current) | 361 t2@ Adding orange juice (current) |
371 t2: Adding saw | 371 t2: Adding saw |
372 t1: Adding hammer | 372 t1: Adding hammer |
373 t0^ adding fruits (base) | 373 t0^ adding fruits (base) |
374 | 374 |
375 They are seen as independent branches by Mercurial. No rebase or merge | 375 They are seen as independent branches by Mercurial. No rebase or merge |
376 between them will be attempted by default:: | 376 between them will be attempted by default: |
377 | 377 |
378 $ hg rebase | 378 $ hg rebase |
379 nothing to rebase | 379 nothing to rebase |
380 [1] | 380 [1] |
381 | 381 |
382 .. server activity:: | 382 .. server activity: |
383 | 383 |
384 $ cd ../server | 384 $ cd ../server |
385 $ hg up | 385 $ hg up |
386 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 386 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
387 $ mv shopping foo | 387 $ mv shopping foo |
393 $ cat foo >> shopping | 393 $ cat foo >> shopping |
394 $ rm foo | 394 $ rm foo |
395 $ hg ci -m 'add a pair of shoes' | 395 $ hg ci -m 'add a pair of shoes' |
396 $ cd ../client | 396 $ cd ../client |
397 | 397 |
398 Let's see what other people did in the meantime:: | 398 Let's see what other people did in the meantime: |
399 | 399 |
400 $ hg pull | 400 $ hg pull |
401 pulling from $TESTTMP/server (glob) | 401 pulling from $TESTTMP/server (glob) |
402 searching for changes | 402 searching for changes |
403 adding changesets | 403 adding changesets |
405 adding file changes | 405 adding file changes |
406 added 2 changesets with 2 changes to 1 files (+1 heads) | 406 added 2 changesets with 2 changes to 1 files (+1 heads) |
407 (run 'hg heads' to see heads) | 407 (run 'hg heads' to see heads) |
408 | 408 |
409 There are new changes! We can simply use ``hg rebase`` to update our | 409 There are new changes! We can simply use ``hg rebase`` to update our |
410 changeset on top of the latest:: | 410 changeset on top of the latest: |
411 | 411 |
412 $ hg rebase | 412 $ hg rebase |
413 rebasing 6:183984ef46d1 "Adding hammer" | 413 rebasing 6:183984ef46d1 "Adding hammer" |
414 merging shopping | 414 merging shopping |
415 switching to topic tools | 415 switching to topic tools |
417 merging shopping | 417 merging shopping |
418 rebasing 8:34255b455dac "Adding drill" | 418 rebasing 8:34255b455dac "Adding drill" |
419 merging shopping | 419 merging shopping |
420 | 420 |
421 But what about the other topic? You can use 'hg topic --verbose' to see | 421 But what about the other topic? You can use 'hg topic --verbose' to see |
422 information about all the topics:: | 422 information about all the topics: |
423 | 423 |
424 $ hg topic --verbose | 424 $ hg topic --verbose |
425 drinks (on branch: default, 2 changesets, 2 behind) | 425 drinks (on branch: default, 2 changesets, 2 behind) |
426 * tools (on branch: default, 3 changesets) | 426 * tools (on branch: default, 3 changesets) |
427 | 427 |
428 The "2 behind" is telling you that there are 2 new changesets on the named | 428 The "2 behind" is telling you that there are 2 new changesets on the named |
429 branch of the topic. You need to merge or rebase to incorporate them. | 429 branch of the topic. You need to merge or rebase to incorporate them. |
430 | 430 |
431 Pushing that topic would create a new head, and therefore will be prevented:: | 431 Pushing that topic would create a new head, and therefore will be prevented: |
432 | 432 |
433 $ hg push --rev drinks | 433 $ hg push --rev drinks |
434 pushing to $TESTTMP/server (glob) | 434 pushing to $TESTTMP/server (glob) |
435 searching for changes | 435 searching for changes |
436 abort: push creates new remote head 70dfa201ed73! | 436 abort: push creates new remote head 70dfa201ed73! |
437 (merge or see 'hg help push' for details about pushing new heads) | 437 (merge or see 'hg help push' for details about pushing new heads) |
438 [255] | 438 [255] |
439 | 439 |
440 | 440 |
441 Even after a rebase, pushing all active topics at the same time will complain | 441 Even after a rebase, pushing all active topics at the same time will complain |
442 about the multiple heads it would create on that branch:: | 442 about the multiple heads it would create on that branch: |
443 | 443 |
444 $ hg rebase -b drinks | 444 $ hg rebase -b drinks |
445 rebasing 9:8dfa45bd5e0c "Adding apple juice" | 445 rebasing 9:8dfa45bd5e0c "Adding apple juice" |
446 merging shopping | 446 merging shopping |
447 switching to topic drinks | 447 switching to topic drinks |
454 abort: push creates new remote head 4cd7c1591a67! | 454 abort: push creates new remote head 4cd7c1591a67! |
455 (merge or see 'hg help push' for details about pushing new heads) | 455 (merge or see 'hg help push' for details about pushing new heads) |
456 [255] | 456 [255] |
457 | 457 |
458 Publishing only one of them is allowed (as long as it does not create a new | 458 Publishing only one of them is allowed (as long as it does not create a new |
459 branch head as we just saw in the previous case):: | 459 branch head as we just saw in the previous case): |
460 | 460 |
461 $ hg push -r drinks | 461 $ hg push -r drinks |
462 pushing to $TESTTMP/server (glob) | 462 pushing to $TESTTMP/server (glob) |
463 searching for changes | 463 searching for changes |
464 adding changesets | 464 adding changesets |
466 adding file changes | 466 adding file changes |
467 added 2 changesets with 2 changes to 1 files | 467 added 2 changesets with 2 changes to 1 files |
468 2 new obsolescence markers | 468 2 new obsolescence markers |
469 | 469 |
470 The published topic has now disappeared, and the other is now marked as | 470 The published topic has now disappeared, and the other is now marked as |
471 "behind":: | 471 "behind": |
472 | 472 |
473 $ hg topic --verbose | 473 $ hg topic --verbose |
474 * tools (on branch: default, 3 changesets, 2 behind) | 474 * tools (on branch: default, 3 changesets, 2 behind) |
475 $ hg stack | 475 $ hg stack |
476 ### topic: tools | 476 ### topic: tools |