Commit e84b7541 authored by szager@chromium.org's avatar szager@chromium.org

Add test for git-svn with submodule/merge layout.

Review URL: https://chromiumcodereview.appspot.com/10543151

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@142479 0039d316-1c4b-4281-b951-d872f2087c98
parent 79245bf5
......@@ -1145,7 +1145,7 @@ def IsSubmoduleMergeCommit(ref):
# When submodules are added to the repo, we expect there to be a single
# non-git-svn merge commit at remote HEAD with a signature comment.
pattern = '^SVN changes up to revision [0-9]*$'
cmd = ['rev-list', '--merges', '--grep="%s"' % pattern, '%s^!' % ref]
cmd = ['rev-list', '--merges', '--grep=%s' % pattern, '%s^!' % ref]
return RunGit(cmd) != ''
......
#!/bin/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.
# Check that abandoning a branch also abandons its issue.
set -e
......
#!/bin/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
......
......@@ -148,7 +148,7 @@ class TestGitCl(TestCase):
((['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]*$"',
'--grep=^SVN changes up to revision [0-9]*$',
'refs/remotes/origin/master^!'],), ''),
((['git', 'update-index', '--refresh', '-q'],), ''),
((['git', 'diff-index', 'HEAD'],), ''),
......
#!/bin/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.
# Tests the "preupload and predcommit hooks" functionality, which lets you run
# hooks by installing a script into .git/hooks/pre-cl-* first.
......
#!/bin/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
......
#!/bin/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
......
#!/bin/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
......
#!/bin/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
......
#!/bin/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
......
#!/bin/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
......
#!/bin/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.
# We should save a change's description when an upload fails.
set -e
......
#!/bin/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.
# Check that we're able to submit from a directory that doesn't exist on the
# trunk. This tests for a previous bug where we ended up with an invalid CWD
# after switching to the merge branch.
......
#!/bin/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_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 -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/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
#!/bin/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.
# Abort on error.
set -e
......@@ -46,6 +50,28 @@ setup_gitsvn() {
git svn -q clone -s $REPO_URL git-svn >/dev/null 2>&1
}
# 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
git svn -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
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/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() {
echo "Setting up test upstream git repo..."
......@@ -74,7 +100,7 @@ setup_gitgit() {
}
cleanup() {
rm -rf gitrepo svnrepo svn git-git git-svn
rm -rf gitrepo svnrepo svn git-git git-svn git-svn-submodule
}
# Usage: test_expect_success "description of test" "test code".
......
#!/bin/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
......
#!/bin/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
......
#!/bin/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.
# Check guessing the svn upstream branch.
set -e
......
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