[Python-checkins] devguide (hg_transition): Advertise hg import over patch.

eric.araujo python-checkins at python.org
Sun Feb 27 04:17:06 CET 2011


eric.araujo pushed fe7bcebd13c9 to devguide:

http://hg.python.org/devguide/rev/fe7bcebd13c9
changeset:   329:fe7bcebd13c9
branch:      hg_transition
user:        ?ric Araujo <merwok at netwok.org>
date:        Sat Feb 26 17:28:32 2011 +0100
summary:
  Advertise hg import over patch.

hg import understands the extended git diff format, which supports renames,
changes to the executable bit and changes in binary files.  patch doesn?t
do anything useful with that information, and also requires downloading and
setup on Windows.

files:
  committing.rst
  faq.rst

diff --git a/committing.rst b/committing.rst
--- a/committing.rst
+++ b/committing.rst
@@ -103,7 +103,7 @@
 Python 3.2::
 
    hg update 3.2
-   patch -p1 < patch.diff
+   hg import --no-commit patch.diff
    # Compile; run the test suite
    hg commit
 
diff --git a/faq.rst b/faq.rst
--- a/faq.rst
+++ b/faq.rst
@@ -263,18 +263,15 @@
 
 If you want to try out or review a patch generated using Mercurial, do::
 
-   patch -p1 < somework.patch
+   hg import --no-commit somework.patch
 
 This will apply the changes in your working copy without committing them.
-If the patch was not created by hg (i.e., a patch created by SVN and thus lacking
-any ``a``/``b`` directory prefixes in the patch), use ``-p0`` instead of ``-p1``.
+If the patch was not created by Mercurial (for example, a patch created by
+Subversion and thus lacking any ``a``/``b`` directory prefixes in the patch),
+add ``-p0`` to the above command.
 
-.. note:: The ``patch`` program is not available by default under Windows.
-   You can find it `here <http://gnuwin32.sourceforge.net/packages/patch.htm>`_,
-   courtesy of the `GnuWin32 <http://gnuwin32.sourceforge.net/>`_ project.
-   Also, you may find it necessary to add the "``--binary``" option when trying
-   to apply Unix-generated patches under Windows.
-
+You can also use the ``patch`` program, but be aware that it does not
+understand the `extended diff format`_ used by Mercurial.
 
 If you want to work on the patch using mq_ (Mercurial Queues), type instead::
 
@@ -291,6 +288,7 @@
 
    hg qdelete somework.patch
 
+.. _extended diff format: http://www.selenic.com/mercurial/hg.1.html#diffs
 .. _mq: http://mercurial.selenic.com/wiki/MqExtension
 
 

--
Repository URL: http://hg.python.org/devguide


More information about the Python-checkins mailing list