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 04:39:13 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2006 Eric Wong
|
|
|
|
#
|
|
|
|
|
2007-02-09 11:45:03 +01:00
|
|
|
test_description='git-svn fetching'
|
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 04:39:13 +02:00
|
|
|
. ./lib-git-svn.sh
|
|
|
|
|
2008-05-04 07:37:59 +02:00
|
|
|
test_expect_success 'initialize repo' '
|
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 04:39:13 +02:00
|
|
|
mkdir import &&
|
|
|
|
cd import &&
|
|
|
|
mkdir -p trunk &&
|
|
|
|
echo hello > trunk/readme &&
|
2008-05-04 07:37:59 +02:00
|
|
|
svn import -m "initial" . "$svnrepo" &&
|
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 04:39:13 +02:00
|
|
|
cd .. &&
|
2008-05-04 07:37:59 +02:00
|
|
|
svn co "$svnrepo" wc &&
|
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 04:39:13 +02:00
|
|
|
cd wc &&
|
|
|
|
echo world >> trunk/readme &&
|
2007-02-13 01:33:37 +01:00
|
|
|
poke trunk/readme &&
|
2008-05-04 07:37:59 +02:00
|
|
|
svn commit -m "another commit" &&
|
2007-01-13 11:47:53 +01:00
|
|
|
svn up &&
|
2007-09-21 04:02:33 +02:00
|
|
|
svn mv trunk thunk &&
|
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 04:39:13 +02:00
|
|
|
echo goodbye >> thunk/readme &&
|
2007-02-13 01:33:37 +01:00
|
|
|
poke thunk/readme &&
|
2008-05-04 07:37:59 +02:00
|
|
|
svn commit -m "bye now" &&
|
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 04:39:13 +02:00
|
|
|
cd ..
|
2008-05-04 07:37:59 +02:00
|
|
|
'
|
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 04:39:13 +02:00
|
|
|
|
2008-05-04 07:37:59 +02:00
|
|
|
test_expect_success 'init and fetch a moved directory' '
|
|
|
|
git-svn init --minimize-url -i thunk "$svnrepo"/thunk &&
|
2007-02-09 11:45:03 +01:00
|
|
|
git-svn fetch -i thunk &&
|
2008-05-04 07:37:59 +02:00
|
|
|
test "`git rev-parse --verify refs/remotes/thunk@2`" \
|
|
|
|
= "`git rev-parse --verify refs/remotes/thunk~1`" &&
|
|
|
|
test "`git cat-file blob refs/remotes/thunk:readme |\
|
|
|
|
sed -n -e "3p"`" = goodbye &&
|
|
|
|
test -z "`git config --get svn-remote.svn.fetch \
|
|
|
|
"^trunk:refs/remotes/thunk@2$"`"
|
|
|
|
'
|
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 04:39:13 +02:00
|
|
|
|
2008-05-04 07:37:59 +02:00
|
|
|
test_expect_success 'init and fetch from one svn-remote' '
|
|
|
|
git config svn-remote.svn.url "$svnrepo" &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git config --add svn-remote.svn.fetch \
|
2007-01-22 20:44:57 +01:00
|
|
|
trunk:refs/remotes/svn/trunk &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git config --add svn-remote.svn.fetch \
|
2007-01-22 20:44:57 +01:00
|
|
|
thunk:refs/remotes/svn/thunk &&
|
2007-02-09 11:45:03 +01:00
|
|
|
git-svn fetch -i svn/thunk &&
|
2008-05-04 07:37:59 +02:00
|
|
|
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-22 20:44:57 +01:00
|
|
|
|
2008-05-04 07:37:59 +02:00
|
|
|
test_expect_success 'follow deleted parent' '
|
|
|
|
(svn cp -m "resurrecting trunk as junk" \
|
|
|
|
"$svnrepo"/trunk@2 "$svnrepo"/junk ||
|
|
|
|
svn cp -m "resurrecting trunk as junk" \
|
|
|
|
-r2 "$svnrepo"/trunk "$svnrepo"/junk) &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git config --add svn-remote.svn.fetch \
|
2007-01-23 00:22:50 +01:00
|
|
|
junk:refs/remotes/svn/junk &&
|
2007-02-09 11:45:03 +01:00
|
|
|
git-svn fetch -i svn/thunk &&
|
|
|
|
git-svn fetch -i svn/junk &&
|
2008-05-04 07:37:59 +02:00
|
|
|
test -z "`git diff svn/junk svn/trunk`" &&
|
|
|
|
test "`git merge-base svn/junk svn/trunk`" \
|
|
|
|
= "`git rev-parse svn/trunk`"
|
|
|
|
'
|
2007-01-23 00:22:50 +01:00
|
|
|
|
2008-05-04 07:37:59 +02:00
|
|
|
test_expect_success 'follow larger parent' '
|
2007-01-24 11:16:25 +01:00
|
|
|
mkdir -p import/trunk/thunk/bump/thud &&
|
|
|
|
echo hi > import/trunk/thunk/bump/thud/file &&
|
2008-05-04 07:37:59 +02:00
|
|
|
svn import -m "import a larger parent" import "$svnrepo"/larger-parent &&
|
|
|
|
svn cp -m "hi" "$svnrepo"/larger-parent "$svnrepo"/another-larger &&
|
git-svn: don't attempt to minimize URLs by default
For tracking branches and tags, git-svn prefers to connect
to the root of the repository or at least the level that
houses branches and tags as well as trunk. However, users
that are accustomed to tracking a single directory have
no use for this feature.
As pointed out by Junio, users may not have permissions to
connect to connect to a higher-level path in the repository.
While the current minimize_url() function detects lack of
permissions to certain paths _after_ successful logins, it
cannot effectively determine if it is trying to access a
login-only portion of a repo when the user expects to
connect to a part where anonymous access is allowed.
For people used to the git-svnimport switches of
--trunk, --tags, --branches, they'll already pass the
repository root (or root+subdirectory), so minimize URL
isn't of too much use to them, either.
For people *not* used to git-svnimport, git-svn also
supports:
git svn init --minimize-url \
--trunk http://repository-root/foo/trunk \
--branches http://repository-root/foo/branches \
--tags http://repository-root/foo/tags
And this is where the new --minimize-url command-line switch
comes in to allow for this behavior to continue working.
2007-05-13 18:58:14 +02:00
|
|
|
git-svn init --minimize-url -i larger \
|
2008-05-04 07:37:59 +02:00
|
|
|
"$svnrepo"/another-larger/trunk/thunk/bump/thud &&
|
2007-02-09 11:45:03 +01:00
|
|
|
git-svn fetch -i larger &&
|
2007-07-03 07:52:14 +02:00
|
|
|
git rev-parse --verify refs/remotes/larger &&
|
|
|
|
git rev-parse --verify \
|
2007-01-24 11:16:25 +01:00
|
|
|
refs/remotes/larger-parent/trunk/thunk/bump/thud &&
|
2008-05-04 07:37:59 +02:00
|
|
|
test "`git merge-base \
|
2007-01-24 11:16:25 +01:00
|
|
|
refs/remotes/larger-parent/trunk/thunk/bump/thud \
|
2008-05-04 07:37:59 +02:00
|
|
|
refs/remotes/larger`" = \
|
|
|
|
"`git rev-parse refs/remotes/larger`"
|
2007-01-24 11:16:25 +01:00
|
|
|
true
|
2008-05-04 07:37:59 +02:00
|
|
|
'
|
2007-01-24 11:16:25 +01:00
|
|
|
|
2008-05-04 07:37:59 +02:00
|
|
|
test_expect_success 'follow higher-level parent' '
|
|
|
|
svn mkdir -m "follow higher-level parent" "$svnrepo"/blob &&
|
|
|
|
svn co "$svnrepo"/blob blob &&
|
2007-01-25 19:52:36 +01:00
|
|
|
cd blob &&
|
|
|
|
echo hi > hi &&
|
|
|
|
svn add hi &&
|
2008-05-04 07:37:59 +02:00
|
|
|
svn commit -m "hihi" &&
|
2007-01-25 19:52:36 +01:00
|
|
|
cd ..
|
2008-05-04 07:37:59 +02:00
|
|
|
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 --minimize-url -i blob "$svnrepo"/glob/blob &&
|
2007-02-09 11:45:03 +01:00
|
|
|
git-svn fetch -i blob
|
2008-05-04 07:37:59 +02:00
|
|
|
'
|
2007-01-25 19:52:36 +01:00
|
|
|
|
2008-05-04 07:37:59 +02: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 --minimize-url -i glob "$svnrepo"/glob &&
|
2007-01-26 00:44:54 +01:00
|
|
|
git-svn fetch -i glob &&
|
2008-05-04 07:37:59 +02:00
|
|
|
test "`git cat-file blob refs/remotes/glob:blob/bye`" = hi &&
|
|
|
|
test "`git ls-tree refs/remotes/glob | wc -l `" -eq 1
|
|
|
|
'
|
2007-01-26 00:44:54 +01:00
|
|
|
|
2007-01-28 13:59:05 +01:00
|
|
|
# ref: r9270 of the Subversion repository: (http://svn.collab.net/repos/svn)
|
|
|
|
# in trunk/subversion/bindings/swig/perl
|
2008-05-04 07:37:59 +02:00
|
|
|
test_expect_success 'follow-parent avoids deleting relevant info' '
|
2007-01-28 13:59:05 +01:00
|
|
|
mkdir -p import/trunk/subversion/bindings/swig/perl/t &&
|
|
|
|
for i in a b c ; do \
|
2008-05-04 07:37:59 +02:00
|
|
|
echo $i > import/trunk/subversion/bindings/swig/perl/$i.pm &&
|
|
|
|
echo _$i > import/trunk/subversion/bindings/swig/perl/t/$i.t; \
|
2007-01-28 13:59:05 +01:00
|
|
|
done &&
|
2008-05-04 07:37:59 +02:00
|
|
|
echo "bad delete test" > \
|
2007-01-28 13:59:05 +01:00
|
|
|
import/trunk/subversion/bindings/swig/perl/t/larger-parent &&
|
2008-05-04 07:37:59 +02:00
|
|
|
echo "bad delete test 2" > \
|
2007-01-28 13:59:05 +01:00
|
|
|
import/trunk/subversion/bindings/swig/perl/another-larger &&
|
|
|
|
cd import &&
|
2008-05-04 07:37:59 +02:00
|
|
|
svn import -m "r9270 test" . "$svnrepo"/r9270 &&
|
2007-01-28 13:59:05 +01:00
|
|
|
cd .. &&
|
2008-05-04 07:37:59 +02:00
|
|
|
svn co "$svnrepo"/r9270/trunk/subversion/bindings/swig/perl r9270 &&
|
2007-01-28 13:59:05 +01:00
|
|
|
cd r9270 &&
|
|
|
|
svn mkdir native &&
|
|
|
|
svn mv t native/t &&
|
2008-05-04 07:37:59 +02:00
|
|
|
for i in a b c; do svn mv $i.pm native/$i.pm; done &&
|
2007-01-28 13:59:05 +01:00
|
|
|
echo z >> native/t/c.t &&
|
2007-02-14 02:38:58 +01:00
|
|
|
poke native/t/c.t &&
|
2008-05-04 07:37:59 +02:00
|
|
|
svn commit -m "reorg test" &&
|
2007-01-28 13:59:05 +01:00
|
|
|
cd .. &&
|
git-svn: don't attempt to minimize URLs by default
For tracking branches and tags, git-svn prefers to connect
to the root of the repository or at least the level that
houses branches and tags as well as trunk. However, users
that are accustomed to tracking a single directory have
no use for this feature.
As pointed out by Junio, users may not have permissions to
connect to connect to a higher-level path in the repository.
While the current minimize_url() function detects lack of
permissions to certain paths _after_ successful logins, it
cannot effectively determine if it is trying to access a
login-only portion of a repo when the user expects to
connect to a part where anonymous access is allowed.
For people used to the git-svnimport switches of
--trunk, --tags, --branches, they'll already pass the
repository root (or root+subdirectory), so minimize URL
isn't of too much use to them, either.
For people *not* used to git-svnimport, git-svn also
supports:
git svn init --minimize-url \
--trunk http://repository-root/foo/trunk \
--branches http://repository-root/foo/branches \
--tags http://repository-root/foo/tags
And this is where the new --minimize-url command-line switch
comes in to allow for this behavior to continue working.
2007-05-13 18:58:14 +02:00
|
|
|
git-svn init --minimize-url -i r9270-t \
|
2008-05-04 07:37:59 +02:00
|
|
|
"$svnrepo"/r9270/trunk/subversion/bindings/swig/perl/native/t &&
|
2007-02-09 11:45:03 +01:00
|
|
|
git-svn fetch -i r9270-t &&
|
2008-05-04 07:37:59 +02:00
|
|
|
test `git rev-list r9270-t | wc -l` -eq 2 &&
|
|
|
|
test "`git ls-tree --name-only r9270-t~1`" = \
|
|
|
|
"`git ls-tree --name-only r9270-t`"
|
|
|
|
'
|
2007-01-28 13:59:05 +01:00
|
|
|
|
2008-05-04 07:37:59 +02:00
|
|
|
test_expect_success "track initial change if it was only made to parent" '
|
|
|
|
svn cp -m "wheee!" "$svnrepo"/r9270/trunk "$svnrepo"/r9270/drunk &&
|
git-svn: don't attempt to minimize URLs by default
For tracking branches and tags, git-svn prefers to connect
to the root of the repository or at least the level that
houses branches and tags as well as trunk. However, users
that are accustomed to tracking a single directory have
no use for this feature.
As pointed out by Junio, users may not have permissions to
connect to connect to a higher-level path in the repository.
While the current minimize_url() function detects lack of
permissions to certain paths _after_ successful logins, it
cannot effectively determine if it is trying to access a
login-only portion of a repo when the user expects to
connect to a part where anonymous access is allowed.
For people used to the git-svnimport switches of
--trunk, --tags, --branches, they'll already pass the
repository root (or root+subdirectory), so minimize URL
isn't of too much use to them, either.
For people *not* used to git-svnimport, git-svn also
supports:
git svn init --minimize-url \
--trunk http://repository-root/foo/trunk \
--branches http://repository-root/foo/branches \
--tags http://repository-root/foo/tags
And this is where the new --minimize-url command-line switch
comes in to allow for this behavior to continue working.
2007-05-13 18:58:14 +02:00
|
|
|
git-svn init --minimize-url -i r9270-d \
|
2008-05-04 07:37:59 +02:00
|
|
|
"$svnrepo"/r9270/drunk/subversion/bindings/swig/perl/native/t &&
|
2007-02-09 11:45:03 +01:00
|
|
|
git-svn fetch -i r9270-d &&
|
2008-05-04 07:37:59 +02:00
|
|
|
test `git rev-list r9270-d | wc -l` -eq 3 &&
|
|
|
|
test "`git ls-tree --name-only r9270-t`" = \
|
|
|
|
"`git ls-tree --name-only r9270-d`" &&
|
|
|
|
test "`git rev-parse r9270-t`" = \
|
|
|
|
"`git rev-parse r9270-d~1`"
|
|
|
|
'
|
2007-01-30 09:35:18 +01:00
|
|
|
|
2008-12-08 14:31:31 +01:00
|
|
|
test_expect_success "follow-parent is atomic" '
|
|
|
|
(
|
|
|
|
cd wc &&
|
|
|
|
svn up &&
|
|
|
|
svn mkdir stunk &&
|
|
|
|
echo "trunk stunk" > stunk/readme &&
|
|
|
|
svn add stunk/readme &&
|
|
|
|
svn ci -m "trunk stunk" &&
|
|
|
|
echo "stunk like junk" >> stunk/readme &&
|
|
|
|
svn ci -m "really stunk" &&
|
|
|
|
echo "stink stank stunk" >> stunk/readme &&
|
|
|
|
svn ci -m "even the grinch agrees"
|
|
|
|
) &&
|
|
|
|
svn copy -m "stunk flunked" "$svnrepo"/stunk "$svnrepo"/flunk &&
|
|
|
|
{ svn cp -m "early stunk flunked too" \
|
|
|
|
"$svnrepo"/stunk@17 "$svnrepo"/flunked ||
|
|
|
|
svn cp -m "early stunk flunked too" \
|
|
|
|
-r17 "$svnrepo"/stunk "$svnrepo"/flunked; } &&
|
|
|
|
git svn init --minimize-url -i stunk "$svnrepo"/stunk &&
|
|
|
|
git svn fetch -i stunk &&
|
|
|
|
git update-ref refs/remotes/flunk@18 refs/remotes/stunk~2 &&
|
|
|
|
git update-ref -d refs/remotes/stunk &&
|
|
|
|
git config --unset svn-remote.svn.fetch stunk &&
|
|
|
|
mkdir -p "$GIT_DIR"/svn/flunk@18 &&
|
|
|
|
rev_map=$(cd "$GIT_DIR"/svn/stunk && ls .rev_map*) &&
|
|
|
|
dd if="$GIT_DIR"/svn/stunk/$rev_map \
|
|
|
|
of="$GIT_DIR"/svn/flunk@18/$rev_map bs=24 count=1 &&
|
|
|
|
rm -rf "$GIT_DIR"/svn/stunk &&
|
|
|
|
git svn init --minimize-url -i flunk "$svnrepo"/flunk &&
|
|
|
|
git svn fetch -i flunk &&
|
|
|
|
git svn init --minimize-url -i stunk "$svnrepo"/stunk &&
|
|
|
|
git svn fetch -i stunk &&
|
|
|
|
git svn init --minimize-url -i flunked "$svnrepo"/flunked &&
|
|
|
|
git svn fetch -i flunked
|
|
|
|
test "`git rev-parse --verify refs/remotes/flunk@18`" \
|
|
|
|
= "`git rev-parse --verify refs/remotes/stunk`" &&
|
|
|
|
test "`git rev-parse --verify refs/remotes/flunk~1`" \
|
|
|
|
= "`git rev-parse --verify refs/remotes/stunk`" &&
|
|
|
|
test "`git rev-parse --verify refs/remotes/flunked~1`" \
|
|
|
|
= "`git rev-parse --verify refs/remotes/stunk~1`"
|
|
|
|
'
|
|
|
|
|
2008-05-04 07:37:59 +02:00
|
|
|
test_expect_success "track multi-parent paths" '
|
|
|
|
svn cp -m "resurrect /glob" "$svnrepo"/r9270 "$svnrepo"/glob &&
|
2007-02-09 11:45:03 +01:00
|
|
|
git-svn multi-fetch &&
|
2008-05-04 07:37:59 +02:00
|
|
|
test `git cat-file commit refs/remotes/glob | \
|
|
|
|
grep "^parent " | wc -l` -eq 2
|
|
|
|
'
|
2007-02-09 10:28:30 +01:00
|
|
|
|
2007-01-31 11:45:50 +01:00
|
|
|
test_expect_success "multi-fetch continues to work" "
|
2007-02-09 11:45:03 +01:00
|
|
|
git-svn multi-fetch
|
2007-01-31 11:45:50 +01:00
|
|
|
"
|
|
|
|
|
2008-05-04 07:37:59 +02:00
|
|
|
test_expect_success "multi-fetch works off a 'clean' repository" '
|
|
|
|
rm -r "$GIT_DIR/svn" "$GIT_DIR/refs/remotes" "$GIT_DIR/logs" &&
|
|
|
|
mkdir "$GIT_DIR/svn" &&
|
2007-02-09 11:45:03 +01:00
|
|
|
git-svn multi-fetch
|
2008-05-04 07:37:59 +02:00
|
|
|
'
|
2007-01-31 11:45:50 +01:00
|
|
|
|
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 04:39:13 +02:00
|
|
|
test_debug 'gitk --all &'
|
|
|
|
|
|
|
|
test_done
|