[pypy-svn] r79666 - pypy/extradoc/planning/hg-migration

antocuni at codespeak.net antocuni at codespeak.net
Tue Nov 30 13:27:23 CET 2010

Author: antocuni
Date: Tue Nov 30 13:27:19 2010
New Revision: 79666

   pypy/extradoc/planning/hg-migration/merge-howto.txt   (contents, props changed)
instructions to merge existing svn branches once we migrate to hg

Added: pypy/extradoc/planning/hg-migration/merge-howto.txt
--- (empty file)
+++ pypy/extradoc/planning/hg-migration/merge-howto.txt	Tue Nov 30 13:27:19 2010
@@ -0,0 +1,69 @@
+.. -*- mode: rst -*-
+How to merge existing SVN branches in mercurial
+This document applies to branches that:
+  1. already existed in svn before the mercurial migration
+  2. contains one or more "merge from trunk" done in svn
+If the branch does not contain any "merge from trunk", the merging should be
+straightforward (i.e., you just get "real" conflicts).
+The problem with "merge from trunk" is that mercurial does not know that we
+have already applied a set of changes in our branch, so it tries to redo them
+and we get false conflicts.
+To solve, we need to explicitly tell mercurial that trunk has already been
+merged into our branch up to the right revision:
+  1. first of all, we need to find the SVN revision which contains the last
+     merge from trunk: when doing the actual merge, mercurial will apply only
+     the changes that happened on trunk from this point on. Let's call it
+     ``SR`` (Svn Revision).
+  2. we need to find the mercurial node that corresponds to ``SR``: see the
+     next section for how to do it. Let's call it ``HR`` (Hg Revision)
+  3. switch to the branch in mercurial::
+         $ hg up -r my-branch
+  4. perform a "dummy merge": this just tells mercurial that all the changes
+     up to revision ``HR`` has been already merged into the branch::
+         $ hg --config ui.merge=internal:local merge HR
+  5. update to ``default`` (i.e., the equivalent of svn trunk) and merge the branch::
+         $ hg up -r default
+         $ hg merge my-branch
+         $ hg ci -m 'merged my-branch'
+How to find the ``HR`` corresponding to ``SR``
+If we want to do it manually, we can use this command::
+    $ hg log --template '{node|short} {extras}\n' | less
+This will print a line for each changeset, showing the mercurial hash and a
+string which among other things contains the SVN revision. We want to pick the
+changeset with the highest svn revision number which is less than the target
+Alternatively, we can use the svnup_ mercurial extension. We need to put these
+lines into ``~/.hgrc``::
+    [extensions]
+    svnup = /path/to/svnup.py
+Then, we can just use the ``svnfind`` command to find the changeset we are looking for::
+    $ hg svnfind -r 79389
+    changeset:   39199:f96e54f36e15
+    user:        Maciej Fijalkowski <fijall at gmail.com>
+    date:        Tue Nov 23 07:02:43 2010 +0000
+    summary:     Comment out non-jit builds to not overload the server
+.. http://codespeak.net/svn/user/antocuni/hg-conversion/svnup.py

More information about the Pypy-commit mailing list