diff --git a/committing.rst b/committing.rst --- a/committing.rst +++ b/committing.rst @@ -394,31 +394,35 @@ ported without any modifications. -Porting Between Major Versions -'''''''''''''''''''''''''''''' +Porting changesets between the two major Python versions (2.x and 3.x) +---------------------------------------------------------------------- -Let's say you have committed your changes as changeset ``a7df1a869e4a`` -in the 3.3 branch and now want to port it to 2.7. This is simple using -the "graft" command, which uses Mercurial's merge functionality to -cherry-pick:: +Assume you just committed something on ``2.7``, and want to port it to ``3.2``. +You can use ``hg graft`` as follow:: - hg update 2.7 - hg graft a7df1a869e4a - # Compile; run the test suite + cd ../3.2 + hg graft 2.7 -Graft always commits automatically, except in case of conflicts, when you -have to resolve them and run ``hg graft --continue`` afterwards. +This will port the latest changeset committed in the 2.7 clone to the 3.2 clone. +``hg graft`` always commits automatically, except in case of conflicts, when +you have to resolve them and run ``hg graft --continue`` afterwards. +Instead of the branch name you can also specify a changeset id, and you can +also graft changesets from 3.x to 2.7. -Another method is using "export" and "import": this has the advantage that -you can run the test suite before committing, but the disadvantage that -in case of conflicts, you will only get ``.rej`` files, not inline merge -markers. :: +On older version of Mercurial where ``hg graft`` is not available, you can use:: - hg update 2.7 - hg export a7df1a869e4a | hg import --no-commit - - # Compile; run the test suite - hg commit + cd ../3.2 + hg export 2.7 | hg import - +The result will be the same, but, in case of conflict this will create ``.rej`` +files rather than using Mercurial merge capabilities. + +A third option is to apply manually the patch on ``3.2``. This is convenient +when there are too many differences with ``2.7`` or when there is already a +specific patch for ``3.2``. + +.. warning:: + Never use ``hg merge`` to port changes between 2.x and 3.x (or vice versa). Using several working copies ''''''''''''''''''''''''''''