Skip to content

Commit ef63eb5

Browse files
committed
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
2 parents 128c5d0 + 6c68a40 commit ef63eb5

File tree

5 files changed

+29
-24
lines changed

5 files changed

+29
-24
lines changed

contrib/remote-helpers/git-remote-bzr

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ import StringIO
4444
import atexit, shutil, hashlib, urlparse, subprocess
4545

4646
NAME_RE = re.compile('^([^<>]+)')
47-
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
48-
EMAIL_RE = re.compile('^([^<>]+[^ \\\t<>])?\\b(?:[ \\t<>]*?)\\b([^ \\t<>]+@[^ \\t<>]+)')
47+
AUTHOR_RE = re.compile('^([^<>]+?)? ?[<>]([^<>]*)(?:$|>)')
48+
EMAIL_RE = re.compile(r'([^ \t<>]+@[^ \t<>]+)')
4949
RAW_AUTHOR_RE = re.compile('^(\w+) (.+)? <(.*)> (\d+) ([+-]\d+)')
5050

5151
def die(msg, *args):
@@ -193,8 +193,7 @@ def fixup_user(user):
193193
else:
194194
m = EMAIL_RE.match(user)
195195
if m:
196-
name = m.group(1)
197-
mail = m.group(2)
196+
mail = m.group(1)
198197
else:
199198
m = NAME_RE.match(user)
200199
if m:

contrib/remote-helpers/git-remote-hg

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ import time as ptime
5151
#
5252

5353
NAME_RE = re.compile('^([^<>]+)')
54-
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
55-
EMAIL_RE = re.compile('^([^<>]+[^ \\\t<>])?\\b(?:[ \\t<>]*?)\\b([^ \\t<>]+@[^ \\t<>]+)')
54+
AUTHOR_RE = re.compile('^([^<>]+?)? ?[<>]([^<>]*)(?:$|>)')
55+
EMAIL_RE = re.compile(r'([^ \t<>]+@[^ \t<>]+)')
5656
AUTHOR_HG_RE = re.compile('^(.*?) ?<(.*?)(?:>(.+)?)?$')
5757
RAW_AUTHOR_RE = re.compile('^(\w+) (?:(.+)? )?<(.*)> (\d+) ([+-]\d+)')
5858

@@ -316,8 +316,7 @@ def fixup_user_git(user):
316316
else:
317317
m = EMAIL_RE.match(user)
318318
if m:
319-
name = m.group(1)
320-
mail = m.group(2)
319+
mail = m.group(1)
321320
else:
322321
m = NAME_RE.match(user)
323322
if m:

contrib/remote-helpers/test-bzr.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
test_description='Test remote-bzr'
77

8-
. ./test-lib.sh
8+
test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=${0%/*}/../../t
9+
. "$TEST_DIRECTORY"/test-lib.sh
910

1011
if ! test_have_prereq PYTHON
1112
then
@@ -378,7 +379,7 @@ test_expect_success 'export utf-8 authors' '
378379
git add content &&
379380
git commit -m one &&
380381
git remote add bzr "bzr::../bzrrepo" &&
381-
git push bzr
382+
git push bzr master
382383
) &&
383384
384385
(

contrib/remote-helpers/test-hg.sh

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
test_description='Test remote-hg'
1010

11-
. ./test-lib.sh
11+
test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=${0%/*}/../../t
12+
. "$TEST_DIRECTORY"/test-lib.sh
1213

1314
if ! test_have_prereq PYTHON
1415
then
@@ -53,14 +54,14 @@ check_bookmark () {
5354
}
5455

5556
check_push () {
56-
local expected_ret=$1 ret=0 ref_ret=0 IFS=':'
57+
expected_ret=$1 ret=0 ref_ret=0
5758

5859
shift
5960
git push origin "$@" 2>error
6061
ret=$?
6162
cat error
6263

63-
while read branch kind
64+
while IFS=':' read branch kind
6465
do
6566
case "$kind" in
6667
'new')
@@ -82,7 +83,7 @@ check_push () {
8283
test $ref_ret -ne 0 && echo "match for '$branch' failed" && break
8384
done
8485

85-
if test $expected_ret -ne $ret -o $ref_ret -ne 0
86+
if test $expected_ret -ne $ret || test $ref_ret -ne 0
8687
then
8788
return 1
8889
fi
@@ -205,16 +206,17 @@ test_expect_success 'authors' '
205206
206207
>../expected &&
207208
author_test alpha "" "H G Wells <[email protected]>" &&
208-
author_test beta "test" "test <unknown>" &&
209-
author_test beta "test <[email protected]> (comment)" "test <[email protected]>" &&
210-
author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
211-
author_test delta "name<[email protected]>" "name <[email protected]>" &&
212-
author_test epsilon "name <[email protected]" "name <[email protected]>" &&
213-
author_test zeta " test " "test <unknown>" &&
214-
author_test eta "test < [email protected] >" "test <[email protected]>" &&
215-
author_test theta "test >[email protected]>" "test <[email protected]>" &&
216-
author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
217-
author_test kappa "[email protected]" "Unknown <[email protected]>"
209+
author_test beta "beta" "beta <unknown>" &&
210+
author_test gamma "gamma <[email protected]> (comment)" "gamma <[email protected]>" &&
211+
author_test delta "<[email protected]>" "Unknown <[email protected]>" &&
212+
author_test epsilon "epsilon<[email protected]>" "epsilon <[email protected]>" &&
213+
author_test zeta "zeta <[email protected]" "zeta <[email protected]>" &&
214+
author_test eta " eta " "eta <unknown>" &&
215+
author_test theta "theta < [email protected] >" "theta <[email protected]>" &&
216+
author_test iota "iota >[email protected]>" "iota <[email protected]>" &&
217+
author_test kappa "kappa < test <at> example <dot> com>" "kappa <unknown>" &&
218+
author_test lambda "[email protected]" "Unknown <[email protected]>" &&
219+
author_test mu "[email protected]" "Unknown <[email protected]>"
218220
) &&
219221
220222
git clone "hg::hgrepo" gitrepo &&

t/test-lib.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ then
2626
# outside of t/, e.g. for running tests on the test library
2727
# itself.
2828
TEST_DIRECTORY=$(pwd)
29+
else
30+
# ensure that TEST_DIRECTORY is an absolute path so that it
31+
# is valid even if the current working directory is changed
32+
TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
2933
fi
3034
if test -z "$TEST_OUTPUT_DIRECTORY"
3135
then

0 commit comments

Comments
 (0)