Merging code developed in a feature branch

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Merging code developed in a feature branch

Carlo de Falco-2
Hi,

I already asked this in an other thread, but I am here focusing on mercurial
usage alone and CC-ing my favourite mercurial expert ;)

I have been keeping up to date the code developed by two of the GSOC
students by pushing it on two branches here:

https://bitbucket.org/cdf1/octave/branch/dorigo
https://bitbucket.org/cdf1/octave/branch/ode15i

Assuming that I want to push this to savannah (possibly without
creating to extra branches there), what would be the best approach?
Would it work if I merge the two feature branches [*] into default
on bitbucket then do

hg push -b default

to savannah? Or should I create patches via  

hg diff -r ode15i:default

and

hg diff -r ode15i:dorigo

and import them then push?
Or should I just merge and push thus creating two new branches (but no new head)?

Of course I know I should have been using bookmarks rather than branches, but I haven't ...

c.




Reply | Threaded
Open this post in threaded view
|

Re: Merging code developed in a feature branch

Mike Miller-4
On Fri, Dec 02, 2016 at 11:23:58 +0000, Carlo De Falco wrote:

> Hi,
>
> I already asked this in an other thread, but I am here focusing on mercurial
> usage alone and CC-ing my favourite mercurial expert ;)
>
> I have been keeping up to date the code developed by two of the GSOC
> students by pushing it on two branches here:
>
> https://bitbucket.org/cdf1/octave/branch/dorigo
> https://bitbucket.org/cdf1/octave/branch/ode15i
>
> Assuming that I want to push this to savannah (possibly without
> creating to extra branches there), what would be the best approach?
> Would it work if I merge the two feature branches [*] into default
> on bitbucket then do
>
> hg push -b default
>
> to savannah? Or should I create patches via  
>
> hg diff -r ode15i:default
>
> and
>
> hg diff -r ode15i:dorigo
>
> and import them then push?
> Or should I just merge and push thus creating two new branches (but no new head)?
>
> Of course I know I should have been using bookmarks rather than branches, but I haven't ...

If you want to keep the original history as it is, but just remove the
fact that they were developed on a named branch, I think you could use
the `hg graft` [1] command.

I think you could choose to graft the series onto either the current
default branch head (like a rebase, but giving up the original feature
branch name), or onto the previous revision where the work started
(converting the branch into a new head/bookmark on default) and merge
that into the head.

[1]: https://www.mercurial-scm.org/repo/hg/help/graft

--
mike

Reply | Threaded
Open this post in threaded view
|

Re: Merging code developed in a feature branch

Jordi Gutiérrez Hermoso-2
It was CC'ed to me, but I Mike pretty much gave the reply I would have
given.

Either graft or rebase your thing. The only difference between the two
is that the graft keeps the original commits while a rebase strips or
obsoletes the commits. Since I expect some confusion between having
the commits stripped from one repo but not the other, I recommend
grafting so the duplicate commits are more obvious.

- Jordi G. H.