Apply patches in branch
Asked Answered
N

3

9

I receive a patches from a contributor. Apparently, he produces the patches in trunk. However, I would like to commit his changes to a new branch. May I know how I can do so through Tortoise-Hg?

Nazar answered 26/4, 2011 at 13:38 Comment(0)
K
12

The directions found below assume you want the patches isolated on a named branch.

Using the command-line, it is easy to apply patches to a new named branch. However if you want to do this using TortoiseHg only, you must create the named branch with an empty commit prior to applying the patches.

Using the command-line:

hg branch <branch name>
hg qimport --push <patch-file-1>
hg qimport --push <patch-file-2>
hg qfinish --applied

Using TortoiseHg v1.1.x:

  1. Import the patch files to your patch queue (without applying them).
  2. Create a new named branch using an empty commit:
    • Open a commit dialog
    • Click the button labeled "branch: default"
    • Select "Open a new named branch"
    • Enter your branch name in the provided text box
    • Click the OK button.
    • Enter a commit message (e.g. "Created branch for patches from ") and click "Commit".
  3. Apply the patches in your patch queue (one at a time or all together).
  4. Right-click on the patches in your patch queue and select "Finish Applied"

Using TortoiseHg v2.0.x:

The same process used for TortoiseHg v1.1.x will work. The process to create the named branch with an empty commit is slightly different, but the overall concept is the same.

Kyser answered 26/4, 2011 at 14:52 Comment(2)
Apparently it is also possible to hg branch <branch name> on the command line, and then apply the patches through TortoiseHg, if you are more comfortable with that.Willson
TortoiseHg v2.0: You don't have to make an empty commit. Just apply the patch, then change the button to QRefresh and you can change the branch in the usual way.Misanthropy
E
3

In TortoiseHg 2.7, update to the branch you want to apply the patch to (or create it if it doesn't exist). Choose Repository > Import and use Browse... to select an individual patch file, or Browse Directory... to import a folder of patches.

Elbertelberta answered 23/5, 2013 at 8:55 Comment(1)
+ 1 Worked perfectly and so simpleSora
C
1

The original branch from where the patch came from doesn't matter to hg import unless you use the option --exact. So, you should create the branch you want and apply the patch:

hg branch new_branch
hg import /tmp/patch.txt
Chest answered 23/5, 2013 at 14:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.