提交 ef63eb55 编写于 作者: J Junio C Hamano

Merge branch 'rh/remote-hg-bzr-updates'

Updates to remote-bzr and remote-hg in contrib.

* rh/remote-hg-bzr-updates:
  remote-bzr, remote-hg: fix email address regular expression
  test-hg.sh: help user correlate verbose output with email test
  test-hg.sh: fix duplicate content strings in author tests
  test-hg.sh: avoid obsolete 'test' syntax
  test-hg.sh: eliminate 'local' bashism
  test-bzr.sh, test-hg.sh: prepare for change to push.default=simple
  test-bzr.sh, test-hg.sh: allow running from any dir
  test-lib.sh: convert $TEST_DIRECTORY to an absolute path
......@@ -44,8 +44,8 @@ import StringIO
import atexit, shutil, hashlib, urlparse, subprocess
NAME_RE = re.compile('^([^<>]+)')
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
EMAIL_RE = re.compile('^([^<>]+[^ \\\t<>])?\\b(?:[ \\t<>]*?)\\b([^ \\t<>]+@[^ \\t<>]+)')
AUTHOR_RE = re.compile('^([^<>]+?)? ?[<>]([^<>]*)(?:$|>)')
EMAIL_RE = re.compile(r'([^ \t<>]+@[^ \t<>]+)')
RAW_AUTHOR_RE = re.compile('^(\w+) (.+)? <(.*)> (\d+) ([+-]\d+)')
def die(msg, *args):
......@@ -193,8 +193,7 @@ def fixup_user(user):
else:
m = EMAIL_RE.match(user)
if m:
name = m.group(1)
mail = m.group(2)
mail = m.group(1)
else:
m = NAME_RE.match(user)
if m:
......
......@@ -51,8 +51,8 @@ import time as ptime
#
NAME_RE = re.compile('^([^<>]+)')
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
EMAIL_RE = re.compile('^([^<>]+[^ \\\t<>])?\\b(?:[ \\t<>]*?)\\b([^ \\t<>]+@[^ \\t<>]+)')
AUTHOR_RE = re.compile('^([^<>]+?)? ?[<>]([^<>]*)(?:$|>)')
EMAIL_RE = re.compile(r'([^ \t<>]+@[^ \t<>]+)')
AUTHOR_HG_RE = re.compile('^(.*?) ?<(.*?)(?:>(.+)?)?$')
RAW_AUTHOR_RE = re.compile('^(\w+) (?:(.+)? )?<(.*)> (\d+) ([+-]\d+)')
......@@ -316,8 +316,7 @@ def fixup_user_git(user):
else:
m = EMAIL_RE.match(user)
if m:
name = m.group(1)
mail = m.group(2)
mail = m.group(1)
else:
m = NAME_RE.match(user)
if m:
......
......@@ -5,7 +5,8 @@
test_description='Test remote-bzr'
. ./test-lib.sh
test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=${0%/*}/../../t
. "$TEST_DIRECTORY"/test-lib.sh
if ! test_have_prereq PYTHON
then
......@@ -378,7 +379,7 @@ test_expect_success 'export utf-8 authors' '
git add content &&
git commit -m one &&
git remote add bzr "bzr::../bzrrepo" &&
git push bzr
git push bzr master
) &&
(
......
......@@ -8,7 +8,8 @@
test_description='Test remote-hg'
. ./test-lib.sh
test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=${0%/*}/../../t
. "$TEST_DIRECTORY"/test-lib.sh
if ! test_have_prereq PYTHON
then
......@@ -53,14 +54,14 @@ check_bookmark () {
}
check_push () {
local expected_ret=$1 ret=0 ref_ret=0 IFS=':'
expected_ret=$1 ret=0 ref_ret=0
shift
git push origin "$@" 2>error
ret=$?
cat error
while read branch kind
while IFS=':' read branch kind
do
case "$kind" in
'new')
......@@ -82,7 +83,7 @@ check_push () {
test $ref_ret -ne 0 && echo "match for '$branch' failed" && break
done
if test $expected_ret -ne $ret -o $ref_ret -ne 0
if test $expected_ret -ne $ret || test $ref_ret -ne 0
then
return 1
fi
......@@ -205,16 +206,17 @@ test_expect_success 'authors' '
>../expected &&
author_test alpha "" "H G Wells <wells@example.com>" &&
author_test beta "test" "test <unknown>" &&
author_test beta "test <test@example.com> (comment)" "test <test@example.com>" &&
author_test gamma "<test@example.com>" "Unknown <test@example.com>" &&
author_test delta "name<test@example.com>" "name <test@example.com>" &&
author_test epsilon "name <test@example.com" "name <test@example.com>" &&
author_test zeta " test " "test <unknown>" &&
author_test eta "test < test@example.com >" "test <test@example.com>" &&
author_test theta "test >test@example.com>" "test <test@example.com>" &&
author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
author_test kappa "test@example.com" "Unknown <test@example.com>"
author_test beta "beta" "beta <unknown>" &&
author_test gamma "gamma <test@example.com> (comment)" "gamma <test@example.com>" &&
author_test delta "<delta@example.com>" "Unknown <delta@example.com>" &&
author_test epsilon "epsilon<test@example.com>" "epsilon <test@example.com>" &&
author_test zeta "zeta <test@example.com" "zeta <test@example.com>" &&
author_test eta " eta " "eta <unknown>" &&
author_test theta "theta < test@example.com >" "theta <test@example.com>" &&
author_test iota "iota >test@example.com>" "iota <test@example.com>" &&
author_test kappa "kappa < test <at> example <dot> com>" "kappa <unknown>" &&
author_test lambda "lambda@example.com" "Unknown <lambda@example.com>" &&
author_test mu "mu.mu@example.com" "Unknown <mu.mu@example.com>"
) &&
git clone "hg::hgrepo" gitrepo &&
......
......@@ -26,6 +26,10 @@ then
# outside of t/, e.g. for running tests on the test library
# itself.
TEST_DIRECTORY=$(pwd)
else
# ensure that TEST_DIRECTORY is an absolute path so that it
# is valid even if the current working directory is changed
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
if test -z "$TEST_OUTPUT_DIRECTORY"
then
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册