Slide 1

Slide 1 text

CHANGESET EVOLUTION Boris Feld June 22, 2017 octobus.net

Slide 2

Slide 2 text

LET'S GET STARTED

Slide 3

Slide 3 text

ONCE UPON A TIME

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

YOU WRITE MORE CODE

Slide 6

Slide 6 text

URGENT MERGE

Slide 7

Slide 7 text

FIX THE FIX But it's easy to fix them: Parent Fix bug hg commit --amend -m "Fix bug"

Slide 8

Slide 8 text

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...

Slide 9

Slide 9 text

WITH EVOLVE NOW Parent Fx bug

Slide 10

Slide 10 text

SAME CLI With evolve this time: Parent Fix bug hg commit --amend -m "Fix bug"

Slide 11

Slide 11 text

OK WHAT THE DIFFERENCE?

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

ONE MORE THING

Slide 16

Slide 16 text

TRACK EVOLUTION Parent Fix bug Fx bug

Slide 17

Slide 17 text

OBSMARKER Stores relation between evolutions Successor Predecessor And some metas: User Date And others...

Slide 18

Slide 18 text

STACK WORKFLOW

Slide 19

Slide 19 text

STACK $> hg stack ### topic: myfeature ### branch: feature t4@ Step4 (current) t3: Step3 t2: Step2 t1: Step ^ Trunk

Slide 20

Slide 20 text

WHY STACK? Feature = multiple steps, Smaller = Simpler Simpler = Earlier merge in trunk Ease experiment with Alternative etc…

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

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

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

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 ~

Slide 26

Slide 26 text

STACK TO THE RESCUE! $> hg stack ### topic: myfeature ### branch: feature t4$ Step4 (unstable) t3$ Step3 (unstable) t2$ Step2 (unstable) t1@ Step1 (current) ^ Trunk

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

GO ON

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

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

Slide 31

Slide 31 text

GO ON $> hg next --evolve no children

Slide 32

Slide 32 text

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 ~

Slide 33

Slide 33 text

MORE REWRITE TOOLS Operation command Modify hg amend Remove hg prune Move hg grab Split hg split Fold hg fold

Slide 34

Slide 34 text

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

Slide 35

Slide 35 text

DISTRIBUTED WORKFLOW

Slide 36

Slide 36 text

PROPAGATION Obsolescence can be exchanged: push, pull bundle / unbundle (hg 4.3+) (affects draft history only)

Slide 37

Slide 37 text

EXCHANGING DRAFT Works on multiple machines Collaborate with others Whole new play field == new traps

Slide 38

Slide 38 text

EXAMPLE Root A Root A

Slide 39

Slide 39 text

TIME PASS Root A1 A Root A B

Slide 40

Slide 40 text

INSTABILITY Root A1 A B

Slide 41

Slide 41 text

IT'S SMART

Slide 42

Slide 42 text

STABILIZATION Root A1 A B1 B

Slide 43

Slide 43 text

REWRITE ANYTHING? Phases enforce a reliable history: draft: can we rewritten public: immutable part of the history Contact your local workflow manager.

Slide 44

Slide 44 text

HELPFULL TOOLING

Slide 45

Slide 45 text

SUMMARY $> hg summary parent: 10:890ac95deb83 tip (unstable) Head branch: feature commit: (clean) update: (current) phases: 9 draft unstable: 1 changesets topic: myfeature

Slide 46

Slide 46 text

LOG $ hg log -G --hidden -T '{node|short}\n{obsfate}\n' @ c55cb2ee8a91 | o 23abfc79b7ce | | o 4302274177b9 (unstable) | | | x fba593aaaa10 |/ rewritten as c55cb2ee8a91; o 2ff53d8bf7d7

Slide 47

Slide 47 text

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)

Slide 48

Slide 48 text

OBSLOG $> hg obslog @ c55cb2ee8a91 (4) A2 | | o 4302274177b9 (2) A1 |/ x fba593aaaa10 (1) A rewritten(description, parent) as c55cb2ee8a91 by Boris Feld (Thu Jun 22 00:00:29 2017 +0200) rewritten(description) as 4302274177b9 by Boris Feld (Thu Jun 22 00:00:28 2017 +0200)

Slide 49

Slide 49 text

OBSLOG --PATCH $> hg obslog -p @ f6b1dded9e95 (2) A1 | x 364e589e2bac (1) A rewritten(description, parent) as a6be771bedcf by Boris Feld (Thu Jun 22 00:00:29 2017 +0200) (No patch available yet, changesets rebased) rewritten(description) as f6b1dded9e95 by Boris Feld (Thu Jun 22 00:00:28 2017 +0200) --- a/364e589e2bac-changeset-description +++ b/f6b1dded9e95-changeset-description @@ -1,1 +1,1 @@ -A +A1

Slide 50

Slide 50 text

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

Slide 51

Slide 51 text

SEMANTIC

Slide 52

Slide 52 text

USE THE RIGHT COMMANDS!

Slide 53

Slide 53 text

SMART COMMANDS Operation command Modify hg amend Remove hg prune Move hg grab Split hg split Fold hg flog

Slide 54

Slide 54 text

TROUBLES

Slide 55

Slide 55 text

EVOLUTION Unlock powerful unique features Hide most of the complexity Help with unstable situations Automatic detection Automated resolution hg help evolve

Slide 56

Slide 56 text

INSTABILITY (currently: troubles) Orphans: ancestors were rewritten Divergence: branching in evolutions Content-divergence: independent rewrites Phase-divergence: older version got published

Slide 57

Slide 57 text

CONCLUSION

Slide 58

Slide 58 text

WORK IN PROGRESS Concepts are solid Implementation in progress Common case works fine Some rough edges Feedback → priority

Slide 59

Slide 59 text

USE EVOLUTION TODAY install hg-evolve [extensions] evolve= topic= # provides hg stack

Slide 60

Slide 60 text

HELPS Slack: #devs-mercurial-evolve Mailing-list: [email protected] IRC channel: #mercurial

Slide 61

Slide 61 text

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

Slide 62

Slide 62 text

CONCLUSION

Slide 63

Slide 63 text

REWRITE ALL THE THINGS!

Slide 64

Slide 64 text

SAFETY FIRST!

Slide 65

Slide 65 text

EXTRA - TROUBLES

Slide 66

Slide 66 text

OBSOLETE Root New Obsolete

Slide 67

Slide 67 text

UNSTABLE Now called orphan Root New Obsolete Unstable

Slide 68

Slide 68 text

BUMPED Now called Phase-divergent Root New Obsolete Bumped

Slide 69

Slide 69 text

DIVERGENT Now called Content-divergent Root Base Divergent1 Divergent2

Slide 70

Slide 70 text

EXTRA-COMMANDS

Slide 71

Slide 71 text

AMEND Root A To amend A: Root A1 A hg amend -m 'A1'

Slide 72

Slide 72 text

PRUNE Root A To prune A: Root A hg prune -r "desc(A)"

Slide 73

Slide 73 text

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)"

Slide 74

Slide 74 text

FOLD Root A B To fold A and B: Root C A B hg fold -r "desc(A)" -r "desc(B)" -m "C"

Slide 75

Slide 75 text

SPLIT Root A Split in two: Root B A C hg split -r "desc(A)"

Slide 76

Slide 76 text

No content