Nathan Lee
Nathan Lee

Reputation: 2231

Removing file from Mercurial MQ Patch

I have large MQ patch applied in Mercurial. What has happened is I have done qrefresh and included files in my patch that I do not want to include. Is there a way to remove the changes to these file from my patch with out manually editing it? In this case if I was just working without MQ, all I would have to do is hg revert.

Upvotes: 35

Views: 6059

Answers (3)

TaiKor
TaiKor

Reputation: 476

With the patch applied:

hg qrefresh -X [file1] -X [file2] ... -X [fileN]

Will take out file1 to fileN of the patch. After completing that, type hg status to verify that the files are now marked as modified, and therefore not part of the patch any longer .

Upvotes: 46

durin42
durin42

Reputation: 1467

The easiest way to do this is to do hg qrefresh with all the files except the one you want to remove - that'll take the changes out of the patch without discarding them.

Upvotes: 1

Ry4an Brase
Ry4an Brase

Reputation: 78350

I think you can use make the patch the current patch (applied and at the top of the stack) and then hg forget and hg qrefresh.

And of course hg forget is just hg remove without requiring extra options to avoid file deletion.

Upvotes: 2

Related Questions