Normally, Mercurial will abort if I have a dirty working copy when I try to import a patch:
$ hg import x.patch
abort: outstanding uncommitted changes
Is it possible to import it anyway?
With Mercurial 1.9, you can use hg import --bypass
to apply a patch without touching the working copy. The patch will be applied on the working copy parent revision by default. Use the --exact
flag to apply the patch onto the changeset mentioned in the patch header instead.
If you are using TortoiseHg, you can use Repository > Import
, then specify that the patch should be imported to Shelf
and finally in the shelf, move the changes to the dirty working repository as you would with any other shelved patch.
I'd love to be able to make right click > "copy patch" in a source repository, then in a cloned repository, right click and "paste patch", hopefully this feature will be implemented in a future version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With