When I want to create a patch from uncommitted changes, do I really have to first commit? Does TortoiseHg not allow creating a patch without performing a commit?
TortoiseHg 2.0.2: in workbench you can right-click on the Working Directory
line and select Export
/ Copy patch
from the contextual menu - the resulting diff will be placed in clipboard.
Of course, you won't have the changeset header and the commit message at the beginning of the patch like you will get from the same operation made on a commit:
# HG changeset patch
# User John Doe <[email protected]>
# Date 1300889184 -7200
# Node ID 0050250004150030450034543labc23598235325
# Parent 098140937509174fbca7089686d986986e06f097
Sample commit message ...
Thanks to xanatos:
You can enable the "git format" for diffs (that include binary data) in the workbench: File->Settings->Compare->Git Format = True (the default value is unspecified, that seems to be equal to False)
Is hg diff -g
what you are looking for?
Taken from "How can I diff and patch files?" of https://developer.mozilla.org/en/Mercurial_FAQ
for a single file in your workbench (tortoisehg), you click on you working directory and the in the file list pane, right click on the file, and as @alexandrul said click Copy Patch
Although that feature has been requested for a long time, TortoiseHg still doesn't offer a direct way to do that as of 6.4.2 (2023).
You can however use the Working Directory line's contextual menu to select Export
-> Copy patch
then paste the resulting diff from the clipboard to a new file (using a text editor such as Notepad).
Be aware that:
- such patches will exclude binary file diffs, unless Git Format is enabled. Git Format can be enabled in File->Settings, in the Diff tab. (Thanks alexandrul and xanatos)
- such patches will exclude new files, even if they are selected. This can be worked around by scheduling these for addition.
- non-ASCII characters in file contents may be misencoded. This can be worked around by using the command line instead (
hg diff
). Alternatively, the gratis Atlassian Sourcetree also offers to create patches, graphically. Despite what the website suggests, it does support Mercurial, although it's proprietary.
© 2022 - 2024 — McMap. All rights reserved.