Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6334845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:44:15+00:00 2026-05-24T18:44:15+00:00

Case 1: Updating the Working Directory $ hg update [-r REV] This switches the

  • 0

Case 1: Updating the Working Directory

$ hg update [-r REV]

This switches the working directory to the specified revision. However if my working directory has modified changes, the changes are merged back with REV. I realize I can use the -C flag to discard my changes but I am trying to put across my concern to the behavior of update command in different scenarios.

Case 2: Switching to a Branch

$ hg update <bname>

This switches my working directory to <bname> branch. However my uncommitted changes are not merged until I explicitly use the merge command.

Case 3: Updating pulled change sets from a Remote Repository

$ hg pull
$ hg update

This again merges my working directory with the change sets from the remote repository after a recent pull.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:44:16+00:00Added an answer on May 24, 2026 at 6:44 pm

    Mercurial 1.9.1

    It has to do with the relationships between changesets. If there is a direct path between the parent changeset of the working directory and the target changeset you’re updating to, Mercurial will try to transfer the changes in the working directory with a merge operation. So if the changeset you’re on is either a direct descendant or direct ancestor of the changeset you want to update to, it will usually work.

    In the following diagrams, letters represent branch names and the numbers are the sequential revision numbers. wd is the working directory.

    When Mercurial will merge uncommitted changes:

    • Update on the same branch:

      --A1----A3----A5---wd
         \          /
          A2------A4
      

      Above, changes have been made based on A5. If you update to A4, Mercurial will merge the uncommitted changes to transfer them.

      --A1----A3----A5---A6---wd
         \          /
          A2------A4
      

      Also, if there are additional changesets (such as A6) this will still work, because A4

    • Update to different branch (this time, updating to B4):

      --A1----A3----A5---wd
         \          /
          B2------B4
      

      Above, revisions 2 and 4 are on a different branch B, which has been recently merged back to branch A. Mercurial will also transfer uncommitted changes, because A5 and B4 are so closely related. And also:

      --A1----A3----A5---A6---wd
         \          /
          B2------B4
      
    • Likewise, when you pull new changes from the remote repo, usually they will be descendants of the changeset that is the parent of your working directory, so that provides the direct relation that makes the merge of uncommitted changes possible:

      --A1----A3----A5---A6---wd
         \          /     \
          A2------A4       A7---A8---A9   (A7 through A9 pulled)
      

    When Mercurial will not merge uncommitted changes:

    • Update on the same branch:

      --A1----A3----A5
         \          /
          A2------A4---A6---wd
      

      Above, changes have been made based on A6. If you update to A5, Mercurial will refuse, saying either “outstanding uncommitted changes” or “crosses branches”. This is because you’re trying to merge uncommitted changes from one head to another head, and they are (by definition) not ancestors or descendants of each other. The same occurs with named branches, of course:

      --A1----A3----A5
         \          /
          B2------B4---B6---wd
      

    Getting around it

    There’s a few different ways you can move your changes to a new parent when Mercurial won’t automatically try to merge the uncommitted changes:

    • Shelve the changes, update, then unshelve (manually handling conflicts).
    • Making a patch in MQ will do the same thing, as shelving uses the same patches, just not a queue of them. You’ll refresh the patch, pop it, update to the other branch, and then push the patch (manually handling conflicts).
    • Commit the changeset, rebase it to the other branch (you will have to go through a merge process), and then import it into MQ so that it isn’t a changeset anymore but a patch.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update: I did get this working, here is the new javascript: $(document).ready(function() { $('a').click(
Case Currently I'm working on database seeding script, executed with sqlcmd . For example
I'm working updating some legacy code that does not properly handle user input. The
I have a case of updating the target table where source columns data not
EDIT: the IIRF.ini code was not the problem in this case, the performance issues
This requirement has come up due to an invitation feature where an existing '
I am working on an NHibernate project and have a question regarding updating transient
I am using ObjectDataSource to Bind and update the grid .It is working fine
I swear this was just working fine a few days ago... elm = document.querySelectorAll(selector);
I was working on a servlet that will generate a unique code and update

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.