Unshelving across branches performs unwanted merge

To reproduce:

  1. Shelve an uncommitted change on a branch.
  2. Update to another branch.
  3. Unshelve the change you shelved.

What should happen: The shelved changes should be applied to the new branch, and that's all.

What happens: The shelved changes are applied, but any differences between the first and second branch are also applied, effectively doing an unwanted merge.

None of the hgattic documentation discusses what's expected behavior when unshelving to a different branch, but my co-workers and I often need to move uncommitted changes to another branch, and the Shelve command is very unpredictable. We work around it by:

  1. Creating a patch with the uncommitted changes
  2. Revert all.
  3. Update to the other branch.
  4. Apply the patch.

However, SourceTree's interface for using shelves is much more intuitive and convenient than using patches, and we'd much rather use shelves if they did what we want.

1 answer

1 accepted

This widget could not be displayed.

Hi Dan,

If this is in Mercurial this is due to a bug in the shelve extension we use from Mercurial. We've actually got a planned bugfix on this front but no-one had reported it until now. You're right that this is completely the wrong behaviour, it should only unshelve the changes that are in the shelved changeset.

We're planning on moving away from hgattic for a number of reasons, one being for partial shelving and the other to fix this bug.

Thanks for listing the workaround, I'll make sure I take note if anyone asks in the meantime. We'll look at getting this in sooner than we planned as it's extremely difficult to fix if you do apply the shelve.

The related issues on JIRA are https://jira.atlassian.com/browse/SRCTREE-1460 and https://jira.atlassian.com/browse/SRCTREE-1375 currently scheduled for 1.7 but I'll squeeze these into a 1.6.x release instead.

Thanks for the information

Thanks, Kieran! This will have a huge benefit for our team of 20 engineers.

Hi guys, is there already a time line for this fix? The Patch workaround doesn't work either because patching is broken.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

871 views 2 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you