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 1107279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:54:54+00:00 2026-05-17T01:54:54+00:00

I’ve been using Mercurial for a few weeks now and don’t understand why when

  • 0

I’ve been using Mercurial for a few weeks now and don’t understand why when Mercurial comes to merge committed changes from two repositories it does it in the working copy?

Surely the merge could happen without the use of the working copy removing the need to shelf changes etc.

It just doesn’t seem necessary to involve the working copy. Am I missing something?

  • 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-17T01:54:54+00:00Added an answer on May 17, 2026 at 1:54 am

    There is only one working copy per repository, by definition:

    The working directory is the top-level directory in a repository, in which
    the plain versions of files are available to read, edit and build.

    Unless your file system descends from Schrödinger’s cat, you cannot have two versions of the same file at the same time, thus you cannot have two working copies.

    Nevertheless, it’s indeed theoretically possible to use something like a ephemeral clone (per @Ry4an) to act as the working copy of a merge, resolve conflicts there, commit, then make it disappear. You’d get a beautiful merge changeset and your intact working copy.

    I can think of several ways to achieve this:

    1. Petition hg team to do it in core
    2. Write an extension to implement the ephemeral clone or some other way
    3. Shelve with a temporary changeset
    4. Shelve with MQ

    I would strongly recommend #4, as I would for almost all workflow scenarios. It took me a few good days to grok MQ, but once I did I’ve never had to turn back.

    In an MQ workflow, your working copy is always the current patch. So for the merge situation you would do:

    1. hg qrefresh
    2. hg qpop -a
    3. hg update -r<merge first parent>
    4. hg merge [-r<merge second parent>]
    5. hg commit
    6. hg update qparent
    7. hg qgo <working copy patch>

    You don’t have to pop all patches in #2. I always do that whenever I need to deal with real changesets to avoid mixing them up with patches.

    Solution #3 is really the same as #4, since a patch is a temporary changeset by definition (this is really the only thing you need for understanding MQ). It’s just different commands:

    1. hg commit -A
    2. hg update -r<merge first parent>
    3. hg merge [-r<merge second parent>]
    4. hg commit
    5. hg update -r<working copy changeset parent>
    6. hg revert -a -r<working copy changeset>
    7. hg strip <working copy changeset>

    If you want to keep the working copy changeset and continue to commit, simply update to it in #5.

    From your question it seems like you already know #4 but don’t like shelving. I think shelving is good because merging is a fundamentally different task than coding (changing working copy), and shelving makes the context switch explicit and safe.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm looking for suggestions for debugging... If you view this site in Firefox or
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.