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

Brett Cannon brett at python.org
Sun Feb 6 21:13:08 CET 2011


On Sun, Feb 6, 2011 at 08:15, Antoine Pitrou <solipsis at pitrou.net> wrote:
> 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).

Yeah, that is a perk of mq.

>
>>  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.

Well, I wouldn't say harder. We just choose one we like the most and
advocate that while stating upfront this is just one of many different
ways someone can choose to work.

>
> 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).

I would rather give people some simple workflow that has some benefit
over svn. Basically whatever is the easiest to comprehend and work
with should be what we start people with.

>
>>  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.

I prefer being explicit over implicit in the tutorial.


More information about the Python-Dev mailing list