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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:07:57+00:00 2026-06-05T20:07:57+00:00

I need some function ‘apply_patch’: result_string = apply_patch(‘origin_file.txt’, ‘origin_file.txt.patch’) or some commands (for windows

  • 0

I need some function ‘apply_patch’:

result_string = apply_patch('origin_file.txt', 'origin_file.txt.patch')

or some commands (for windows and linux):

if linux:
    result_string = os.system('linux_patch --apply origin_file.txt origin_file.txt.patch')
elif windows:
    result_string = os.system('windows_patch --apply origin_file.txt origin_file.txt.patch')

Helpful information: I use mercurial as version control system

  • 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-06-05T20:07:58+00:00Added an answer on June 5, 2026 at 8:07 pm

    Check the utility patch. It does what are you expecting to. Assuming you are in the root directory of the project, you can try:

    $ patch --dry-run < file.diff
    

    –dry-run will tell you whether the patch applies or not, without really applying it. Eventually you will have to use the option -p n to let patch know to remove directories from the path (look at the header of the diff file).

    If the patch was already applied, the utility will ask you if you would like to reverse the patch.

    With mercurial you can also try ‘hg import‘. If you need it for your program, then you can import the respective modules from mercurial.

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

Sidebar

Related Questions

I need some pointer crafting an MS-DOS batch function to advance the system calendar
How to change HTML background with JavaScript Function? I need some simple function to
I need some examples of implementing curry function in ruby(1.8.6 or 1.8.7 not 1.9).
I need some help on the SimpleXML calls for a recursive function that lists
I really need some help in Regular Expressions, i'm working on a function like
I have HTML + CSS text. I need some lib with simple function like
I am beginner in python, and I need to use some thirdparty function which
Need to call a filter function on some options based on a radio selected
I need to make some part of text bold while displaying in jquery: $(':checked').each(function()
Using C#, I need to do some extra work if function A() was called

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.