Mercurial > evolve
comparison tests/test-topic-tutorial.t @ 2014:cd6d32a0155c
tutorial: add a second part about having multiple topic
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Fri, 30 Sep 2016 18:21:50 +0200 |
parents | 2e8e4619a240 |
children | db617700d318 |
comparison
equal
deleted
inserted
replaced
2013:2e8e4619a240 | 2014:cd6d32a0155c |
---|---|
307 date: Thu Jan 01 00:00:00 1970 +0000 | 307 date: Thu Jan 01 00:00:00 1970 +0000 |
308 summary: Shopping list | 308 summary: Shopping list |
309 | 309 |
310 $ hg up default | 310 $ hg up default |
311 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | 311 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
312 | |
313 Working with Multiple Topics | |
314 ============================ | |
315 | |
316 In the above example, topic are not bring much benefit since you only have one | |
317 line of developement. Topic start to be more useful when you have to work on | |
318 multiple features are the same time. | |
319 | |
320 We might go shopping in a hardware store in the same go, so let's add some | |
321 tools to the shopping list withing a new topic:: | |
322 | |
323 $ hg topic tools | |
324 $ echo hammer >> shopping | |
325 $ hg ci -m 'Adding hammer' | |
326 $ echo saw >> shopping | |
327 $ hg ci -m 'Adding saw' | |
328 $ echo drill >> shopping | |
329 $ hg ci -m 'Adding drill' | |
330 | |
331 But are not sure to actually go in the hardward store, so in the meantime, we | |
332 want to extend the list with drinks. We go back to the official default branch | |
333 and start a new topic:: | |
334 | |
335 $ hg up default | |
336 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
337 $ hg topic drinks | |
338 $ echo 'apple juice' >> shopping | |
339 $ hg ci -m 'Adding apple juice' | |
340 $ echo 'orange juice' >> shopping | |
341 $ hg ci -m 'Adding orange juice' | |
342 | |
343 We now have two topics:: | |
344 | |
345 $ hg topic | |
346 * drinks | |
347 tools | |
348 | |
349 The information ``hg stack`` command adapt to the active topic:: | |
350 | |
351 $ hg stack | |
352 ### topic: drinks | |
353 ### branch: default | |
354 t2@ Adding orange juice (current) | |
355 t1: Adding apple juice | |
356 ^ adding fruits | |
357 $ hg up tools | |
358 switching to topic tools | |
359 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
360 $ hg stack | |
361 ### topic: tools | |
362 ### branch: default | |
363 t3@ Adding drill (current) | |
364 t2: Adding saw | |
365 t1: Adding hammer | |
366 ^ adding fruits | |
367 | |
368 They are seen as independant branch by Mercurial. No rebase or merge betwen them will be attempted by default:: | |
369 | |
370 $ hg rebase | |
371 nothing to rebase | |
372 [1] | |
373 | |
374 .. server activity:: | |
375 | |
376 $ cd ../server | |
377 $ hg up | |
378 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
379 $ mv shopping foo | |
380 $ echo 'Coat' > shopping | |
381 $ cat foo >> shopping | |
382 $ hg ci -m 'add a coat' | |
383 $ echo 'Coat' > shopping | |
384 $ echo 'Shoes' >> shopping | |
385 $ cat foo >> shopping | |
386 $ hg rm foo | |
387 not removing foo: file is untracked | |
388 [1] | |
389 $ hg ci -m 'add a pair of shoes' | |
390 $ cd ../client | |
391 | |
392 Lets see what other people did in the mean time:: | |
393 | |
394 $ hg pull | |
395 pulling from $TESTTMP/server | |
396 searching for changes | |
397 adding changesets | |
398 adding manifests | |
399 adding file changes | |
400 added 2 changesets with 2 changes to 1 files (+1 heads) | |
401 (run 'hg heads' to see heads) | |
402 | |
403 There is new changes! We can simply use ``hg rebase`` to update our changeset on top of the latest:: | |
404 | |
405 $ hg rebase | |
406 rebasing 6:183984ef46d1 "Adding hammer" | |
407 merging shopping | |
408 rebasing 7:cffff85af537 "Adding saw" | |
409 merging shopping | |
410 rebasing 8:34255b455dac "Adding drill" | |
411 merging shopping | |
412 | |
413 But what about the other topic? You can use 'hg topic --verbose' to see information about them:: | |
414 | |
415 $ hg topic --verbose | |
416 drinks (on branch: default, 2 changesets, 2 behind) | |
417 tools (on branch: default, 3 changesets) | |
418 | |
419 The "2 behind" is telling you that there is 2 new changesets on the named branch of the topic. You need to merge or rebase to incorporate them. | |
420 | |
421 Pushing that topic would create a new heads will be prevented:: | |
422 | |
423 $ hg push --rev drinks | |
424 pushing to $TESTTMP/server | |
425 searching for changes | |
426 abort: push creates new remote head 70dfa201ed73! | |
427 (merge or see 'hg help push' for details about pushing new heads) | |
428 [255] | |
429 | |
430 | |
431 Even after a rebase Pushing all active topics at the same time will complains about the multiple heads it would create on that branch:: | |
432 | |
433 $ hg rebase -b drinks | |
434 rebasing 9:8dfa45bd5e0c "Adding apple juice" | |
435 merging shopping | |
436 rebasing 10:70dfa201ed73 "Adding orange juice" | |
437 merging shopping | |
438 switching to topic tools | |
439 $ hg push | |
440 pushing to $TESTTMP/server | |
441 searching for changes | |
442 abort: push creates new remote head 4cd7c1591a67! | |
443 (merge or see 'hg help push' for details about pushing new heads) | |
444 [255] | |
445 | |
446 Publishing only one of them is allowed (as long as it does not create a new branch head has we just saw in the previous case):: | |
447 | |
448 $ hg push -r drinks | |
449 pushing to $TESTTMP/server | |
450 searching for changes | |
451 adding changesets | |
452 adding manifests | |
453 adding file changes | |
454 added 2 changesets with 2 changes to 1 files | |
455 2 new obsolescence markers | |
456 | |
457 The publishing topic has now vanished, and the one still draft is now marked as "behind":: | |
458 | |
459 $ hg topic --verbose | |
460 * tools (on branch: default, 3 changesets, 2 behind) | |
461 $ hg stack | |
462 ### topic: tools | |
463 ### branch: default, 2 behind | |
464 t3@ Adding drill (current) | |
465 t2: Adding saw | |
466 t1: Adding hammer | |
467 ^ add a pair of shoes | |
468 |