In v2.8, "hg rebase" leaves me on a different branch than I expect.

Pierre-Yves David pierre-yves.david at ens-lyon.org
Wed Jan 22 00:36:41 UTC 2014


On Wed, Jan 22, 2014 at 12:18:05AM +0000, Kannan Goundan wrote:
> Our workflow involves creating new branches for bug fixes.  As we work on
> the branch, we use "rebase" to keep the branch up to date.  The exact
> command we use:
> 
>   hg up bugfix
>   hg rebase --keepbranches --dest default
> 
> In Mercurial 2.7.2 and earlier, this sequence would leave me on the "bugfix"
> branch.  In Mercurial 2.8 and 2.8.2, this sequence leaves me on "default".
> 
> The upgrade notes for 2.8 had a bullet point that I thought could be related:
> 
>   rebase: preserve working directory parent (BC)
> 
> However, the following mailing list post makes it seem like "rebase" should
> still work like I expected it to:
> 
>   http://selenic.com/pipermail/mercurial-devel/2013-October/054320.html
> 
>   "If you were at the tip of the to-be-rebased branch, this
>    changeset will leave you at the top of the rebased result.
>    So the most common case is not affected by this changes."

Rebase should keep behaving the way you expect.

> Am I mistaken about how Mercurial 2.8 should behave, or is this a bug?
> 
> For completeness, here's the script I used to test this:
> 
>   #! /bin/bash
>   set -e
> 
>   mkdir repo
>   cd repo
>   hg init
> 
>   # 1. Make a commit in 'default'.
>   echo "Hi!" > ReadMe.txt
>   hg add ReadMe.txt
>   hg commit -m "ReadMe"
> 
>   # 2. Make a commit in the 'bugfix' branch.
>   hg branch bugfix
>   echo "Hello." > ReadMe.txt
>   hg commit -m "ReadMe: more formal."
> 
>   # 3. Make a second commit in 'default'.
>   hg up default
>   echo "whatever" > License.txt
>   hg add License.txt
>   hg commit -m "License"
> 
>   # 4. Switch to 'bugfix' branch, rebase its commits.
>   hg up bugfix
>   hg rebase --keepbranches --dest default
> 
>   # 5. See what branch we're on.
>   # - Mercurial 2.7 says "bugfix"
>   # - Mercurial 2.8 says "default"
>   hg branches

Note: you want `hg branch` here. (to see the current branch). `hg branches` list all available branch.

Running this script show it works fine on 2.9-rc, 2.8.2, 2.8

Can you double check on your side ?

-- 
Pierre-Yves
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20140122/013043de/attachment.asc>


More information about the Mercurial mailing list