rebase: linearize and the inverse operation

Uwe Brauer oub at mat.ucm.es
Thu Sep 8 08:08:10 UTC 2016


Hi

During my discussion with Kevin, the following question occurs to me.

    -  having a repo with a branch/bookmark I can linearize it.

    -  can I to the inverse operation de-linearize the repo and
       «recover» the original graph of the repo?

I came up with a small script, which seems to end in similar graphs
(hg log -G) but the are *not really* clones of each other

First create the repo
,----
| 
|  hg init
|  hg branch master
|  echo Upstream1 > main.txt
|  hg add main.txt
|  hg commit -m "Up one"
|  hg branch exam
|  echo exam1 > exam.txt
|  hg add exam.txt
|  hg commit -m "Exam 1"
|  echo exam2 >> exam.txt
|  hg commit -m "exam2"
|  hg update master
|  echo uwe-three >> main.txt
|  hg commit -m "Uwe three"
|  hg log -G
`----

Continue

,----
|  echo uwe-four >> main.txt
|  hg commit -m "Uwe four"
|  hg log -G
`----

First repo finished.

Second repo, generate it with the first. Then don't continue but
linearize it via

,----
| 
| hg rebase --keepbranches -s 1 -d 3
| hg log -G
`----

Now the inverse operation  nonlinearize it  and continue

,----
| hg rebase --keepbranches -s 2 -d 0
| # we are now in master
|  echo uwe-four >> main.txt
|  hg commit -m "Uwe four"
|  hg log -G
`----
compare the graphs.

Does my inverse operation make sense?

Thanks

Uwe Brauer 



More information about the Mercurial mailing list