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

Kannan Goundan kannan at cakoose.com
Wed Jan 22 00:18:05 UTC 2014


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

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





More information about the Mercurial mailing list