[fold: different for branches and bookmarks] (was: [git repos])

Uwe Brauer oub at mat.ucm.es
Mon Dec 19 09:18:56 UTC 2016


   > Uwe Brauer writes:


   > This sounds like a typical case for rebasing — or more elegantly using
   > the evolve extension.

   > Upstream requires a single commit (one patch). So you’d ideally have
   > just that.

   > With the evolve extension you’d simply issue

   >   $ hg fold -r master -r feature


I just found out that fold behaves differently when using branches
instead of bookmarks. Using bookmarks, I obtain the same graph as you
but not for branches.

For branches I do:


hg init
echo feature > new.el
hg add new.el
hg commit -m feature1
echo offical2 >> new.el
hg commit -m feature2
echo feature3 >> new.el
hg commit -m feature3
hg branch feature
echo feature > feature.el
hg add feature.el
hg commit -m feature
echo feature2 >> feature.el
hg commit -m feature2
hg fold -r default -r feature

Which gives the following graph

@  changeset:   2:da5fe919132e
|  tag:         tip
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Mon Dec 19 09:15:19 2016 +0000
|  summary:     feature3
|
o  changeset:   1:fe3d513ead50
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Mon Dec 19 09:15:19 2016 +0000
|  summary:     feature2
|
o  changeset:   0:a6d03a55d8f1
   user:        Uwe Brauer <oub at mat.ucm.es>
   date:        Mon Dec 19 09:15:18 2016 +0000
   summary:     feature1

While using bookmarks would give:
  changeset:   5:e06ba3130622
|  bookmark:    master
|  tag:         tip
|  parent:      1:80ab55999696
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Mon Dec 19 09:17:22 2016 +0000
|  summary:     feature3
|
| x  changeset:   4:3ff9dbef4b64
| |  bookmark:    feature
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Mon Dec 19 09:17:17 2016 +0000
| |  summary:     feature2
| |
| x  changeset:   3:6f10b3f58a52
| |  user:        Uwe Brauer <oub at mat.ucm.es>
| |  date:        Mon Dec 19 09:17:17 2016 +0000
| |  summary:     feature
| |
| x  changeset:   2:71f8b88b0831
|/   user:        Uwe Brauer <oub at mat.ucm.es>
|    date:        Mon Dec 19 09:17:16 2016 +0000
|    summary:     feature3
|
o  changeset:   1:80ab55999696
|  user:        Uwe Brauer <oub at mat.ucm.es>
|  date:        Mon Dec 19 09:17:16 2016 +0000


With the script

hg init
hg bookmark master
echo feature > new.el
hg add new.el
hg commit -m feature1
echo offical2 >> new.el
hg commit -m feature2
echo feature3 >> new.el
hg commit -m feature3
hg bookmark feature
echo feature > feature.el
hg add feature.el
hg commit -m feature
echo feature2 >> feature.el
hg commit -m feature2
hg fold -r master -r feature





More information about the Mercurial mailing list