Mercurial changeset Evolution

Mercurial changeset Evolution

410e3353165c33043ab69be7fc366428?s=128

Boris Feld

July 03, 2017
Tweet

Transcript

  1. CHANGESET EVOLUTION Boris Feld June 22, 2017 octobus.net

  2. LET'S GET STARTED

  3. ONCE UPON A TIME

  4. YOU FIX A BUG (With a small typo) Parent Fx

    bug
  5. YOU WRITE MORE CODE

  6. URGENT MERGE

  7. FIX THE FIX But it's easy to fix them: Parent

    Fix bug hg commit --amend -m "Fix bug"
  8. TOO FAST! But wait you had local changes! And they

    get incorporated into the amend. 10 more minutes to unbundle revert the files, relaunch the tests, etc...
  9. WITH EVOLVE NOW Parent Fx bug

  10. SAME CLI With evolve this time: Parent Fix bug hg

    commit --amend -m "Fix bug"
  11. OK WHAT THE DIFFERENCE?

  12. BEFORE / AFTER Before: After: $> hg log -G -T

    compact @ 1 0abbeece133b Fix bug | o 0 5e5cd613e43b ROOT $> hg log -G -T compact @ 2 b1739dd137e5 Fix bug | o 0 5e5cd613e43b ROOT
  13. DIFFERENCE IS HIDDEN The old revision is still there! $>

    hg log -G -T compact --hidden o 2 b1739dd137e5 Fix bug | | x 1 6b2be349e073 Fx bug |/ o 0 5e5cd613e43b ROOT
  14. IMPACT Easier to access obsolete changesets No more .hg/strip-backup/ expedition

    Respect the append only model of Mercurial No large data movement on edition No cache trauma
  15. ONE MORE THING

  16. TRACK EVOLUTION Parent Fix bug Fx bug

  17. OBSMARKER Stores relation between evolutions Successor Predecessor And some metas:

    User Date And others...
  18. STACK WORKFLOW

  19. STACK $> hg stack ### topic: myfeature ### branch: feature

    t4@ Step4 (current) t3: Step3 t2: Step2 t1: Step ^ Trunk
  20. WHY STACK? Feature = multiple steps, Smaller = Simpler Simpler

    = Earlier merge in trunk Ease experiment with Alternative etc…
  21. PREV $> hg prev 1 files updated, 0 files merged,

    0 files removed, 0 files unresolved [7] Step3 $> hg stack ### topic: myfeature ### branch: feature t4: Step4 t3@ Step3 (current) t2: Step2 t1: Step ^ Trunk
  22. NEXT $> hg next 1 files updated, 0 files merged,

    0 files removed, 0 files unresolved [8] Step4 $> hg stack ### topic: myfeature ### branch: feature t4@ Step4 (current) t3: Step3 t2: Step2 t1: Step ^ Trunk
  23. T# $> hg update --rev t2 1 files updated, 0

    files merged, 0 files removed, 0 files unresolved [8] Step4 $> hg stack ### topic: myfeature ### branch: feature t4: Step4 t3: Step3 t2@ Step2 (current) t1: Step ^ Trunk
  24. EDITING MID-STACK $> hg update --rev t1 1 files updated,

    0 files merged, 0 files removed, 0 files unresolved $> hg commit --amend -m "Step1" 3 new unstable changesets
  25. WHAT HAVE WE DONE? $> hg log -G -T compact

    @ 9[tip] 1aa1be5ada40 Step1 | | o 8 cf90b2de7e65 Step4 (unstable) | | | o 7 e208d4205c8e Step3 (unstable) | | | o 6 673ff300cf3a Step2 (unstable) | | | x 5 8bb88a31dd28 Step |/ o 4 3294c1730df7 Trunk ~
  26. STACK TO THE RESCUE! $> hg stack ### topic: myfeature

    ### branch: feature t4$ Step4 (unstable) t3$ Step3 (unstable) t2$ Step2 (unstable) t1@ Step1 (current) ^ Trunk
  27. DON'T PANIC $> hg next --evolve move:[6] Step2 atop:[9] Step1

    working directory now at d72473cbf9a6 $> hg stack ### topic: myfeature ### branch: feature t4$ Step4 (unstable) t3$ Step3 (unstable) t2@ Step2 (current) t1: Step1 ^ Trunk
  28. GO ON

  29. GO ON $> hg next --evolve move:[7] Step3 atop:[10] Step2

    working directory now at 4062d6ecd214 $> hg stack ### topic: myfeature ### branch: feature t4$ Step4 (unstable) t3@ Step3 (current) t2: Step2 t1: Step1 ^ Trunk
  30. GO ON $> hg next --evolve move:[8] Step4 atop:[11] Step3

    working directory now at 4dcd9dfedf1b $> hg stack ### topic: myfeature ### branch: feature t4@ Step4 (current) t3: Step3 t2: Step2 t1: Step1 ^ Trunk
  31. GO ON $> hg next --evolve no children

  32. BETTER! $> hg log -G -T compact @ 12[tip] 4dcd9dfedf1b

    Step4 | o 11 4062d6ecd214 Step3 | o 10 d72473cbf9a6 Step2 | o 9 1aa1be5ada40 Step1 | o 4 3294c1730df7 Trunk ~
  33. MORE REWRITE TOOLS Operation command Modify hg amend Remove hg

    prune Move hg grab Split hg split Fold hg fold
  34. MULTI HEADED STACK $> hg stack ### topic: myfeature (2

    heads) ### branch: feature t6@ Step 4.5 (current) t4^ Step4 (base) t5: Step 5 t4: Step4 t3: Step3 t2: Step2 t1: Step1 ^ Trunk
  35. DISTRIBUTED WORKFLOW

  36. PROPAGATION Obsolescence can be exchanged: push, pull bundle / unbundle

    (hg 4.3+) (affects draft history only)
  37. EXCHANGING DRAFT Works on multiple machines Collaborate with others Whole

    new play field == new traps
  38. EXAMPLE Root A Root A

  39. TIME PASS Root A1 A Root A B

  40. INSTABILITY Root A1 A B

  41. IT'S SMART

  42. STABILIZATION Root A1 A B1 B

  43. REWRITE ANYTHING? Phases enforce a reliable history: draft: can we

    rewritten public: immutable part of the history Contact your local workflow manager.
  44. HELPFULL TOOLING

  45. SUMMARY $> hg summary parent: 10:890ac95deb83 tip (unstable) Head branch:

    feature commit: (clean) update: (current) phases: 9 draft unstable: 1 changesets topic: myfeature
  46. LOG $ hg log -G --hidden -T '{node|short}\n{obsfate}\n' @ c55cb2ee8a91

    | o 23abfc79b7ce | | o 4302274177b9 (unstable) | | | x fba593aaaa10 |/ rewritten as c55cb2ee8a91; o 2ff53d8bf7d7
  47. EVOLVE --LIST (see also hg evolve --list --rev) $> hg

    evolve --list 9ac0d376e01c: changelog: introduce a 'tiprev' method unstable: 52ec3072fe46 (obsolete parent) 3efd3eab9860: changelog: use 'tiprev()' in 'tip()' unstable: 9ac0d376e01c (unstable parent)
  48. OBSLOG $> hg obslog @ c55cb2ee8a91 (4) A2 | |

    o 4302274177b9 (2) A1 |/ x fba593aaaa10 (1) A rewritten(description, parent) as c55cb2ee8a91 by Boris Feld <boris.feld@octobus.net> (Thu Jun 22 00:00:29 2017 +0200) rewritten(description) as 4302274177b9 by Boris Feld <boris.feld@octobus.net> (Thu Jun 22 00:00:28 2017 +0200)
  49. OBSLOG --PATCH $> hg obslog -p @ f6b1dded9e95 (2) A1

    | x 364e589e2bac (1) A rewritten(description, parent) as a6be771bedcf by Boris Feld <boris.feld@octobus.net> (Thu Jun 22 00:00:29 2017 +0200) (No patch available yet, changesets rebased) rewritten(description) as f6b1dded9e95 by Boris Feld <boris.feld@octobus.net> (Thu Jun 22 00:00:28 2017 +0200) --- a/364e589e2bac-changeset-description +++ b/f6b1dded9e95-changeset-description @@ -1,1 +1,1 @@ -A +A1
  50. JOURNAL $> hg journal previous locations of '.': 2fb6d364d453 commit

    --amend -m Step1 701fb5d73e07 update --rev t1 ae11635effb7 commit -A -m Step2 701fb5d73e07 commit -A -m Step
  51. SEMANTIC

  52. USE THE RIGHT COMMANDS!

  53. SMART COMMANDS Operation command Modify hg amend Remove hg prune

    Move hg grab Split hg split Fold hg flog
  54. TROUBLES

  55. EVOLUTION Unlock powerful unique features Hide most of the complexity

    Help with unstable situations Automatic detection Automated resolution hg help evolve
  56. INSTABILITY (currently: troubles) Orphans: ancestors were rewritten Divergence: branching in

    evolutions Content-divergence: independent rewrites Phase-divergence: older version got published
  57. CONCLUSION

  58. WORK IN PROGRESS Concepts are solid Implementation in progress Common

    case works fine Some rough edges Feedback → priority
  59. USE EVOLUTION TODAY install hg-evolve [extensions] evolve= topic= # provides

    hg stack
  60. HELPS Slack: #devs-mercurial-evolve Mailing-list: evolve-testers@mercurial-scm.org IRC channel: #mercurial

  61. DOCUMENTATION Documentation: Wiki: https://www.mercurial-scm.org/doc/evolution/index.html https://www.mercurial-scm.org/wiki/EvolveExtension

  62. CONCLUSION

  63. REWRITE ALL THE THINGS!

  64. SAFETY FIRST!

  65. EXTRA - TROUBLES

  66. OBSOLETE Root New Obsolete

  67. UNSTABLE Now called orphan Root New Obsolete Unstable

  68. BUMPED Now called Phase-divergent Root New Obsolete Bumped

  69. DIVERGENT Now called Content-divergent Root Base Divergent1 Divergent2

  70. EXTRA-COMMANDS

  71. AMEND Root A To amend A: Root A1 A hg

    amend -m 'A1'
  72. PRUNE Root A To prune A: Root A hg prune

    -r "desc(A)"
  73. REBASE Root B A In order to rebase A on

    top of B; Root B A A' hg rebase -r "desc(A)" -d "desc(B)"
  74. FOLD Root A B To fold A and B: Root

    C A B hg fold -r "desc(A)" -r "desc(B)" -m "C"
  75. SPLIT Root A Split in two: Root B A C

    hg split -r "desc(A)"
  76. None