Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I import a patch without touching the working directory?

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?

like image 279
Martin Geisler Avatar asked Dec 15 '11 14:12

Martin Geisler


2 Answers

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.

like image 129
Martin Geisler Avatar answered Sep 28 '22 00:09

Martin Geisler


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.

like image 41
Erwin Mayer Avatar answered Sep 28 '22 01:09

Erwin Mayer