A patch file is a single file annotating the changes between two versions of one or more text files. By "applying" a patch, you can update a set of text files from an older version to a newer version. Developers often use patch files to make their changes available to other developers.
These files are also called diffs, as they were traditionally generated by the 'diff' program. While there are many different formats for patch files, the most common is the unified diff format.
Mercurial can generate patch files in the unified diff format with the hg diff command.