git-svn: add --follow-parent and --no-metadata options to fetch
--follow-parent:
This is especially helpful when we're tracking a directory
that has been moved around within the repository, or if we
started tracking a branch and never tracked the trunk it was
descended from.
This relies on the SVN::* libraries to work. We can't
reliably parse path info from the svn command-line client
without relying on XML, so it's better just to have the SVN::*
libs installed.
This also removes oldvalue verification when calling update-ref
In SVN, branches can be deleted, and then recreated under the
same path as the original one with different ancestry
information, causing parent information to be mismatched /
misordered.
Also force the current ref, if existing, to be a parent,
regardless of whether or not it was specified.
--no-metadata:
This gets rid of the git-svn-id: lines at the end of every commit.
With this, you lose the ability to use the rebuild command. If
you ever lose your .git/svn/git-svn/.rev_db file, you won't be
able to fetch again, either. This is fine for one-shot imports.
Also fix some issues with multi-fetch --follow-parent that were
exposed while testing this. Additionally, repack checking is
simplified greatly.
git-svn log will not work on repositories using this, either.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 10:39:13 +08:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2006 Eric Wong
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='git-svn --follow-parent fetching'
|
|
|
|
. ./lib-git-svn.sh
|
|
|
|
|
|
|
|
test_expect_success 'initialize repo' "
|
|
|
|
mkdir import &&
|
|
|
|
cd import &&
|
|
|
|
mkdir -p trunk &&
|
|
|
|
echo hello > trunk/readme &&
|
|
|
|
svn import -m 'initial' . $svnrepo &&
|
|
|
|
cd .. &&
|
|
|
|
svn co $svnrepo wc &&
|
|
|
|
cd wc &&
|
|
|
|
echo world >> trunk/readme &&
|
2007-02-13 08:33:37 +08:00
|
|
|
poke trunk/readme &&
|
git-svn: add --follow-parent and --no-metadata options to fetch
--follow-parent:
This is especially helpful when we're tracking a directory
that has been moved around within the repository, or if we
started tracking a branch and never tracked the trunk it was
descended from.
This relies on the SVN::* libraries to work. We can't
reliably parse path info from the svn command-line client
without relying on XML, so it's better just to have the SVN::*
libs installed.
This also removes oldvalue verification when calling update-ref
In SVN, branches can be deleted, and then recreated under the
same path as the original one with different ancestry
information, causing parent information to be mismatched /
misordered.
Also force the current ref, if existing, to be a parent,
regardless of whether or not it was specified.
--no-metadata:
This gets rid of the git-svn-id: lines at the end of every commit.
With this, you lose the ability to use the rebuild command. If
you ever lose your .git/svn/git-svn/.rev_db file, you won't be
able to fetch again, either. This is fine for one-shot imports.
Also fix some issues with multi-fetch --follow-parent that were
exposed while testing this. Additionally, repack checking is
simplified greatly.
git-svn log will not work on repositories using this, either.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 10:39:13 +08:00
|
|
|
svn commit -m 'another commit' &&
|
2007-01-13 18:47:53 +08:00
|
|
|
svn up &&
|
git-svn: add --follow-parent and --no-metadata options to fetch
--follow-parent:
This is especially helpful when we're tracking a directory
that has been moved around within the repository, or if we
started tracking a branch and never tracked the trunk it was
descended from.
This relies on the SVN::* libraries to work. We can't
reliably parse path info from the svn command-line client
without relying on XML, so it's better just to have the SVN::*
libs installed.
This also removes oldvalue verification when calling update-ref
In SVN, branches can be deleted, and then recreated under the
same path as the original one with different ancestry
information, causing parent information to be mismatched /
misordered.
Also force the current ref, if existing, to be a parent,
regardless of whether or not it was specified.
--no-metadata:
This gets rid of the git-svn-id: lines at the end of every commit.
With this, you lose the ability to use the rebuild command. If
you ever lose your .git/svn/git-svn/.rev_db file, you won't be
able to fetch again, either. This is fine for one-shot imports.
Also fix some issues with multi-fetch --follow-parent that were
exposed while testing this. Additionally, repack checking is
simplified greatly.
git-svn log will not work on repositories using this, either.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 10:39:13 +08:00
|
|
|
svn mv -m 'rename to thunk' trunk thunk &&
|
|
|
|
svn up &&
|
|
|
|
echo goodbye >> thunk/readme &&
|
2007-02-13 08:33:37 +08:00
|
|
|
poke thunk/readme &&
|
git-svn: add --follow-parent and --no-metadata options to fetch
--follow-parent:
This is especially helpful when we're tracking a directory
that has been moved around within the repository, or if we
started tracking a branch and never tracked the trunk it was
descended from.
This relies on the SVN::* libraries to work. We can't
reliably parse path info from the svn command-line client
without relying on XML, so it's better just to have the SVN::*
libs installed.
This also removes oldvalue verification when calling update-ref
In SVN, branches can be deleted, and then recreated under the
same path as the original one with different ancestry
information, causing parent information to be mismatched /
misordered.
Also force the current ref, if existing, to be a parent,
regardless of whether or not it was specified.
--no-metadata:
This gets rid of the git-svn-id: lines at the end of every commit.
With this, you lose the ability to use the rebuild command. If
you ever lose your .git/svn/git-svn/.rev_db file, you won't be
able to fetch again, either. This is fine for one-shot imports.
Also fix some issues with multi-fetch --follow-parent that were
exposed while testing this. Additionally, repack checking is
simplified greatly.
git-svn log will not work on repositories using this, either.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 10:39:13 +08:00
|
|
|
svn commit -m 'bye now' &&
|
|
|
|
cd ..
|
|
|
|
"
|
|
|
|
|
|
|
|
test_expect_success 'init and fetch --follow-parent a moved directory' "
|
|
|
|
git-svn init -i thunk $svnrepo/thunk &&
|
|
|
|
git-svn fetch --follow-parent -i thunk &&
|
2007-01-22 18:20:33 +08:00
|
|
|
test \"\`git-rev-parse --verify refs/remotes/trunk\`\" \
|
|
|
|
= \"\`git-rev-parse --verify refs/remotes/thunk~1\`\" &&
|
|
|
|
test \"\`git-cat-file blob refs/remotes/thunk:readme |\
|
|
|
|
sed -n -e '3p'\`\" = goodbye
|
git-svn: add --follow-parent and --no-metadata options to fetch
--follow-parent:
This is especially helpful when we're tracking a directory
that has been moved around within the repository, or if we
started tracking a branch and never tracked the trunk it was
descended from.
This relies on the SVN::* libraries to work. We can't
reliably parse path info from the svn command-line client
without relying on XML, so it's better just to have the SVN::*
libs installed.
This also removes oldvalue verification when calling update-ref
In SVN, branches can be deleted, and then recreated under the
same path as the original one with different ancestry
information, causing parent information to be mismatched /
misordered.
Also force the current ref, if existing, to be a parent,
regardless of whether or not it was specified.
--no-metadata:
This gets rid of the git-svn-id: lines at the end of every commit.
With this, you lose the ability to use the rebuild command. If
you ever lose your .git/svn/git-svn/.rev_db file, you won't be
able to fetch again, either. This is fine for one-shot imports.
Also fix some issues with multi-fetch --follow-parent that were
exposed while testing this. Additionally, repack checking is
simplified greatly.
git-svn log will not work on repositories using this, either.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 10:39:13 +08:00
|
|
|
"
|
|
|
|
|
2007-01-23 03:44:57 +08:00
|
|
|
test_expect_success 'init and fetch from one svn-remote' "
|
|
|
|
git-repo-config svn-remote.git-svn.url $svnrepo &&
|
|
|
|
git-repo-config --add svn-remote.git-svn.fetch \
|
|
|
|
trunk:refs/remotes/svn/trunk &&
|
|
|
|
git-repo-config --add svn-remote.git-svn.fetch \
|
|
|
|
thunk:refs/remotes/svn/thunk &&
|
|
|
|
git-svn fetch --follow-parent -i svn/thunk &&
|
|
|
|
test \"\`git-rev-parse --verify refs/remotes/svn/trunk\`\" \
|
|
|
|
= \"\`git-rev-parse --verify refs/remotes/svn/thunk~1\`\" &&
|
|
|
|
test \"\`git-cat-file blob refs/remotes/svn/thunk:readme |\
|
|
|
|
sed -n -e '3p'\`\" = goodbye
|
|
|
|
"
|
|
|
|
|
2007-01-23 07:22:50 +08:00
|
|
|
test_expect_success 'follow deleted parent' "
|
|
|
|
svn cp -m 'resurrecting trunk as junk' \
|
|
|
|
-r2 $svnrepo/trunk $svnrepo/junk &&
|
|
|
|
git-repo-config --add svn-remote.git-svn.fetch \
|
|
|
|
junk:refs/remotes/svn/junk &&
|
|
|
|
git-svn fetch --follow-parent -i svn/thunk &&
|
|
|
|
git-svn fetch -i svn/junk --follow-parent &&
|
|
|
|
test -z \"\`git diff svn/junk svn/trunk\`\" &&
|
|
|
|
test \"\`git merge-base svn/junk svn/trunk\`\" \
|
|
|
|
= \"\`git rev-parse svn/trunk\`\"
|
|
|
|
"
|
|
|
|
|
2007-01-24 18:16:25 +08:00
|
|
|
test_expect_success 'follow larger parent' "
|
|
|
|
mkdir -p import/trunk/thunk/bump/thud &&
|
|
|
|
echo hi > import/trunk/thunk/bump/thud/file &&
|
|
|
|
svn import -m 'import a larger parent' import $svnrepo/larger-parent &&
|
|
|
|
svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger &&
|
|
|
|
git-svn init -i larger $svnrepo/another-larger/trunk/thunk/bump/thud &&
|
|
|
|
git-svn fetch -i larger --follow-parent &&
|
|
|
|
git-rev-parse --verify refs/remotes/larger &&
|
|
|
|
git-rev-parse --verify \
|
|
|
|
refs/remotes/larger-parent/trunk/thunk/bump/thud &&
|
|
|
|
test \"\`git-merge-base \
|
|
|
|
refs/remotes/larger-parent/trunk/thunk/bump/thud \
|
|
|
|
refs/remotes/larger\`\" = \
|
|
|
|
\"\`git-rev-parse refs/remotes/larger\`\"
|
|
|
|
true
|
|
|
|
"
|
|
|
|
|
2007-01-26 02:52:36 +08:00
|
|
|
test_expect_success 'follow higher-level parent' "
|
|
|
|
svn mkdir -m 'follow higher-level parent' $svnrepo/blob &&
|
|
|
|
svn co $svnrepo/blob blob &&
|
|
|
|
cd blob &&
|
|
|
|
echo hi > hi &&
|
|
|
|
svn add hi &&
|
2007-01-26 07:44:54 +08:00
|
|
|
svn commit -m 'hihi' &&
|
2007-01-26 02:52:36 +08:00
|
|
|
cd ..
|
|
|
|
svn mkdir -m 'new glob at top level' $svnrepo/glob &&
|
|
|
|
svn mv -m 'move blob down a level' $svnrepo/blob $svnrepo/glob/blob &&
|
|
|
|
git-svn init -i blob $svnrepo/glob/blob &&
|
|
|
|
git-svn fetch -i blob --follow-parent
|
|
|
|
"
|
|
|
|
|
2007-01-26 07:44:54 +08:00
|
|
|
test_expect_success 'follow deleted directory' "
|
|
|
|
svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye&&
|
|
|
|
svn rm -m 'remove glob' $svnrepo/glob &&
|
|
|
|
git-svn init -i glob $svnrepo/glob &&
|
|
|
|
git-svn fetch -i glob &&
|
|
|
|
test \"\`git cat-file blob refs/remotes/glob~1:blob/bye\`\" = hi &&
|
|
|
|
test -z \"\`git ls-tree -z refs/remotes/glob\`\"
|
|
|
|
"
|
|
|
|
|
git-svn: add --follow-parent and --no-metadata options to fetch
--follow-parent:
This is especially helpful when we're tracking a directory
that has been moved around within the repository, or if we
started tracking a branch and never tracked the trunk it was
descended from.
This relies on the SVN::* libraries to work. We can't
reliably parse path info from the svn command-line client
without relying on XML, so it's better just to have the SVN::*
libs installed.
This also removes oldvalue verification when calling update-ref
In SVN, branches can be deleted, and then recreated under the
same path as the original one with different ancestry
information, causing parent information to be mismatched /
misordered.
Also force the current ref, if existing, to be a parent,
regardless of whether or not it was specified.
--no-metadata:
This gets rid of the git-svn-id: lines at the end of every commit.
With this, you lose the ability to use the rebuild command. If
you ever lose your .git/svn/git-svn/.rev_db file, you won't be
able to fetch again, either. This is fine for one-shot imports.
Also fix some issues with multi-fetch --follow-parent that were
exposed while testing this. Additionally, repack checking is
simplified greatly.
git-svn log will not work on repositories using this, either.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-06-28 10:39:13 +08:00
|
|
|
test_debug 'gitk --all &'
|
|
|
|
|
|
|
|
test_done
|