Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Mercurial changeset Evolution

Mercurial changeset Evolution

Boris Feld

July 03, 2017
Tweet

More Decks by Boris Feld

Other Decks in Programming

Transcript

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

    Fix bug hg commit --amend -m "Fix bug"
  2. 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...
  3. 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
  4. 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
  5. 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
  6. STACK $> hg stack ### topic: myfeature ### branch: feature

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

    = Earlier merge in trunk Ease experiment with Alternative etc…
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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 ~
  13. STACK TO THE RESCUE! $> hg stack ### topic: myfeature

    ### branch: feature t4$ Step4 (unstable) t3$ Step3 (unstable) t2$ Step2 (unstable) t1@ Step1 (current) ^ Trunk
  14. 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
  15. 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
  16. 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
  17. 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 ~
  18. MORE REWRITE TOOLS Operation command Modify hg amend Remove hg

    prune Move hg grab Split hg split Fold hg fold
  19. 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
  20. REWRITE ANYTHING? Phases enforce a reliable history: draft: can we

    rewritten public: immutable part of the history Contact your local workflow manager.
  21. SUMMARY $> hg summary parent: 10:890ac95deb83 tip (unstable) Head branch:

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

    | o 23abfc79b7ce | | o 4302274177b9 (unstable) | | | x fba593aaaa10 |/ rewritten as c55cb2ee8a91; o 2ff53d8bf7d7
  23. 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)
  24. OBSLOG $> hg obslog @ c55cb2ee8a91 (4) A2 | |

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

    | x 364e589e2bac (1) A rewritten(description, parent) as a6be771bedcf by Boris Feld <[email protected]> (Thu Jun 22 00:00:29 2017 +0200) (No patch available yet, changesets rebased) rewritten(description) as f6b1dded9e95 by Boris Feld <[email protected]> (Thu Jun 22 00:00:28 2017 +0200) --- a/364e589e2bac-changeset-description +++ b/f6b1dded9e95-changeset-description @@ -1,1 +1,1 @@ -A +A1
  26. 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
  27. SMART COMMANDS Operation command Modify hg amend Remove hg prune

    Move hg grab Split hg split Fold hg flog
  28. EVOLUTION Unlock powerful unique features Hide most of the complexity

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

    evolutions Content-divergence: independent rewrites Phase-divergence: older version got published
  30. WORK IN PROGRESS Concepts are solid Implementation in progress Common

    case works fine Some rough edges Feedback → priority
  31. 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)"
  32. FOLD Root A B To fold A and B: Root

    C A B hg fold -r "desc(A)" -r "desc(B)" -m "C"