Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial how to create patch for one file in repo

I have a file called some/work/file.py in my repo.

I have been working in the repo (on other files too besides file.py) and committing my changes and have gone from revision 20 to 30.

How would I create a patch for only file.py from revisions 20 to 30 without including the other files?

Something like:

hg export 20:30 file.py > new.patch

Have tried the command but does not work.

Thank you

like image 482
Neeran Avatar asked May 09 '12 09:05

Neeran


1 Answers

hg export exports individual changesets as separate entities.

If I understand you correctly, you need an answer to the question “What changes were made to file.c between revision 20 and revision 30?”, i.e. you need only need one diff file.

Here’s how you can do it:

hg diff file.c -r 20:30 > new.diff

As a more versatile approach, you can use -I (include file pattern) / -X (exclude).

like image 84
Helgi Avatar answered Oct 15 '22 09:10

Helgi