comparison tests/test-topic-tutorial.t @ 2722:44a6e6fbf80b stable

tutorial: fix grammar and spelling
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sun, 09 Jul 2017 15:01:32 +0300
parents c3a29c7abbee
children c64e2167514b
comparison
equal deleted inserted replaced
2721:c3a29c7abbee 2722:44a6e6fbf80b
40 their unfinished work. 40 their unfinished work.
41 41
42 Topic Basics 42 Topic Basics
43 ============ 43 ============
44 44
45 Let's says 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 do some edition to this list and would like to do them within 55 We are about to make some additions to this list and would like to do them
56 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 As for named branch, our topic is active but it does not contains 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
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 commit 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
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 ^ Shopping list 129 ^ Shopping list
130 130
131 The topic desactivate 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
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 160
161 And updating back to the topic reactivate it:: 161 And updating back to the topic reactivates it::
162 162
163 $ hg up food 163 $ hg up food
164 switching to topic food 164 switching to topic food
165 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 165 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 $ hg topic 166 $ hg topic
167 * food 167 * food
168 168
169 The name used for updating does not affect the activation of the topic, 169 Updating to any changeset that is part of a topic activates the topic
170 updating to a revision part of a topic will activate it in all cases:: 170 regardless of how the revision was specified::
171 171
172 $ hg up default 172 $ hg up default
173 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 173 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
174 $ hg up --rev 'desc("condiments")' 174 $ hg up --rev 'desc("condiments")'
175 switching to topic food 175 switching to topic food
192 > Salmon mousse 192 > Salmon mousse
193 > EOF 193 > EOF
194 $ hg commit -A -m "Adding clothes" 194 $ hg commit -A -m "Adding clothes"
195 $ cd ../client 195 $ cd ../client
196 196
197 Topic will also affect rebase and merge destination. Let's pull the latest 197 The topic will also affect the rebase and the merge destinations. Let's pull
198 update from the main server:: 198 the latest update from the main server::
199 199
200 $ hg pull 200 $ hg pull
201 pulling from $TESTTMP/server (glob) 201 pulling from $TESTTMP/server (glob)
202 searching for changes 202 searching for changes
203 adding changesets 203 adding changesets
229 user: test 229 user: test
230 date: Thu Jan 01 00:00:00 1970 +0000 230 date: Thu Jan 01 00:00:00 1970 +0000
231 summary: Shopping list 231 summary: Shopping list
232 232
233 233
234 The topic head will not be considered when merge from the new head of the 234 The topic head will not be considered when merging from the new head of the
235 branch:: 235 branch::
236 236
237 $ hg up default 237 $ hg up default
238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 238 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
239 $ hg merge 239 $ hg merge
276 user: test 276 user: test
277 date: Thu Jan 01 00:00:00 1970 +0000 277 date: Thu Jan 01 00:00:00 1970 +0000
278 summary: Shopping list 278 summary: Shopping list
279 279
280 280
281 The topic information will fade out when we publish the changesets:: 281 The topic information will disappear when we publish the changesets::
282 282
283 $ hg topic 283 $ hg topic
284 * food 284 * food
285 $ hg push 285 $ hg push
286 pushing to $TESTTMP/server (glob) 286 pushing to $TESTTMP/server (glob)
319 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 319 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
320 320
321 Working with Multiple Topics 321 Working with Multiple Topics
322 ============================ 322 ============================
323 323
324 In the above example, topic are not bring much benefit since you only have one 324 In the above example, topics do not bring much benefit since you only have one
325 line of developement. Topic start to be more useful when you have to work on 325 line of development. Topics start to be more useful when you have to work on
326 multiple features are the same time. 326 multiple features at the same time.
327 327
328 We might go shopping in a hardware store in the same go, so let's add some 328 We might go shopping in a hardware store in the same go, so let's add some
329 tools to the shopping list withing a new topic:: 329 tools to the shopping list within a new topic::
330 330
331 $ hg topic tools 331 $ hg topic tools
332 $ echo hammer >> shopping 332 $ echo hammer >> shopping
333 $ hg ci -m 'Adding hammer' 333 $ hg ci -m 'Adding hammer'
334 $ echo saw >> shopping 334 $ echo saw >> shopping
335 $ hg ci -m 'Adding saw' 335 $ hg ci -m 'Adding saw'
336 $ echo drill >> shopping 336 $ echo drill >> shopping
337 $ hg ci -m 'Adding drill' 337 $ hg ci -m 'Adding drill'
338 338
339 But are not sure to actually go in the hardward store, so in the meantime, we 339 But we are not sure we will actually go to the hardware store, so in the
340 want to extend the list with drinks. We go back to the official default branch 340 meantime, we want to extend the list with drinks. We go back to the official
341 and start a new topic:: 341 default branch and start a new topic::
342 342
343 $ hg up default 343 $ hg up default
344 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 344 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
345 $ hg topic drinks 345 $ hg topic drinks
346 $ echo 'apple juice' >> shopping 346 $ echo 'apple juice' >> shopping
352 352
353 $ hg topic 353 $ hg topic
354 * drinks 354 * drinks
355 tools 355 tools
356 356
357 The information ``hg stack`` command adapt to the active topic:: 357 The information displayed by ``hg stack`` adapts to the active topic::
358 358
359 $ hg stack 359 $ hg stack
360 ### topic: drinks 360 ### topic: drinks
361 ### branch: default 361 ### branch: default
362 t2@ Adding orange juice (current) 362 t2@ Adding orange juice (current)
371 t3@ Adding drill (current) 371 t3@ Adding drill (current)
372 t2: Adding saw 372 t2: Adding saw
373 t1: Adding hammer 373 t1: Adding hammer
374 ^ adding fruits 374 ^ adding fruits
375 375
376 They are seen as independant branch by Mercurial. No rebase or merge betwen 376 They are seen as independent branches by Mercurial. No rebase or merge
377 them will be attempted by default:: 377 between them will be attempted by default::
378 378
379 $ hg rebase 379 $ hg rebase
380 nothing to rebase 380 nothing to rebase
381 [1] 381 [1]
382 382
394 $ cat foo >> shopping 394 $ cat foo >> shopping
395 $ rm foo 395 $ rm foo
396 $ hg ci -m 'add a pair of shoes' 396 $ hg ci -m 'add a pair of shoes'
397 $ cd ../client 397 $ cd ../client
398 398
399 Lets see what other people did in the mean time:: 399 Let's see what other people did in the meantime::
400 400
401 $ hg pull 401 $ hg pull
402 pulling from $TESTTMP/server (glob) 402 pulling from $TESTTMP/server (glob)
403 searching for changes 403 searching for changes
404 adding changesets 404 adding changesets
405 adding manifests 405 adding manifests
406 adding file changes 406 adding file changes
407 added 2 changesets with 2 changes to 1 files (+1 heads) 407 added 2 changesets with 2 changes to 1 files (+1 heads)
408 (run 'hg heads' to see heads) 408 (run 'hg heads' to see heads)
409 409
410 There is new changes! We can simply use ``hg rebase`` to update our 410 There are new changes! We can simply use ``hg rebase`` to update our
411 changeset on top of the latest:: 411 changeset on top of the latest::
412 412
413 $ hg rebase 413 $ hg rebase
414 rebasing 6:183984ef46d1 "Adding hammer" 414 rebasing 6:183984ef46d1 "Adding hammer"
415 merging shopping 415 merging shopping
418 merging shopping 418 merging shopping
419 rebasing 8:34255b455dac "Adding drill" 419 rebasing 8:34255b455dac "Adding drill"
420 merging shopping 420 merging shopping
421 421
422 But what about the other topic? You can use 'hg topic --verbose' to see 422 But what about the other topic? You can use 'hg topic --verbose' to see
423 information about them:: 423 information about all the topics::
424 424
425 $ hg topic --verbose 425 $ hg topic --verbose
426 drinks (on branch: default, 2 changesets, 2 behind) 426 drinks (on branch: default, 2 changesets, 2 behind)
427 * tools (on branch: default, 3 changesets) 427 * tools (on branch: default, 3 changesets)
428 428
429 The "2 behind" is telling you that there is 2 new changesets on the named 429 The "2 behind" is telling you that there are 2 new changesets on the named
430 branch of the topic. You need to merge or rebase to incorporate them. 430 branch of the topic. You need to merge or rebase to incorporate them.
431 431
432 Pushing that topic would create a new heads will be prevented:: 432 Pushing that topic would create a new head, and therefore will be prevented::
433 433
434 $ hg push --rev drinks 434 $ hg push --rev drinks
435 pushing to $TESTTMP/server (glob) 435 pushing to $TESTTMP/server (glob)
436 searching for changes 436 searching for changes
437 abort: push creates new remote head 70dfa201ed73! 437 abort: push creates new remote head 70dfa201ed73!
438 (merge or see 'hg help push' for details about pushing new heads) 438 (merge or see 'hg help push' for details about pushing new heads)
439 [255] 439 [255]
440 440
441 441
442 Even after a rebase Pushing all active topics at the same time will 442 Even after a rebase, pushing all active topics at the same time will complain
443 complains about the multiple heads it would create on that branch:: 443 about the multiple heads it would create on that branch::
444 444
445 $ hg rebase -b drinks 445 $ hg rebase -b drinks
446 rebasing 9:8dfa45bd5e0c "Adding apple juice" 446 rebasing 9:8dfa45bd5e0c "Adding apple juice"
447 merging shopping 447 merging shopping
448 switching to topic drinks 448 switching to topic drinks
455 abort: push creates new remote head 4cd7c1591a67! 455 abort: push creates new remote head 4cd7c1591a67!
456 (merge or see 'hg help push' for details about pushing new heads) 456 (merge or see 'hg help push' for details about pushing new heads)
457 [255] 457 [255]
458 458
459 Publishing only one of them is allowed (as long as it does not create a new 459 Publishing only one of them is allowed (as long as it does not create a new
460 branch head has we just saw in the previous case):: 460 branch head as we just saw in the previous case)::
461 461
462 $ hg push -r drinks 462 $ hg push -r drinks
463 pushing to $TESTTMP/server (glob) 463 pushing to $TESTTMP/server (glob)
464 searching for changes 464 searching for changes
465 adding changesets 465 adding changesets
466 adding manifests 466 adding manifests
467 adding file changes 467 adding file changes
468 added 2 changesets with 2 changes to 1 files 468 added 2 changesets with 2 changes to 1 files
469 2 new obsolescence markers 469 2 new obsolescence markers
470 470
471 The publishing topic has now vanished, and the one still draft is now marked 471 The published topic has now disappeared, and the other is now marked as
472 as "behind":: 472 "behind"::
473 473
474 $ hg topic --verbose 474 $ hg topic --verbose
475 * tools (on branch: default, 3 changesets, 2 behind) 475 * tools (on branch: default, 3 changesets, 2 behind)
476 $ hg stack 476 $ hg stack
477 ### topic: tools 477 ### topic: tools