[Zope-dev] Hg mirror available

Wolfgang Schnerring ws at gocept.com
Fri Jun 19 01:43:43 EDT 2009


Hi there,

* Sidnei da Silva <sidnei.da.silva at gmail.com> [2009-06-18 14:28]:
> > I'm asking because I noticed that basically all SVN->DVCS conversion
> > tools (hg convert, git-svn, bzr svn-import, svn2bzr, svn-fast-export.py,
> > svn-all-fast-export.cpp) do not convert the history properly, more
> > precisely, history that happened on branches is lost:
> 
> Here's some context about this from one of the Bazaar developers, John
> Arbash Meinel. Hopefully that will solve some of your questions?

Thanks for relaying!
 
> I'm not really sure what he means by "edit" and then "merge" without a
> commit inbetween. So I'm assuming there is one.

Sorry for being overly brief in my description; please find below a
sample shell script to set up a Subversion repository with a project
containing a trunk and a branch. To reproduce the problem I'm
concerned about, do this:

$ create-repos.sh repos
$ svn log repos/project/trunk/feature.txt
------------------------------------------------------------------------
r9 | wosc | 2009-06-18 17:11:46 +0200 (Thu, 18 Jun 2009) | 1 line

merged feature1
------------------------------------------------------------------------
r8 | wosc | 2009-06-18 17:11:43 +0200 (Thu, 18 Jun 2009) | 1 line

implemented feature1
------------------------------------------------------------------------

As you can see, Subversion reports the history of the file that
happenened on the branch (in r8).

After converting the repository, however...

$ bzr init-repo repos-bzr
$ cd repos-bzr
$ bzr svn-import file://$PWD/../repos
$ bzr log repos/project/trunk/feature.txt
------------------------------------------------------------
revno: 3
svn revno: 9 (on /project/trunk)
committer: wosc
timestamp: Thu 2009-06-18 14:11:46 +0000
message:
  merged feature1

... this history is lost. Not only does it not appear in the log
output, also when looking at bzr visualize it seems like that branch
never existed at all in bzr. (I'm new to bzr, am I missing something
here?)

> Now, what really matters is whether or not *Subversion* recorded 4
> correctly, such that it can actually see that it was a merge from 3.
> My understanding is that before svn 1.5 that isn't possible.

My understanding is quite different. ;-)
As far as I know, SVN "always" has recorded the history of a file
across copies and merges, and so I'm quite sure this has nothing to do
with 1.5-style merge tracking. I won't try to track down a reference
on that right now, but I'm currently reading up on SVN's APIs so I
expect to find the answer there, anyway.

> I'm pretty sure SVN represents (4) as not a *merge* but as an indentical
> commit.

As I said, I'm still digging through the SVN APIs, so unfortunately I
don't have a concrete answer, but I know positively that this history
information is readily available, which you can see by passing
--verbose to 'svn log':

$ svn log -v -c 9 repos
------------------------------------------------------------------------
r9 | wosc | 2009-06-18 17:11:46 +0200 (Thu, 18 Jun 2009) | 1 line
Changed paths:
   M /project/trunk
   A /project/trunk/feature.txt (from /project/branches/feature1/feature.txt:8)
                     >>>>>>>>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   M /project/trunk/foo.txt

merged feature1
------------------------------------------------------------------------

Wolfgang


**

#!/bin/sh

if [ $# -lt 1 ]; then
  echo 1>&2 "Usage: $0 repos-path"
  exit 1
fi

set -e

mkdir $1
repos=$(cd "$1" && pwd)
rmdir $1

working=$(tempfile)
rm $working
mkdir $working

svnadmin create $repos
svn mkdir file://$repos/project -m "creating project home"
svn mkdir file://$repos/project/trunk -m "creating trunk"
svn mkdir file://$repos/project/branches -m "creating branches"
svn mkdir file://$repos/project/tags -m "creating tags"
svn co file://$repos/project/trunk $working
cd $working

mkdir alpha
echo "foo" > foo.txt
echo "bar" > alpha/bar.txt
svn add foo.txt alpha
svn commit -m "initial version"

svn cp file://$repos/project/trunk file://$repos/project/tags/0.1 -m "tagging 0.1"

svn cp file://$repos/project/trunk file://$repos/project/branches/feature1 -m "creating branch 1"
svn switch file://$repos/project/branches/feature1
echo "qux" > foo.txt
echo "feature1" > feature.txt
svn add feature.txt
svn commit -m "implemented feature1"

svn switch file://$repos/project/trunk
svn merge file://$repos/project/branches/feature1
svn commit -m "merged feature1"
svn rm file://$repos/project/branches/feature1 -m "remove branch after merge"

svn cp file://$repos/project/trunk file://$repos/project/tags/0.2 -m "tagging 0.2"

svn cp file://$repos/project/trunk file://$repos/project/branches/feature2 -m "creating branch 2"
svn switch file://$repos/project/branches/feature2
echo "feature2" >> feature.txt
svn commit -m "implemented feature 2"

rm -rf $working


More information about the Zope-Dev mailing list