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

  • Home
  • SEARCH
  • 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 6219199
In Process

The Archive Base Latest Questions

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

I have a repository and am using mq patch queue for unfinished changes. The

  • 0

I have a repository and am using mq patch queue for unfinished changes. The patch queue is also under version control.

Let’s say I have 2 patches p1 and p2 (applied in that order). Now I make a change on p1:

hg qnew p1
...
hg qnew p2
...
hg qref
hg com --mq -m"(Commit before reject)"
hg qpop p1
{make change}
hg qref
hg qpush -a

… and p2 fails to apply.

The standard way would now be to apply the rejected hunks manually. I
want to use something like MqMergePatch which is nice and uses the merge of
mercurial—but it is based on the deprecated feature:

hg qsave // deprecated: use "hg rebase" instead

My question is: how to do it with hg rebase?

EDIT

After having seen the log of the repository, I do not like at all what MqMergePatch does to it. My main goal in using patches is to have the repository’s history clean, and not scattered with useless details.

  • 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-24T07:44:18+00:00Added an answer on May 24, 2026 at 7:44 am

    The suggestion to use hg rebase is misleading, I think. The MqMergePatch page says it is a modification of MqMerge, which was a technique for rebasing a series of patches on top of new changesets pulled from elsewhere.

    However, it involves saving a copy of the patch queue already applied (that’s really all hg qsave does) and using the saved copy as part of the reference for a 3-way merge that effects a patch queue rebase. I used to do that myself before I enabled the rebase extension. Then it was simply a matter of rebasing the first patch on top of the tip changeset I wanted to be its new parent.

    That’s not what you want though, because what you want is to basically rebase a patch on top of a patch that you changed. The patch queue is linear, though, and you can only rebase a patch if the changeset onto which it has been applied has other children parallel to the patch queue:

    --- A -------- patch1 --- patch2
         \
          \-- B
    

    In the above situation, the patch queue could be rebased on B with hg rebase easily enough (thus the suggestion to use hg rebase), but that has nothing to do with your situation.

    An approach to your situation

    Here’s an applied patch with unsaved local changes that will conflict with an unapplied patch:

    --- A --- patch1           <patch2>
                 \
                  \-- [changes]
    

    Usually I bite the bullet and handle rejections manually since they are usually few. I find that if I have a situation where there are too many rejections to handle manually, I was probably not organizing them properly in the first place.

    If the technique using qsave and qpush -m and so on is preferable to the following to you, it is unlikely that qsave will be removed any time soon, even though it is deprecated.

    Here is how I would handle the above situation if I really wanted to take advantage of 3-way merge tools:

    (TortoisHg 2.x doesn’t let us rebase patch queues yet, so this is a variant of the finish-rebase-import that I sometimes do.)

    • Instead of qrefresh, use qnew to make the unsaved changes a new patch:

      --- A --- patch1 --- patch1b        <patch2>
      
    • Finish these patches into regular changesets:

      --- A --- B --- C        <patch2>
      
    • Update to the changeset to which patch will apply cleanly (B), and apply the patch:

      --- A --- B --- patch2
                 \
                  \-- C
      
    • Rebase patch2 atop C so that 3-way merge is used to resolve conflicts between local patch2 and other C using base B:

      (I would have to do this in TortoiseHg 2.x by finishing patch2 before rebasing, then importing it back into the queue.)

      --- A --- B --- C --- patch2
      
    • Import B and C into the queue as patches again:

      --- A --- patch1 --- patch1b --- patch2
      
    • Pop patch2 and patch1b and then fold patch1b into patch1 (renamed as patch1new):

      --- A --- patch1new       <patch2>
      

    Now patch2 will apply cleanly to patch1new.

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

Sidebar

Related Questions

I have created my own repository under my hard disk using Apache Server and
I have someone connecting to my repository using the url (substituted the IP address):
I have to delete a versioned file my bzr repository using bzr remove command.
I'm using Visual SVN on my Windows Box. I have Repository Application , which
I have a git repository which tracks an svn repository. I cloned it using
I have an MVC-based site, which is using a Repository/Service pattern for data access.
I'm working on a new project and I'm using the repository pattern, I have
I am using a simple repository pattern and have objects with a LazyList such
I have implemented a DAL using Rob Conery's spin on the repository pattern (from
I am using an SVN repository for my web development work. I have a

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.