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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:58:19+00:00 2026-05-18T08:58:19+00:00

Scenario: I’ve inherited a program, kept under Mercurial, that only works on my system

  • 0

Scenario: I’ve “inherited” a program, kept under Mercurial, that only works on my system with specific tweaks to certain files that are checked in. I do not want to check these tweaks in.

My most recent solution to this is to create a mercurial patch file (hg diff > patchfile) containing these tweaks; when I need to check in my changes, I’ll just reverse-apply the patch, commit, and re-apply the patch. (If I had full control of the source, I’d just move all these little tweaks to a single configuration file that isn’t under version control, putting a “sample” config file under version control)

Unfortunately, it seems that while the GNU patch command supports the --reverse flag, it does not support hg’s multi-file diff format as a single patch file (or maybe it does, and I just don’t know the switches for it?). OTOH, hg has its own patch command that can apply the diff, but that doesn’t support any kind of reverse flag.

So my question is twofold:

  1. How should this be done in mercurial? Surely hanging on to a “tweak patch” isn’t the only way to handle this situation. Maybe mercurial has a plugin or something built in for such temporary, uncommittable changes.
  2. Aside from how things should be done, is there any way to reverse-apply such a mercurial diff-patch to a mercurial repo like this? There are other situations where such functionality would be useful.
  • 1 1 Answer
  • 1 View
  • 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-18T08:58:19+00:00Added an answer on May 18, 2026 at 8:58 am

    Mercurial’s patch command (really import) doesn’t support reverse, but hg diff does. Use --reverse on that and you’ll have a reversed patch that Mercurial can apply.

    However, what you’re describing is a very common vendor-branch style workflow, which mercurial can better support using features other than diff and patch.

    Specfically, Mercurial Queues does exactly what you want.

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

Sidebar

Related Questions

Scenario: UserControl that has a read-only TextBox and a Button. TextBox.Text is modified and
Scenario 1 (That Works) This is a POC i created. I have a script
Scenario: Most smartphones have a high resolution camera that generates photos that may range
Scenario: I've hundreds of applications instances running on client machines doing a certain job.
Scenario: I am calling a function that returns a field that the user enters
Scenario: An MVC3 app that uses constructor injection to provide services for a given
Scenario: Windows server in a AD domain hosting a Subversion repository using SVNSERVE only
Scenario: I have several services that I want to be discovered by different clients.
Scenario I have a TreeView that is bound to ObservableCollection<T> . The collection gets
Scenario: You have an ASP.Net webpage that should display the next image in 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.