[Python-Dev] devguide: Basic instructions on how to generate a patch with hg for non-committers.

Antoine Pitrou solipsis at pitrou.net
Sun Feb 6 17:15:42 CET 2011


On Sun, 06 Feb 2011 02:10:15 +0100
brett.cannon <python-checkins at python.org> wrote:
>  
>  To create your patch, you should generate a unified diff from your checkout's
>  top-level directory::
>  
> -    svn diff > patch.diff
> +    hg outgoing --path > patch.diff

Should be --patch.
The problem is that it will show one several patch per changeset, which
is normally not what you want (it's a pity "hg out" doesn't have an
option to collapse them all).

>  If your work needs some new files to be added to the source tree, remember
> -to ``svn add`` them before generating the patch::
> +to ``hg add`` them before generating the patch::
>  
> -   svn add Lib/newfile.py
> -   svn diff > patch.diff
> +   hg add Lib/newfile.py
> +   hg outgoing --patch > patch.diff

You should commit before using "outgoing", otherwise the added file is
not in the repo (and therefore not in the patch).

The problem with hg (and other DVCSes) is that allows for *several*
local workflows, and therefore it's harder to advocate one of them in
such tutorial docs. I wonder what Georg and Dirkjan suggest.

We could perhaps present SVN-like "work in the working copy" workflow
(without local commits), and let seasoned hg users choose other
workflows they like more (they don't need our help anyway).

>  To undo a patch, you can revert **all** changes made in your checkout::
>  
> -    svn revert -R .
> +    hg revert --all
> +

Or "hg revert -a", which is nicer to type.





More information about the Python-Dev mailing list