[Python-checkins] devguide: Add a FAQ about splitting files.

ezio.melotti python-checkins at python.org
Tue Mar 29 21:42:10 CEST 2011


http://hg.python.org/devguide/rev/2903907665c1
changeset:   406:2903907665c1
user:        Ezio Melotti
date:        Tue Mar 29 22:42:03 2011 +0300
summary:
  Add a FAQ about splitting files.

files:
  faq.rst |  18 ++++++++++++++++++
  1 files changed, 18 insertions(+), 0 deletions(-)


diff --git a/faq.rst b/faq.rst
--- a/faq.rst
+++ b/faq.rst
@@ -382,6 +382,24 @@
 the file(s) to your local repository.
 
 
+What's the best way to split a file into several files?
+-------------------------------------------------------------------------------
+
+To split a file into several files (e.g. a module converted to a package or a
+long doc file divided in two separate documents) use ``hg copy``::
+
+    hg copy module.rst module2.rst
+
+and then remove the parts that are not necessary from ``module.rst`` and
+``module2.rst``.  This allows Mercurial to know that the content of
+``module2.rst`` used to be in ``module.rst``, and will make subsequent merges
+easier.  If necessary, you can also use ``hg copy`` several times.
+
+If you simply create ``module2.rst``, add it with ``hg add``, and copy part of
+the content from ``module.rst``, Mercurial won't know that the two file are
+related.
+
+
 .. _hg-commit:
 
 How do I commit a change to a file?

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


More information about the Python-checkins mailing list