Commit 1bc7bfe5 authored by Aaron Gable's avatar Aaron Gable Committed by Commit Bot

Remove SVN (and dcommit) support from git-cl

BUG=638750

Change-Id: I9ebe4ff861a37433209b66f4050370b49f17cdc7
Reviewed-on: https://chromium-review.googlesource.com/419661
Commit-Queue: Aaron Gable <agable@chromium.org>
Reviewed-by: 's avatarAndrii Shyshkalov <tandrii@chromium.org>
parent dd013e2b
......@@ -86,12 +86,11 @@ def RunGitClTests(input_api, output_api):
server.start_server()
test_path = input_api.os_path.abspath(
input_api.os_path.join(input_api.PresubmitLocalPath(), 'tests'))
# test-lib.sh is not an actual test so it should not be run.
NON_TEST_FILES = ('test-lib.sh')
for test in input_api.os_listdir(test_path):
# test-lib.sh is not an actual test so it should not be run. The other
# tests are tests known to fail.
DISABLED_TESTS = (
'owners.sh', 'push-from-logs.sh', 'rename.sh', 'test-lib.sh')
if test in DISABLED_TESTS or not test.endswith('.sh'):
if test in NON_TEST_FILES or not test.endswith('.sh'):
continue
print('Running %s' % test)
......
This diff is collapsed.
......@@ -10,12 +10,12 @@ set -e
. ./test-lib.sh
setup_initsvn
setup_gitsvn
setup_git_remote
setup_git_checkout
(
set -e
cd git-svn
cd git_checkout
git config rietveld.server localhost:10000
# Create a branch and give it an issue.
......
......@@ -8,13 +8,13 @@ set -e
. ./test-lib.sh
setup_initsvn
setup_gitsvn
setup_git_remote
setup_git_checkout
(
set -e
cd git-svn
git checkout -q -b work
cd git_checkout
git checkout -q --track -b work origin
echo "some work done on a branch" >> test
git add test; git commit -q -m "branch work"
echo "some other work done on a branch" >> test
......@@ -32,7 +32,7 @@ setup_gitsvn
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'"
......@@ -45,19 +45,21 @@ setup_gitsvn
--data-urlencode xsrf_token="$(print_xsrf_token)" \
$URL/edit
test_expect_success "git-cl dcommits ok" \
"$GIT_CL dcommit -f --no-oauth2"
test_expect_success "git-cl land ok" \
"$GIT_CL land -f --no-oauth2"
test_expect_success "branch still has an issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'"
git checkout -q master
git svn -q rebase >/dev/null 2>&1
test_expect_success "dcommitted code has proper description" \
git checkout -q master > /dev/null 2>&1
git pull -q > /dev/null 2>&1
test_expect_success "committed code has proper description" \
"git show | grep -q 'foo-quux'"
test_expect_success "upstream svn has our commit" \
"svn log $REPO_URL 2>/dev/null | grep -q 'foo-quux'"
cd $GITREPO_PATH
test_expect_success "upstream repo has our commit" \
"git log master 2>/dev/null | grep -q 'foo-quux'"
)
SUCCESS=$?
......
......@@ -635,12 +635,7 @@ class TestGitCl(TestCase):
((['git', 'config', 'core.editor'],), ''),
] + cc_call + private_call + [
((['git', 'config', 'branch.master.base-url'],), ''),
((['git', 'config', 'rietveld.pending-ref-prefix'],), ''),
((['git',
'config', '--local', '--get-regexp', '^svn-remote\\.'],),
(('', None), 0)),
((['git', 'rev-parse', '--show-cdup'],), ''),
((['git', 'svn', 'info'],), ''),
((['git', 'config', 'remote.origin.url'],), ''),
((['git', 'config', 'rietveld.project'],), ''),
((['git', 'config', 'branch.master.rietveldissue', '1'],), ''),
((['git', 'config', 'branch.master.rietveldserver',
......@@ -685,106 +680,6 @@ class TestGitCl(TestCase):
'refs/remotes/origin/master'],), ''),
]
@classmethod
def _dcommit_calls_1(cls):
return [
((['git', 'config', 'rietveld.autoupdate'],),
''),
((['git', 'config', 'rietveld.pending-ref-prefix'],),
''),
((['git',
'config', '--local', '--get-regexp', '^svn-remote\\.'],),
((('svn-remote.svn.url svn://svn.chromium.org/chrome\n'
'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'),
None),
0)),
((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
((['git', 'config',
'branch.working.git-cl-similarity'],), CERR1),
((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
((['git', 'config', '--bool',
'branch.working.git-find-copies'],), CERR1),
((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'),
((['git',
'config', 'branch.working.rietveldissue'],), '12345'),
((['git',
'config', 'rietveld.server'],), 'codereview.example.com'),
((['git',
'config', 'branch.working.merge'],), 'refs/heads/master'),
((['git', 'config', 'branch.working.remote'],), 'origin'),
((['git', 'config', 'branch.working.merge'],),
'refs/heads/master'),
((['git', 'config', 'branch.working.remote'],), 'origin'),
((['git', 'rev-list', '--merges',
'--grep=^SVN changes up to revision [0-9]*$',
'refs/remotes/origin/master^!'],), ''),
((['git', 'rev-list', '^refs/heads/working',
'refs/remotes/origin/master'],),
''),
((['git',
'log', '--grep=^git-svn-id:', '-1', '--pretty=format:%H'],),
'3fc18b62c4966193eb435baabe2d18a3810ec82e'),
((['git',
'rev-list', '^3fc18b62c4966193eb435baabe2d18a3810ec82e',
'refs/remotes/origin/master'],), ''),
((['git',
'merge-base', 'refs/remotes/origin/master', 'HEAD'],),
'fake_ancestor_sha'),
]
@classmethod
def _dcommit_calls_normal(cls):
return [
((['git', 'rev-parse', '--show-cdup'],), ''),
((['git', 'rev-parse', 'HEAD'],),
'00ff397798ea57439712ed7e04ab96e13969ef40'),
((['git',
'diff', '--name-status', '--no-renames', '-r', 'fake_ancestor_sha...',
'.'],),
'M\tPRESUBMIT.py'),
((['git',
'config', 'branch.working.rietveldpatchset'],), '31137'),
((['git', 'config', 'branch.working.rietveldserver'],),
'codereview.example.com'),
((['git', 'config', 'user.email'],), 'author@example.com'),
((['git', 'config', 'rietveld.tree-status-url'],), ''),
]
@classmethod
def _dcommit_calls_bypassed(cls):
return [
((['git', 'config', 'branch.working.rietveldserver'],),
'codereview.example.com'),
]
@classmethod
def _dcommit_calls_3(cls):
return [
((['git',
'diff', '--no-ext-diff', '--stat', '-l100000', '-C50',
'fake_ancestor_sha', 'refs/heads/working'],),
(' PRESUBMIT.py | 2 +-\n'
' 1 files changed, 1 insertions(+), 1 deletions(-)\n')),
((['git', 'show-ref', '--quiet', '--verify',
'refs/heads/git-cl-commit'],), ''),
((['git', 'branch', '-D', 'git-cl-commit'],), ''),
((['git', 'show-ref', '--quiet', '--verify',
'refs/heads/git-cl-cherry-pick'],), CERR1),
((['git', 'rev-parse', '--show-cdup'],), '\n'),
((['git', 'checkout', '-q', '-b', 'git-cl-commit'],), ''),
((['git', 'reset', '--soft', 'fake_ancestor_sha'],), ''),
((['git', 'commit', '-m',
'Issue: 12345\n\nR=john@chromium.org\n\n'
'Review-Url: https://codereview.example.com/12345 .'],),
''),
((['git', 'config', 'rietveld.force-https-commit-url'],), ''),
((['git',
'svn', 'dcommit', '-C50', '--no-rebase', '--rmdir'],),
(('', None), 0)),
((['git', 'checkout', '-q', 'working'],), ''),
((['git', 'branch', '-D', 'git-cl-commit'],), ''),
]
@staticmethod
def _cmd_line(description, args, similarity, find_copies, private, cc):
"""Returns the upload command line passed to upload.RealMain()."""
......@@ -952,23 +847,6 @@ class TestGitCl(TestCase):
'desc\n\nBUG=500658\nBUG=proj:1234',
[])
def test_dcommit(self):
self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
self.calls = (
self._dcommit_calls_1() +
self._git_sanity_checks('fake_ancestor_sha', 'working') +
self._dcommit_calls_normal() +
self._dcommit_calls_3())
git_cl.main(['dcommit'])
def test_dcommit_bypass_hooks(self):
self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
self.calls = (
self._dcommit_calls_1() +
self._dcommit_calls_bypassed() +
self._dcommit_calls_3())
git_cl.main(['dcommit', '--bypass-hooks'])
def _land_rietveld_common(self, debug=False):
if debug:
# Very useful due to finally clause in git cl land raising exceptions and
......@@ -984,10 +862,6 @@ class TestGitCl(TestCase):
self.mock(RietveldMock, 'add_comment', staticmethod(
lambda i, c: self._mocked_call(['add_comment', i, c])))
self.calls = [
((['git', 'config', 'rietveld.autoupdate'],), ''),
((['git', 'config', 'rietveld.pending-ref-prefix'],), CERR1),
((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],),
CERR1),
((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
((['git', 'config', 'branch.feature.git-cl-similarity'],), CERR1),
((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
......@@ -995,15 +869,13 @@ class TestGitCl(TestCase):
CERR1),
((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
((['git', 'config', 'branch.feature.rietveldissue'],), '123'),
((['git', 'config', 'rietveld.autoupdate'],), ''),
((['git', 'config', 'rietveld.server'],),
'https://codereview.chromium.org'),
((['git', 'config', 'branch.feature.merge'],), 'refs/heads/master'),
((['git', 'config', 'branch.feature.remote'],), 'origin'),
((['git', 'config', 'branch.feature.merge'],), 'refs/heads/master'),
((['git', 'config', 'branch.feature.remote'],), 'origin'),
((['git', 'rev-list', '--merges',
'--grep=^SVN changes up to revision [0-9]*$',
'refs/remotes/origin/master^!'],), ''),
((['git', 'rev-list', '^feature', 'refs/remotes/origin/master'],),
''), # No commits to rebase, according to local view of origin.
((['git', 'merge-base', 'refs/remotes/origin/master', 'HEAD'],),
......
......@@ -4,32 +4,32 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Tests the "preupload and predcommit hooks" functionality, which lets you run
# Tests the "preupload and preland hooks" functionality, which lets you run
# hooks by installing a script into .git/hooks/pre-cl-* first.
set -e
. ./test-lib.sh
setup_initsvn
setup_gitsvn
setup_git_remote
setup_git_checkout
setup_hooks() {
upload_retval=$1
dcommit_retval=$2
land_retval=$2
echo > PRESUBMIT.py <<END
def CheckChangeOnUpload(input_api, output_api):
return $upload_retval
def CheckChangeOnCommit(input_api, output_api):
return $dcommit_retval
return $land_retval
END
}
(
set -e
cd git-svn
cd git_checkout
# We need a server set up, but we don't use it. git config rietveld.server localhost:1
......@@ -42,8 +42,8 @@ END
# Verify git cl upload fails.
test_expect_failure "git-cl upload hook fails" "$GIT_CL upload master"
# Verify git cl dcommit fails.
test_expect_failure "git-cl dcommit hook fails" "$GIT_CL dcommit master"
# Verify git cl land fails.
test_expect_failure "git-cl land hook fails" "$GIT_CL land master"
)
SUCCESS=$?
......
......@@ -8,13 +8,12 @@ set -e
. ./test-lib.sh
setup_initsvn
setup_gitsvn
setup_git_remote
setup_git_checkout
(
set -e
cd git-svn
cd git_checkout
git config rietveld.server localhost:10000
export GIT_EDITOR=$(which true)
......@@ -32,14 +31,8 @@ END
test_expect_success "upload succeeds (needs a server running on localhost)" \
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl status has a suggested reviewer" \
"$GIT_CL_STATUS | grep -q 'R=ben@chromium.org'"
test_expect_failure "git-cl dcommit fails w/ missing LGTM" \
"$GIT_CL dcommit -f --no-oauth2"
test_expect_success "git-cl dcommit --tbr succeeds" \
"$GIT_CL dcommit --tbr -f --no-oauth2 | grep -q -- '--tbr was specified'"
test_expect_failure "git-cl land fails w/ missing LGTM" \
"$GIT_CL land -f --no-oauth2"
)
SUCCESS=$?
......
......@@ -8,12 +8,12 @@ set -e
. ./test-lib.sh
setup_initsvn
setup_gitsvn
setup_git_remote
setup_git_checkout
(
set -e
cd git-svn
cd git_checkout
git checkout -q -b work
echo "some work done on a branch" >> test
git add test; git commit -q -m "branch work"
......
......@@ -8,29 +8,29 @@ set -e
. ./test-lib.sh
setup_initsvn
setup_gitsvn
setup_git_remote
setup_git_checkout
(
set -e
cd git-svn
cd git_checkout
cat > .git/hooks/post-cl-dcommit << _EOF
cat > .git/hooks/post-cl-land << _EOF
#!/usr/bin/env bash
git branch -m COMMITTED
_EOF
chmod +x .git/hooks/post-cl-dcommit
chmod +x .git/hooks/post-cl-land
git config rietveld.server localhost:1
git checkout -q --track -b work
git checkout -q -t origin/master -b work
echo "some work done" >> test
git add test; git commit -q -m "work \
TBR=foo"
test_expect_success "dcommitted code" \
"$GIT_CL dcommit --no-oauth2 -f --bypass-hooks -m 'dcommit'"
test_expect_success "landed code" \
"$GIT_CL land --no-oauth2 -f --bypass-hooks -m 'land'"
test_expect_success "post-cl-dcommit hook executed" \
test_expect_success "post-cl-land hook executed" \
"git symbolic-ref HEAD | grep -q COMMITTED"
)
SUCCESS=$?
......
#!/usr/bin/env bash
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
. ./test-lib.sh
setup_initgit
setup_gitgit
(
set -e
cd git-git
git checkout -q --track -b work origin
echo "some work done on a branch" >> test
git add test; git commit -q -m "branch work"
echo "some other work done on a branch" >> test
git add test; git commit -q -m "branch work"
test_expect_success "git-cl upload wants a server" \
"$GIT_CL upload --no-oauth2 2>&1 | grep -q 'You must configure'"
git config rietveld.server localhost:10000
# echo $($GIT_CL_STATUS)
test_expect_success "git-cl status has no issue" \
"$GIT_CL_STATUS | grep -q 'No issue assigned'"
# Prevent the editor from coming up when you upload.
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'"
# Push a description to this URL.
URL=$($GIT_CL_STATUS | sed -ne '/Issue number/s/[^(]*(\(.*\))/\1/p')
curl --cookie dev_appserver_login="test@example.com:False" \
--data-urlencode subject="test" \
--data-urlencode description="foo-quux" \
--data-urlencode xsrf_token="$(print_xsrf_token)" \
$URL/edit
test_expect_success "git-cl land ok" \
"$GIT_CL land -f --no-oauth2"
test_expect_success "branch still has an issue" \
"$GIT_CL_STATUS | grep -q 'Issue number'"
git checkout -q master > /dev/null 2>&1
git pull -q > /dev/null 2>&1
test_expect_success "committed code has proper description" \
"git show | grep -q 'foo-quux'"
cd $GITREPO_PATH
test_expect_success "upstream repo has our commit" \
"git log master 2>/dev/null | grep -q 'foo-quux'"
)
SUCCESS=$?
cleanup
if [ $SUCCESS == 0 ]; then
echo PASS
fi
......@@ -8,13 +8,13 @@ set -e
. ./test-lib.sh
setup_initgit
setup_gitgit
setup_git_remote
setup_git_checkout
(
set -e
cd git-git
git checkout -q --track -b work origin
cd git_checkout
git checkout -q -t origin/master -b work
echo "some work done on a branch" >> test
git add test; git commit -q -m "branch work"
echo "some other work done on a branch" >> test
......@@ -26,12 +26,12 @@ setup_gitgit
git config rietveld.server localhost:10000
test_expect_success "git-cl status has no issue" \
"$GIT_CL_STATUS | grep -q 'no issue'"
"$GIT_CL_STATUS | grep -q 'No issue assigned'"
# Prevent the editor from coming up when you upload.
export EDITOR=$(which true)
test_expect_success "upload succeeds (needs a server running on localhost)" \
"$GIT_CL upload --no-oauth2 -m test master | \
"$GIT_CL upload --no-oauth2 -t test master | \
grep -q 'Issue created'"
test_expect_success "git-cl status now knows the issue" \
......@@ -40,27 +40,28 @@ setup_gitgit
# Check to see if the description contains the local commit messages.
# Should contain 'branch work' x 2.
test_expect_success "git-cl status has the right description for the log" \
"$GIT_CL_STATUS --field desc | [ $( egrep -q '^branch work$' -c ) -eq 2 ]
"[ $($GIT_CL_STATUS --field desc | egrep '^branch work$' -c) -eq 2 ]"
test_expect_success "git-cl status has the right subject from message" \
"$GIT_CL_STATUS --field desc | \
[ $( egrep -q '^test$' --byte-offset) | grep '^0:' ]
"$GIT_CL_STATUS --field desc | head -n 1 | grep -q '^test$'"
test_expect_success "git-cl push ok" \
"$GIT_CL push -f --no-oauth2"
test_expect_success "git-cl land ok" \
"$GIT_CL land --bypass-hooks"
git checkout -q master > /dev/null 2>&1
git pull -q > /dev/null 2>&1
git fetch origin
git checkout origin/master
test_expect_success "committed code has proper summary" \
"[ $(git log -n 1 --pretty=format:%s | egrep '^test$' -c) -eq 1 ]"
test_expect_success "committed code has proper description" \
"git show | [ $( egrep -q '^branch work$' -c ) -eq 2 ]
"[ $(git log -n 1 --pretty=format:%b | egrep '^branch work$' -c) -eq 2 ]"
test_expect_success "issue no longer has a branch" \
"$GIT_CL_STATUS | grep -q 'work : None'"
# # Have to sleep to let the server return the new status.
# sleep 5
# test_expect_success "branch issue is closed" \
# "$GIT_CL_STATUS | grep -q 'work :.*closed'"
cd $GITREPO_PATH
test_expect_success "upstream repo has our commit" \
"git log master 2>/dev/null | [ $( egrep -q '^branch work$' -c ) -eq 2 ]
)
SUCCESS=$?
......
#!/usr/bin/env bash
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Renaming a file should show up as a rename in the review.
set -e
. ./test-lib.sh
setup_initsvn
setup_gitsvn
(
set -e
cd git-svn
git config rietveld.server localhost:10000
# Create a branch, rename a file, upload it.
git checkout -q -b rename
git mv test test2
git commit -q -m "renamed"
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds" \
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
# Look at the uploaded patch and verify it is a rename patch.
echo "Rename test not fully implemented yet. :("
exit 1
)
SUCCESS=$?
cleanup
if [ $SUCCESS == 0 ]; then
echo PASS
fi
......@@ -17,12 +17,12 @@ if [ -e "$BACKUP_FILE" ]; then
mv "$BACKUP_FILE" "$BACKUP_FILE_TMP"
fi
setup_initgit
setup_gitgit
setup_git_remote
setup_git_checkout
(
set -e
cd git-git
cd git_checkout
DESC="this is the description"
......
......@@ -12,12 +12,12 @@ set -e
. ./test-lib.sh
setup_initsvn
setup_gitsvn
setup_git_remote
setup_git_checkout
(
set -e
cd git-svn
cd git_checkout
git config rietveld.server localhost:10000
# Create a branch and give it an issue.
......@@ -29,8 +29,8 @@ setup_gitsvn
export GIT_EDITOR=$(which true)
test_expect_success "upload succeeds" \
"$GIT_CL upload --no-oauth2 -m test master | grep -q 'Issue created'"
test_expect_success "git-cl dcommits ok" \
"$GIT_CL dcommit -f --no-oauth2"
test_expect_success "git-cl lands ok" \
"$GIT_CL land -f --no-oauth2"
)
SUCCESS=$?
......
#!/usr/bin/env bash
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
set -e
SCRIPT_DIR=$(cd $(dirname "$BASH_SOURCE") && pwd)
cd ${SCRIPT_DIR}
. ./test-lib.sh
setup_initsvn
setup_gitsvn_submodule
(
set -e
prev_svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \
sed s/^.*:// | xargs`
cd git-svn-submodule
git config rietveld.server localhost:1
git checkout -q --track -b work
echo "some work done" >> test
git add test; git commit -q -m "work \
TBR=foo"
git_diff=`git diff HEAD^ | sed -n '/^@@/,$p' | xargs`
test_expect_success "dcommitted code" \
"$GIT_CL dcommit --no-oauth2 -f --bypass-hooks -m 'dcommit'"
cd ..
next_svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \
sed s/^.*:// | xargs`
test_expect_success "svn got new revision" \
"test $next_svn_revision = `expr $prev_svn_revision + 1`"
svn_diff=`svn diff -c $next_svn_revision file://$PWD/svnrepo | \
sed -n '/^@@/,$p' | xargs`
test_expect_success "svn diff is correct" \
"test \"$git_diff\" = \"$svn_diff\""
cd git-svn-submodule
git svn fetch
last_svn_rev=`git show refs/remotes/origin/trunk | grep git-svn-id: | \
grep -o trunk@[0-9]* | xargs`
test_expect_success "git svn fetch gets new svn revision" \
"test $last_svn_rev = trunk@$next_svn_revision"
)
SUCCESS=$?
#cleanup
if [ $SUCCESS == 0 ]; then
echo PASS
fi
......@@ -11,90 +11,20 @@ export DEPOT_TOOLS_UPDATE=0
export PYTHONUNBUFFERED=
PWD=$(pwd)
REPO_URL=file://$PWD/svnrepo
TRUNK_URL=$REPO_URL/trunk
BRANCH_URL=$REPO_URL/branches/some_branch
GITREPO_PATH=$PWD/gitrepo
GITREPO_PATH=$PWD/git_remote
GITREPO_URL=file://$GITREPO_PATH
PATH="$(dirname $PWD):$PATH"
GIT_CL=$(dirname $PWD)/git-cl
GIT_CL_STATUS="$GIT_CL status -f"
# Set up an SVN repo that has a few commits to trunk.
setup_initsvn() {
echo "Setting up test SVN repo..."
rm -rf svnrepo
svnadmin create svnrepo
# Need this in order for Mac SnowLeopard to work
echo "enable-rep-sharing = false" >> svnrepo/db/fsfs.conf
svn mkdir -q -m 'creating trunk' --parents $TRUNK_URL
rm -rf svn
svn co -q $TRUNK_URL svn
(
cd svn
echo "test" > test
svn add -q test
svn commit -q -m "initial commit"
echo "test2" >> test
svn commit -q -m "second commit"
)
svn cp -q -m 'branching' --parents $TRUNK_URL $BRANCH_URL
}
# Set up a git-svn checkout of the repo.
setup_gitsvn() {
echo "Setting up test git-svn repo..."
rm -rf git-svn
# There appears to be no way to make git-svn completely shut up, so we
# redirect its output.
# clone with --prefix origin/ to ensure the same behaviour with old and new
# versions of git (The default prefix was "" prior to Git 2.0)
git svn --prefix origin/ -q clone -s $REPO_URL git-svn >/dev/null 2>&1
(
cd git-svn
git remote add origin https://example.com/fake_refspec
git config user.name 'TestDood'
git config user.email 'TestDood@example.com'
)
}
# Set up a git-svn checkout of the repo and apply merge commits
# (like the submodule repo layout).
setup_gitsvn_submodule() {
echo "Setting up test remote git-svn-submodule repo..."
rm -rf git-svn-submodule
# clone with --prefix origin/ to ensure the same behaviour with old and new
# versions of git (The default prefix was "" prior to Git 2.0)
git svn --prefix origin/ -q clone -s $REPO_URL git-svn-submodule >/dev/null 2>&1
svn_revision=`svn info file://$PWD/svnrepo | grep ^Revision | \
sed s/^.*:// | xargs`
(
cd git-svn-submodule
git config user.name 'TestDood'
git config user.email 'TestDood@example.com'
echo 'merge-file line 1' > merge-file
git add merge-file; git commit -q -m 'First non-svn commit on master'
git checkout -q refs/remotes/origin/trunk
git merge -q --no-commit --no-ff refs/heads/master >/dev/null 2>&1
echo 'merge-edit-file line 1' > merge-edit-file
git add merge-edit-file
git commit -q -m "SVN changes up to revision $svn_revision"
git update-ref refs/heads/master HEAD
git checkout master
)
}
# Set up a git repo that has a few commits to master.
setup_initgit() {
setup_git_remote() {
echo "Setting up test upstream git repo..."
rm -rf gitrepo
mkdir gitrepo
rm -rf git_remote
mkdir git_remote
(
cd gitrepo
cd git_remote
git init -q
git config user.name 'TestDood'
git config user.email 'TestDood@example.com'
......@@ -110,19 +40,19 @@ setup_initgit() {
}
# Set up a git checkout of the repo.
setup_gitgit() {
setup_git_checkout() {
echo "Setting up test git repo..."
rm -rf git-git
git clone -q $GITREPO_URL git-git
rm -rf git_checkout
git clone -q $GITREPO_URL git_checkout
(
cd git-git
cd git_checkout
git config user.name 'TestDood'
git config user.email 'TestDood@example.com'
)
}
cleanup() {
rm -rf gitrepo svnrepo svn git-git git-svn git-svn-submodule
rm -rf git_remote git_checkout
}
# Usage: test_expect_success "description of test" "test code".
......
......@@ -8,12 +8,12 @@ set -e
. ./test-lib.sh
setup_initgit
setup_gitgit
setup_git_remote
setup_git_checkout
(
set -e
cd git-git
cd git_checkout
git checkout -q -b work HEAD^
git checkout -q -t -b work2 work
echo "some work done on a branch that tracks a local branch" >> test
......
......@@ -8,12 +8,12 @@ set -e
. ./test-lib.sh
setup_initgit
setup_gitgit
setup_git_remote
setup_git_checkout
(
set -e
cd git-git
cd git_checkout
git checkout -q -b work HEAD^
echo "some work done on a branch" >> test
git add test; git commit -q -m "branch work"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment