Can I import a patch without touching the working directory?

末鹿安然 提交于 2020-01-02 02:05:33

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/8521793/can-i-import-a-patch-without-touching-the-working-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!