Skip to contentSkip to conversation

remote-hg, remote-bzr fixes

PATCH Superseded Richard Hansen 3 participants 56 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

cover remote-hg, remote-bzr fixes

A handful of fixes for the git-remote-hg and git-remote-bzr remote helpers and their unit tests.

Richard Hansen (7):
remote-hg: don't decode UTF-8 paths into Unicode objects test-bzr.sh, test-hg.sh: allow running from any dir test-bzr.sh, test-hg.sh: prepare for change to push.default=simple test-hg.sh: eliminate 'local' bashism
test-hg.sh: avoid obsolete 'test' syntax
test-hg.sh: help user correlate verbose output with email test remote-bzr, remote-hg: fix email address regular expression

 contrib/remote-helpers/git-remote-bzr |  7 +++----
 contrib/remote-helpers/git-remote-hg  |  9 ++++-----
 contrib/remote-helpers/test-bzr.sh    |  6 +++++-
 contrib/remote-helpers/test-hg.sh     | 31 ++++++++++++++++++-------------
 4 files changed, 30 insertions(+), 23 deletions(-)
Signature · 1 line
1.8.5.rc1.207.gc17dd22
#1 lore raw

PATCH 1/7 remote-hg: don't decode UTF-8 paths into Unicode objects

The internal mercurial API expects ordinary 8-bit string objects, not Unicode string objects. With this change, the test-hg.sh unit tests pass again.

---
 contrib/remote-helpers/git-remote-hg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/remote-helpers/git-remote-hg +1 -1
index 3222afd..c6026b9 100755
@@ -747,7 +747,7 @@ def parse_commit(parser):
             f = { 'deleted' : True }
         else:
             die('Unknown file command: %s' % line)
-        path = c_style_unescape(path).decode('utf-8')
+        path = c_style_unescape(path)
         files[path] = f
 
     # only export the commits if we are on an internal proxy repo
Signature · 1 line
1.8.5.rc1.207.gc17dd22
#2 lore raw

RE: [PATCH 1/7] remote-hg: don't decode UTF-8 paths into Unicode objects

Quoted 3 lines · Richard Hansen

The internal mercurial API expects ordinary 8-bit string objects, not Unicode string objects. With this change, the test-hg.sh unit tests pass again.

This makes sense to me, but the tests are already passing for me. How are they failing for you?

Signature · 1 line
Felipe Contreras
#3 lore raw

Re: [PATCH 1/7] remote-hg: don't decode UTF-8 paths into Unicode objects

Quoted 7 lines · Felipe Contreras
Quoted 3 lines · Richard Hansen

The internal mercurial API expects ordinary 8-bit string objects, not Unicode string objects. With this change, the test-hg.sh unit tests pass again.

This makes sense to me, but the tests are already passing for me. How are they failing for you?

$ hg --version | head -n 1
Mercurial Distributed SCM (version 2.2.2)
$ cd ~/git/t
$ ../contrib/remote-helpers/test-hg.sh --verbose --immediate
...
Traceback (most recent call last):
  File "~/git/contrib/remote-helpers/git-remote-hg", line 1246, in <module>
    sys.exit(main(sys.argv))
  File "~/git/contrib/remote-helpers/git-remote-hg", line 1230, in main
    do_export(parser)
  File "~/git/contrib/remote-helpers/git-remote-hg", line 1031, in do_export
    parse_commit(parser)
  File "~/git/contrib/remote-helpers/git-remote-hg", line 822, in
parse_commit
    node = hghex(repo.commitctx(ctx))
  File "/usr/lib/python2.7/dist-packages/mercurial/localrepo.py", line
1270, in commitctx
    p2.manifestnode(), (new, drop))
  File "/usr/lib/python2.7/dist-packages/mercurial/manifest.py", line
197, in add
    cachedelta = (self.rev(p1), addlistdelta(addlist, delta))
  File "/usr/lib/python2.7/dist-packages/mercurial/manifest.py", line
124, in addlistdelta
    addlist[start:end] = array.array('c', content)
TypeError: array item must be char
not ok 4 - update bookmark

I can put the above in the commit message if people would like it there.

-Richard

#4 lore raw

Re: [PATCH 1/7] remote-hg: don't decode UTF-8 paths into Unicode objects

Quoted 6 lines · Richard Hansen
Quoted 5 lines · Felipe Contreras
Quoted 3 lines · Richard Hansen

The internal mercurial API expects ordinary 8-bit string objects, not Unicode string objects. With this change, the test-hg.sh unit tests pass again.

Quoted 7 lines
Quoted 2 lines

This makes sense to me, but the tests are already passing for me. How are they failing for you?

$ hg --version | head -n 1
Mercurial Distributed SCM (version 2.2.2)
$ cd ~/git/t
$ ../contrib/remote-helpers/test-hg.sh --verbose --immediate

Ah, I see they are failing now (v 2.8). I don't know what I was testing.

FWIW my tree doesn't have this problem [1].

Quoted 1 line

I can put the above in the commit message if people would like it there.

Personally I think it's overkill. You mentioned the tests failed, that's enough explanation. I just wanted to see if that was actually the case.

[1] https://travis-ci.org/felipec/git-travis

Signature · 1 line
Felipe Contreras
#5 lore raw

PATCH 2/7 test-bzr.sh, test-hg.sh: allow running from any dir

In reply to Richard Hansen

cd to the t/ subdirectory so that the user doesn't already have to be in the test directory to run these test scripts.

---
 contrib/remote-helpers/test-bzr.sh | 1 +
 contrib/remote-helpers/test-hg.sh  | 1 +
 2 files changed, 2 insertions(+)
contrib/remote-helpers/test-bzr.sh +1 -0
index 5c50251..094062c 100755
@@ -5,6 +5,7 @@
 
 test_description='Test remote-bzr'
 
+cd "${0%/*}"/../../t || exit 1
 . ./test-lib.sh
 
 if ! test_have_prereq PYTHON
contrib/remote-helpers/test-hg.sh +1 -0
index 72f745d..dbe0eec 100755
@@ -8,6 +8,7 @@
 
 test_description='Test remote-hg'
 
+cd "${0%/*}"/../../t || exit 1
 . ./test-lib.sh
 
 if ! test_have_prereq PYTHON
Signature · 1 line
1.8.5.rc1.207.gc17dd22
#6 lore raw

RE: [PATCH 2/7] test-bzr.sh, test-hg.sh: allow running from any dir

Quoted 14 lines · Richard Hansen

cd to the t/ subdirectory so that the user doesn't already have to be in the test directory to run these test scripts.

---
 contrib/remote-helpers/test-bzr.sh | 1 +
 contrib/remote-helpers/test-hg.sh  | 1 +
 2 files changed, 2 insertions(+)
contrib/remote-helpers/test-bzr.sh +0 -0
index 5c50251..094062c 100755

contrib/remote-helpers/test-bzr.sh line 8

Quoted 4 lines
contrib/remote-helpers/test-bzr.sh +1 -0
@@ -5,6 +5,7 @@
 
 test_description='Test remote-bzr'
 
+cd "${0%/*}"/../../t || exit 1

I think this should do the trick:

  test -z "$TEST_DIRECTORY" && TEST_DIRECTORY="$(realpath ${0%/*}/../../t)"
  . "$TEST_DIRECTORY"/test-lib.sh
Signature · 1 line
Felipe Contreras
#7 lore raw

Re: [PATCH 2/7] test-bzr.sh, test-hg.sh: allow running from any dir

Quoted 16 lines · Felipe Contreras
Quoted 15 lines · Richard Hansen

cd to the t/ subdirectory so that the user doesn't already have to be in the test directory to run these test scripts.

---
 contrib/remote-helpers/test-bzr.sh | 1 +
 contrib/remote-helpers/test-hg.sh  | 1 +
 2 files changed, 2 insertions(+)
contrib/remote-helpers/test-bzr.sh +0 -0
index 5c50251..094062c 100755
@@ -5,6 +5,7 @@
 
Quoted 8 lines

contrib/remote-helpers/test-bzr.sh line 8

Quoted 3 lines
contrib/remote-helpers/test-bzr.sh +1 -0
 test_description='Test remote-bzr'
 
+cd "${0%/*}"/../../t || exit 1

I think this should do the trick:

  test -z "$TEST_DIRECTORY" && TEST_DIRECTORY="$(realpath ${0%/*}/../../t)"
  . "$TEST_DIRECTORY"/test-lib.sh

Can we do that without using realpath(1)? I do not think we use it anywhere in the main part of the project.

#8 lore raw

Re: [PATCH 2/7] test-bzr.sh, test-hg.sh: allow running from any dir

Quoted 24 lines · Junio C Hamano
Quoted 22 lines · Felipe Contreras
Quoted 14 lines · Richard Hansen

cd to the t/ subdirectory so that the user doesn't already have to be in the test directory to run these test scripts.

---
 contrib/remote-helpers/test-bzr.sh | 1 +
 contrib/remote-helpers/test-hg.sh  | 1 +
 2 files changed, 2 insertions(+)
contrib/remote-helpers/test-bzr.sh +0 -0
index 5c50251..094062c 100755

contrib/remote-helpers/test-bzr.sh line 8

Quoted 4 lines
contrib/remote-helpers/test-bzr.sh +1 -0
@@ -5,6 +5,7 @@
 
 test_description='Test remote-bzr'
 
+cd "${0%/*}"/../../t || exit 1

I think this should do the trick:

Quoted 5 lines
Quoted 2 lines
  test -z "$TEST_DIRECTORY" && TEST_DIRECTORY="$(realpath ${0%/*}/../../t)"
  . "$TEST_DIRECTORY"/test-lib.sh

Can we do that without using realpath(1)? I do not think we use it anywhere in the main part of the project.

Something like this, probably:

t/test-lib.sh +2 -0
@@ -26,6 +26,8 @@ then
        # outside of t/, e.g. for running tests on the test library
        # itself.
        TEST_DIRECTORY=$(pwd)
+else
+       TEST_DIRECTORY=$(cd $TEST_DIRECTORY && pwd)
 fi
 if test -z "$TEST_OUTPUT_DIRECTORY"
 then

Then we can do:

test -z "$TEST_DIRECTORY" && TEST_DIRECTORY="${0%/*}/../../t" . "$TEST_DIRECTORY"/test-lib.sh

Signature · 1 line
Felipe Contreras
#9 lore raw

PATCH 3/7 test-bzr.sh, test-hg.sh: prepare for change to push.default=simple

In reply to Richard Hansen

Change 'git push' to 'git push -u <remote> <branch>' in one of the test-bzr.sh tests to ensure that the test continues to pass when the default value of push.default changes to simple.

Also, explicitly set push.default to simple to silence warnings when using --verbose.

---
 contrib/remote-helpers/test-bzr.sh | 5 ++++-
 contrib/remote-helpers/test-hg.sh  | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
contrib/remote-helpers/test-bzr.sh +4 -1
index 094062c..ea597b0 100755
@@ -28,6 +28,9 @@ check () {
 
 bzr whoami "A U Thor <[email protected]>"
 
+# silence warnings
+git config --global push.default simple
+
 test_expect_success 'cloning' '
 	(
 	bzr init bzrrepo &&
@@ -379,7 +382,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 -u bzr master
 	) &&
 
 	(
contrib/remote-helpers/test-hg.sh +3 -0
index dbe0eec..53f2bba 100755
@@ -102,6 +102,9 @@ setup () {
 	GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230" &&
 	GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" &&
 	export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
+
+	# silence warnings
+	git config --global push.default simple
 }
 
 setup
Signature · 1 line
1.8.5.rc1.207.gc17dd22
#10 lore raw

RE: [PATCH 3/7] test-bzr.sh, test-hg.sh: prepare for change to push.default=simple

Quoted 3 lines · Richard Hansen

Change 'git push' to 'git push -u <remote> <branch>' in one of the test-bzr.sh tests to ensure that the test continues to pass when the default value of push.default changes to simple.

This makes sense.

Quoted 2 lines

Also, explicitly set push.default to simple to silence warnings when using --verbose.

This doesn't. Run the tests in t/* and you would seen tons and tons of those warnings, if they should be avoided, they should be avoided for all the tests, why only these?

I say drop the second part. Yes it's annoying, but we have to deal with it.

Signature · 1 line
Felipe Contreras
#11 lore raw

Re: [PATCH 3/7] test-bzr.sh, test-hg.sh: prepare for change to push.default=simple

Quoted 7 lines · Felipe Contreras
Quoted 3 lines · Richard Hansen

Change 'git push' to 'git push -u <remote> <branch>' in one of the test-bzr.sh tests to ensure that the test continues to pass when the default value of push.default changes to simple.

This makes sense.

Quoted 8 lines
Quoted 2 lines

Also, explicitly set push.default to simple to silence warnings when using --verbose.

This doesn't. Run the tests in t/* and you would seen tons and tons of those warnings, if they should be avoided, they should be avoided for all the tests, why only these?

I say drop the second part. Yes it's annoying, but we have to deal with it.

OK, will do.

Thanks,
Richard

#12 lore raw

Re: [PATCH 3/7] test-bzr.sh, test-hg.sh: prepare for change to push.default=simple

In reply to Richard Hansen

contrib/remote-helpers/test-bzr.sh test_expect_success 'export utf-8 authors' ' · line 386

Quoted 7 lines · Richard Hansen
contrib/remote-helpers/test-bzr.sh +1 -1
@@ -379,7 +382,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 -u bzr master
        ) &&

Actually, why -u? Isn't 'git push bzr master' enough?

Signature · 1 line
Felipe Contreras
#13 lore raw

Re: [PATCH 3/7] test-bzr.sh, test-hg.sh: prepare for change to push.default=simple

Quoted 11 lines · Felipe Contreras

contrib/remote-helpers/test-bzr.sh test_expect_success 'export utf-8 authors' ' · line 386

Quoted 7 lines · Richard Hansen
contrib/remote-helpers/test-bzr.sh +1 -1
@@ -379,7 +382,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 -u bzr master
        ) &&

Actually, why -u? Isn't 'git push bzr master' enough?

It's defensive in case that test is ever updated to do more pushing. I can leave it out in the reroll.

-Richard

#14 lore raw

Re: [PATCH 3/7] test-bzr.sh, test-hg.sh: prepare for change to push.default=simple

Quoted 13 lines · Richard Hansen
Quoted 11 lines · Felipe Contreras

contrib/remote-helpers/test-bzr.sh test_expect_success 'export utf-8 authors' ' · line 386

Quoted 7 lines · Richard Hansen
contrib/remote-helpers/test-bzr.sh +1 -1
@@ -379,7 +382,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 -u bzr master
        ) &&

Actually, why -u? Isn't 'git push bzr master' enough?

Quoted 2 lines

It's defensive in case that test is ever updated to do more pushing. I can leave it out in the reroll.

Please do. If there's any need for that we can add it later, but even then I would prefer that the push explicit again, like this one. And suspect we will not need to update this in that direction.

Signature · 1 line
Felipe Contreras
#15 lore raw

PATCH 4/7 test-hg.sh: eliminate 'local' bashism

In reply to Richard Hansen

Unlike bash, POSIX shell does not specify a 'local' command for declaring function-local variable scope. Except for IFS, the variable names are not used anywhere else in the script so simply remove the 'local'. For IFS, move the assignment to the 'read' command to prevent it from affecting code outside the function.

---
 contrib/remote-helpers/test-hg.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/remote-helpers/test-hg.sh +2 -2
index 53f2bba..558a656 100755
@@ -54,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')
Signature · 1 line
1.8.5.rc1.207.gc17dd22
#16 lore raw

RE: [PATCH 4/7] test-hg.sh: eliminate 'local' bashism

Quoted 5 lines · Richard Hansen

Unlike bash, POSIX shell does not specify a 'local' command for declaring function-local variable scope. Except for IFS, the variable names are not used anywhere else in the script so simply remove the 'local'. For IFS, move the assignment to the 'read' command to prevent it from affecting code outside the function.

Makes sense.

Signature · 1 line
Felipe Contreras
#17 lore raw

PATCH 5/7 test-hg.sh: avoid obsolete 'test' syntax

In reply to Richard Hansen

The POSIX spec says that the '-a', '-o', and parentheses operands to the 'test' utility are obsolete extensions due to the potential for ambiguity. Replace '-o' with '|| test' to avoid unspecified behavior.

---
 contrib/remote-helpers/test-hg.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/remote-helpers/test-hg.sh +1 -1
index 558a656..84c67ff 100755
@@ -83,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
Signature · 1 line
1.8.5.rc1.207.gc17dd22
#18 lore raw

RE: [PATCH 5/7] test-hg.sh: avoid obsolete 'test' syntax

Quoted 3 lines · Richard Hansen

The POSIX spec says that the '-a', '-o', and parentheses operands to the 'test' utility are obsolete extensions due to the potential for ambiguity. Replace '-o' with '|| test' to avoid unspecified behavior.

All right, if you say so.

Signature · 1 line
Felipe Contreras
#19 lore raw

Re: [PATCH 5/7] test-hg.sh: avoid obsolete 'test' syntax

Quoted 6 lines · Felipe Contreras
Quoted 3 lines · Richard Hansen

The POSIX spec says that the '-a', '-o', and parentheses operands to the 'test' utility are obsolete extensions due to the potential for ambiguity. Replace '-o' with '|| test' to avoid unspecified behavior.

All right, if you say so.

In case you're curious about what the spec says:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_16

-Richard

#20 lore raw

Re: [PATCH 5/7] test-hg.sh: avoid obsolete 'test' syntax

Quoted 11 lines · Richard Hansen
Quoted 6 lines · Felipe Contreras
Quoted 3 lines · Richard Hansen

The POSIX spec says that the '-a', '-o', and parentheses operands to the 'test' utility are obsolete extensions due to the potential for ambiguity. Replace '-o' with '|| test' to avoid unspecified behavior.

All right, if you say so.

In case you're curious about what the spec says:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_16

Thanks, I didn't know the POSIX spec was available publicly.

Signature · 1 line
Felipe Contreras
#21 lore raw

PATCH 6/7 test-hg.sh: help user correlate verbose output with email test

In reply to Richard Hansen

It's hard to tell which author conversion test failed when the email addresses look similar.

---
 contrib/remote-helpers/test-hg.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
contrib/remote-helpers/test-hg.sh +10 -10
index 84c67ff..5eda265 100755
@@ -209,16 +209,16 @@ test_expect_success 'authors' '
 
 	>../expected &&
 	author_test alpha "" "H G Wells <[email protected]>" &&
-	author_test beta "test" "test <unknown>" &&
-	author_test beta "test <[email protected]> (comment)" "test <[email protected]>" &&
-	author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
-	author_test delta "name<[email protected]>" "name <[email protected]>" &&
-	author_test epsilon "name <[email protected]" "name <[email protected]>" &&
-	author_test zeta " test " "test <unknown>" &&
-	author_test eta "test < [email protected] >" "test <[email protected]>" &&
-	author_test theta "test >[email protected]>" "test <[email protected]>" &&
-	author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
-	author_test kappa "[email protected]" "Unknown <[email protected]>"
+	author_test beta "beta" "beta <unknown>" &&
+	author_test beta "beta <[email protected]> (comment)" "beta <[email protected]>" &&
+	author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
+	author_test delta "delta<[email protected]>" "delta <[email protected]>" &&
+	author_test epsilon "epsilon <[email protected]" "epsilon <[email protected]>" &&
+	author_test zeta " zeta " "zeta <unknown>" &&
+	author_test eta "eta < [email protected] >" "eta <[email protected]>" &&
+	author_test theta "theta >[email protected]>" "theta <[email protected]>" &&
+	author_test iota "iota < test <at> example <dot> com>" "iota <unknown>" &&
+	author_test kappa "[email protected]" "Unknown <[email protected]>"
 	) &&
 
 	git clone "hg::hgrepo" gitrepo &&
Signature · 1 line
1.8.5.rc1.207.gc17dd22
#22 lore raw

RE: [PATCH 6/7] test-hg.sh: help user correlate verbose output with email test

Quoted 18 lines · Richard Hansen

It's hard to tell which author conversion test failed when the email addresses look similar.

---
 contrib/remote-helpers/test-hg.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
contrib/remote-helpers/test-hg.sh +0 -2
index 84c67ff..5eda265 100755
@@ -209,16 +209,16 @@ test_expect_success 'authors' '
 
 	>../expected &&
 	author_test alpha "" "H G Wells <[email protected]>" &&
-	author_test beta "test" "test <unknown>" &&
-	author_test beta "test <[email protected]> (comment)" "test <[email protected]>" &&

contrib/remote-helpers/test-hg.sh test_expect_success 'authors' ' · line 213

Quoted 10 lines
contrib/remote-helpers/test-hg.sh +2 -8
-	author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
-	author_test delta "name<[email protected]>" "name <[email protected]>" &&
-	author_test epsilon "name <[email protected]" "name <[email protected]>" &&
-	author_test zeta " test " "test <unknown>" &&
-	author_test eta "test < [email protected] >" "test <[email protected]>" &&
-	author_test theta "test >[email protected]>" "test <[email protected]>" &&
-	author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
-	author_test kappa "[email protected]" "Unknown <[email protected]>"
+	author_test beta "beta" "beta <unknown>" &&
+	author_test beta "beta <[email protected]> (comment)" "beta <[email protected]>" &&

Two betas?

Quoted 11 lines
contrib/remote-helpers/test-hg.sh +8 -0
+	author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
+	author_test delta "delta<[email protected]>" "delta <[email protected]>" &&
+	author_test epsilon "epsilon <[email protected]" "epsilon <[email protected]>" &&
+	author_test zeta " zeta " "zeta <unknown>" &&
+	author_test eta "eta < [email protected] >" "eta <[email protected]>" &&
+	author_test theta "theta >[email protected]>" "theta <[email protected]>" &&
+	author_test iota "iota < test <at> example <dot> com>" "iota <unknown>" &&
+	author_test kappa "[email protected]" "Unknown <[email protected]>"
 	) &&
 
 	git clone "hg::hgrepo" gitrepo &&
Signature · 1 line
Felipe Contreras
#23 lore raw

Re: [PATCH 6/7] test-hg.sh: help user correlate verbose output with email test

Quoted 15 lines · Felipe Contreras
Quoted 14 lines · Richard Hansen

It's hard to tell which author conversion test failed when the email addresses look similar.

---
 contrib/remote-helpers/test-hg.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
contrib/remote-helpers/test-hg.sh +0 -0
index 84c67ff..5eda265 100755
@@ -209,16 +209,16 @@ test_expect_success 'authors' '
 
Quoted 4 lines

contrib/remote-helpers/test-hg.sh test_expect_success 'authors' ' · line 213

Quoted 4 lines
contrib/remote-helpers/test-hg.sh +0 -2
 	>../expected &&
 	author_test alpha "" "H G Wells <[email protected]>" &&
-	author_test beta "test" "test <unknown>" &&
-	author_test beta "test <[email protected]> (comment)" "test <[email protected]>" &&

Notice the two betas here in the original code.

Quoted 4 lines
Quoted 4 lines
contrib/remote-helpers/test-hg.sh +0 -4
-	author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
-	author_test delta "name<[email protected]>" "name <[email protected]>" &&
-	author_test epsilon "name <[email protected]" "name <[email protected]>" &&
-	author_test zeta " test " "test <unknown>" &&
Quoted 8 lines

contrib/remote-helpers/test-hg.sh test_expect_success 'authors' ' · line 213

Quoted 6 lines
contrib/remote-helpers/test-hg.sh +2 -4
-	author_test eta "test < [email protected] >" "test <[email protected]>" &&
-	author_test theta "test >[email protected]>" "test <[email protected]>" &&
-	author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
-	author_test kappa "[email protected]" "Unknown <[email protected]>"
+	author_test beta "beta" "beta <unknown>" &&
+	author_test beta "beta <[email protected]> (comment)" "beta <[email protected]>" &&

Two betas?

See above. I can change them to beta1 and beta2, or if you'd prefer I can change them to beta and gamma and increment the subsequent entries.

Thanks,
Richard

Quoted 13 lines
Quoted 12 lines
contrib/remote-helpers/test-hg.sh +8 -0
+	author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
+	author_test delta "delta<[email protected]>" "delta <[email protected]>" &&
+	author_test epsilon "epsilon <[email protected]" "epsilon <[email protected]>" &&
+	author_test zeta " zeta " "zeta <unknown>" &&
+	author_test eta "eta < [email protected] >" "eta <[email protected]>" &&
+	author_test theta "theta >[email protected]>" "theta <[email protected]>" &&
+	author_test iota "iota < test <at> example <dot> com>" "iota <unknown>" &&
+	author_test kappa "[email protected]" "Unknown <[email protected]>"
 	) &&
 
 	git clone "hg::hgrepo" gitrepo &&
#24 lore raw

Re: [PATCH 6/7] test-hg.sh: help user correlate verbose output with email test

Quoted 16 lines · Richard Hansen
Quoted 15 lines · Felipe Contreras
Quoted 14 lines · Richard Hansen

It's hard to tell which author conversion test failed when the email addresses look similar.

---
 contrib/remote-helpers/test-hg.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
contrib/remote-helpers/test-hg.sh +0 -0
index 84c67ff..5eda265 100755
@@ -209,16 +209,16 @@ test_expect_success 'authors' '
 
Quoted 6 lines
Quoted 4 lines

contrib/remote-helpers/test-hg.sh test_expect_success 'authors' ' · line 213

Quoted 4 lines
contrib/remote-helpers/test-hg.sh +0 -2
     >../expected &&
     author_test alpha "" "H G Wells <[email protected]>" &&
-    author_test beta "test" "test <unknown>" &&
-    author_test beta "test <[email protected]> (comment)" "test <[email protected]>" &&

Notice the two betas here in the original code.

Ahh, that's a bug.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
contrib/remote-helpers/test-hg.sh +2 -8
-    author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
-    author_test delta "name<[email protected]>" "name <[email protected]>" &&
-    author_test epsilon "name <[email protected]" "name <[email protected]>" &&
-    author_test zeta " test " "test <unknown>" &&
-    author_test eta "test < [email protected] >" "test <[email protected]>" &&
-    author_test theta "test >[email protected]>" "test <[email protected]>" &&
-    author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
-    author_test kappa "[email protected]" "Unknown <[email protected]>"
+    author_test beta "beta" "beta <unknown>" &&
+    author_test beta "beta <[email protected]> (comment)" "beta <[email protected]>" &&
Quoted 4 lines
Quoted 1 line

Two betas?

See above. I can change them to beta1 and beta2, or if you'd prefer I can change them to beta and gamma and increment the subsequent entries.

Yeah, I would prefer that in two patches, one that fixes the sequence, and the other one that changes the emails. If you don't have time for that the original patch is OK by me. The problem with the sequence can be fixed later.

Cheers.

Signature · 1 line
Felipe Contreras
#25 lore raw

Re: [PATCH 6/7] test-hg.sh: help user correlate verbose output with email test

Quoted 37 lines · Felipe Contreras
Quoted 16 lines · Richard Hansen
Quoted 15 lines · Felipe Contreras
Quoted 14 lines · Richard Hansen

It's hard to tell which author conversion test failed when the email addresses look similar.

---
 contrib/remote-helpers/test-hg.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
contrib/remote-helpers/test-hg.sh +0 -0
index 84c67ff..5eda265 100755
@@ -209,16 +209,16 @@ test_expect_success 'authors' '
 
Quoted 6 lines
Quoted 4 lines

contrib/remote-helpers/test-hg.sh test_expect_success 'authors' ' · line 213

Quoted 4 lines
contrib/remote-helpers/test-hg.sh +0 -2
     >../expected &&
     author_test alpha "" "H G Wells <[email protected]>" &&
-    author_test beta "test" "test <unknown>" &&
-    author_test beta "test <[email protected]> (comment)" "test <[email protected]>" &&

Notice the two betas here in the original code.

Ahh, that's a bug.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
contrib/remote-helpers/test-hg.sh +2 -8
-    author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
-    author_test delta "name<[email protected]>" "name <[email protected]>" &&
-    author_test epsilon "name <[email protected]" "name <[email protected]>" &&
-    author_test zeta " test " "test <unknown>" &&
-    author_test eta "test < [email protected] >" "test <[email protected]>" &&
-    author_test theta "test >[email protected]>" "test <[email protected]>" &&
-    author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
-    author_test kappa "[email protected]" "Unknown <[email protected]>"
+    author_test beta "beta" "beta <unknown>" &&
+    author_test beta "beta <[email protected]> (comment)" "beta <[email protected]>" &&
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Two betas?

See above. I can change them to beta1 and beta2, or if you'd prefer I can change them to beta and gamma and increment the subsequent entries.

Yeah, I would prefer that in two patches, one that fixes the sequence, and the other one that changes the emails.

Will do.

Thanks,
Richard

Quoted 6 lines

If you don't have time for
that the original patch is OK by me. The problem with the sequence can be fixed later.

Cheers.

#26 lore raw

PATCH 7/7 remote-bzr, remote-hg: fix email address regular expression

In reply to Richard Hansen

Before, strings like "[email protected]" would be converted to "foo. <[email protected]>" when they should be "unknown <[email protected]>".

---
 contrib/remote-helpers/git-remote-bzr | 7 +++----
 contrib/remote-helpers/git-remote-hg  | 7 +++----
 contrib/remote-helpers/test-hg.sh     | 3 ++-
 3 files changed, 8 insertions(+), 9 deletions(-)
contrib/remote-helpers/git-remote-bzr +3 -4
index 054161a..7e34532 100755
@@ -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:
contrib/remote-helpers/git-remote-hg +3 -4
index c6026b9..30402d5 100755
@@ -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:
contrib/remote-helpers/test-hg.sh +2 -1
index 5eda265..9f5066b 100755
@@ -218,7 +218,8 @@ test_expect_success 'authors' '
 	author_test eta "eta < [email protected] >" "eta <[email protected]>" &&
 	author_test theta "theta >[email protected]>" "theta <[email protected]>" &&
 	author_test iota "iota < test <at> example <dot> com>" "iota <unknown>" &&
-	author_test kappa "[email protected]" "Unknown <[email protected]>"
+	author_test kappa "[email protected]" "Unknown <[email protected]>" &&
+	author_test lambda "[email protected]" "Unknown <[email protected]>"
 	) &&
 
 	git clone "hg::hgrepo" gitrepo &&
Signature · 1 line
1.8.5.rc1.207.gc17dd22
#28 lore raw
In reply to Richard Hansen
Quoted 12 lines · Richard Hansen

A handful of fixes for the git-remote-hg and git-remote-bzr remote helpers and their unit tests.

Richard Hansen (7):
remote-hg: don't decode UTF-8 paths into Unicode objects test-bzr.sh, test-hg.sh: allow running from any dir test-bzr.sh, test-hg.sh: prepare for change to push.default=simple test-hg.sh: eliminate 'local' bashism
test-hg.sh: avoid obsolete 'test' syntax
test-hg.sh: help user correlate verbose output with email test remote-bzr, remote-hg: fix email address regular expression

Quoted 5 lines
 contrib/remote-helpers/git-remote-bzr |  7 +++----
 contrib/remote-helpers/git-remote-hg  |  9 ++++-----
 contrib/remote-helpers/test-bzr.sh    |  6 +++++-
 contrib/remote-helpers/test-hg.sh     | 31 ++++++++++++++++++-------------
 4 files changed, 30 insertions(+), 23 deletions(-)

I'll defer to Felipe for the meat of the logic in these scripts; the POSIXify part of the fixes look all good to me.

I see there already are review comments, so let me know when the reviews have settled with a final reroll.

Thanks.

#29 lore raw

v2 cover remote-hg, remote-bzr fixes

In reply to Richard Hansen

A handful of fixes for the git-remote-hg and git-remote-bzr remote helpers and their unit tests.

Changes from v1:

contrib/remote-helpers/test-bzr.sh +3 -6
index ea597b0..1e53ff9 100755
@@ -5,8 +5,8 @@
 
 test_description='Test remote-bzr'
 
-cd "${0%/*}"/../../t || exit 1
-. ./test-lib.sh
+test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=${0%/*}/../../t
+. "$TEST_DIRECTORY"/test-lib.sh
 
 if ! test_have_prereq PYTHON
 then
@@ -28,9 +28,6 @@ check () {
 
 bzr whoami "A U Thor <[email protected]>"
 
-# silence warnings
-git config --global push.default simple
-
 test_expect_success 'cloning' '
 	(
 	bzr init bzrrepo &&
@@ -382,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 -u bzr master
+	git push bzr master
 	) &&
 
 	(
contrib/remote-helpers/test-hg.sh +12 -15
index 9f5066b..347e812 100755
@@ -8,8 +8,8 @@
 
 test_description='Test remote-hg'
 
-cd "${0%/*}"/../../t || exit 1
-. ./test-lib.sh
+test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=${0%/*}/../../t
+. "$TEST_DIRECTORY"/test-lib.sh
 
 if ! test_have_prereq PYTHON
 then
@@ -102,9 +102,6 @@ setup () {
 	GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0230" &&
 	GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" &&
 	export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
-
-	# silence warnings
-	git config --global push.default simple
 }
 
 setup
@@ -210,16 +207,16 @@ test_expect_success 'authors' '
 	>../expected &&
 	author_test alpha "" "H G Wells <[email protected]>" &&
 	author_test beta "beta" "beta <unknown>" &&
-	author_test beta "beta <[email protected]> (comment)" "beta <[email protected]>" &&
-	author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
-	author_test delta "delta<[email protected]>" "delta <[email protected]>" &&
-	author_test epsilon "epsilon <[email protected]" "epsilon <[email protected]>" &&
-	author_test zeta " zeta " "zeta <unknown>" &&
-	author_test eta "eta < [email protected] >" "eta <[email protected]>" &&
-	author_test theta "theta >[email protected]>" "theta <[email protected]>" &&
-	author_test iota "iota < test <at> example <dot> com>" "iota <unknown>" &&
-	author_test kappa "[email protected]" "Unknown <[email protected]>" &&
-	author_test lambda "[email protected]" "Unknown <[email protected]>"
+	author_test gamma "gamma <[email protected]> (comment)" "gamma <[email protected]>" &&
+	author_test delta "<[email protected]>" "Unknown <[email protected]>" &&
+	author_test epsilon "epsilon<[email protected]>" "epsilon <[email protected]>" &&
+	author_test zeta "zeta <[email protected]" "zeta <[email protected]>" &&
+	author_test eta " eta " "eta <unknown>" &&
+	author_test theta "theta < [email protected] >" "theta <[email protected]>" &&
+	author_test iota "iota >[email protected]>" "iota <[email protected]>" &&
+	author_test kappa "kappa < test <at> example <dot> com>" "kappa <unknown>" &&
+	author_test lambda "[email protected]" "Unknown <[email protected]>" &&
+	author_test mu "[email protected]" "Unknown <[email protected]>"
 	) &&
 
 	git clone "hg::hgrepo" gitrepo &&
t/test-lib.sh +4 -0
index b25249e..af172d9 100644
@@ -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
+	# works even if the current working directory is changed
+	TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
 fi
 if test -z "$TEST_OUTPUT_DIRECTORY"
 then

Richard Hansen (9):
remote-hg: don't decode UTF-8 paths into Unicode objects test-lib.sh: convert $TEST_DIRECTORY to an absolute path test-bzr.sh, test-hg.sh: allow running from any dir test-bzr.sh, test-hg.sh: prepare for change to push.default=simple test-hg.sh: eliminate 'local' bashism
test-hg.sh: avoid obsolete 'test' syntax
test-hg.sh: fix duplicate content strings in author tests test-hg.sh: help user correlate verbose output with email test remote-bzr, remote-hg: fix email address regular expression

 contrib/remote-helpers/git-remote-bzr |  7 +++----
 contrib/remote-helpers/git-remote-hg  |  9 ++++-----
 contrib/remote-helpers/test-bzr.sh    |  5 +++--
 contrib/remote-helpers/test-hg.sh     | 30 ++++++++++++++++--------------
 t/test-lib.sh                         |  4 ++++
 5 files changed, 30 insertions(+), 25 deletions(-)
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#30 lore raw

PATCH v2 1/9 remote-hg: don't decode UTF-8 paths into Unicode objects

The internal mercurial API expects ordinary 8-bit string objects, not Unicode string objects. With this change, the test-hg.sh unit tests pass again.

---
 contrib/remote-helpers/git-remote-hg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/remote-helpers/git-remote-hg +1 -1
index 3222afd..c6026b9 100755
@@ -747,7 +747,7 @@ def parse_commit(parser):
             f = { 'deleted' : True }
         else:
             die('Unknown file command: %s' % line)
-        path = c_style_unescape(path).decode('utf-8')
+        path = c_style_unescape(path)
         files[path] = f
 
     # only export the commits if we are on an internal proxy repo
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#31 lore raw

PATCH v2 2/9 test-lib.sh: convert $TEST_DIRECTORY to an absolute path

In reply to Richard Hansen

If $TEST_DIRECTORY is specified in the environment, convert the value to an absolute path to ensure that it remains valid even when 'cd' is used.

---
 t/test-lib.sh | 4 ++++
 1 file changed, 4 insertions(+)
t/test-lib.sh +4 -0
index b25249e..af172d9 100644
@@ -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
+	# works even if the current working directory is changed
+	TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
 fi
 if test -z "$TEST_OUTPUT_DIRECTORY"
 then
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#32 lore raw

Re: [PATCH v2 2/9] test-lib.sh: convert $TEST_DIRECTORY to an absolute path

Quoted 5 lines · Richard Hansen

If $TEST_DIRECTORY is specified in the environment, convert the value to an absolute path to ensure that it remains valid even when 'cd' is used.

Actually, credit for this and the next patch should go to Felipe. How should I note that?

Thanks,
Richard

Quoted 19 lines
---
 t/test-lib.sh | 4 ++++
 1 file changed, 4 insertions(+)
t/test-lib.sh +4 -0
index b25249e..af172d9 100644
@@ -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
+	# works even if the current working directory is changed
+	TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
 fi
 if test -z "$TEST_OUTPUT_DIRECTORY"
 then
#33 lore raw

Re: [PATCH v2 2/9] test-lib.sh: convert $TEST_DIRECTORY to an absolute path

Quoted 9 lines · Richard Hansen
Quoted 5 lines · Richard Hansen

If $TEST_DIRECTORY is specified in the environment, convert the value to an absolute path to ensure that it remains valid even when 'cd' is used.

Actually, credit for this and the next patch should go to Felipe. How should I note that?

Normally what I would do is put myself as the author, but not s-o-b, but since now I'm telling you you can add my s-o-b, you can do that.

I would have sent those patches myself, if Junio agreed that was the way to go, but I didn't see that.

Cheers.

Signature · 1 line
Felipe Contreras
#34 lore raw

Re: [PATCH v2 2/9] test-lib.sh: convert $TEST_DIRECTORY to an absolute path

In reply to Richard Hansen
Quoted 9 lines · Richard Hansen
Quoted 5 lines · Richard Hansen

If $TEST_DIRECTORY is specified in the environment, convert the value to an absolute path to ensure that it remains valid even when 'cd' is used.

Actually, credit for this and the next patch should go to Felipe. How should I note that?

If the patch text was copied from his response message, you would start the _body_ of your e-mail as:

From: F.. C.. <[email protected]>

If $TEST_DIRECTORY is specified ...

_after_ getting him say it is OK to add his Sign-off. The first line in the body of your e-mail, "From: Real Author", followed by a blank line, will signal to "git am" that you are forwarding a patch by somebody else, and we record that real author on the "author" line of the resulting commit object.

On the other hand, if the patch is based on the _idea_ you gained by discussing with him, you would just mention it near your sign-off, like this:

	If $TEST_DIRECTORY is specified ...

	Helped-by: F... C... <[email protected]>
	Signed-off-by: R... Hansen <rhansen@...>
Quoted 24 lines

Thanks,
Richard

Quoted 19 lines
---
 t/test-lib.sh | 4 ++++
 1 file changed, 4 insertions(+)
t/test-lib.sh +4 -0
index b25249e..af172d9 100644
@@ -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
+	# works even if the current working directory is changed
+	TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
 fi
 if test -z "$TEST_OUTPUT_DIRECTORY"
 then
#35 lore raw

PATCH v2 3/9 test-bzr.sh, test-hg.sh: allow running from any dir

In reply to Richard Hansen

Set TEST_DIRECTORY to the t/ directory (if TEST_DIRECTORY is not already set) so that the user doesn't already have to be in the test directory to run these test scripts.

---
 contrib/remote-helpers/test-bzr.sh | 3 ++-
 contrib/remote-helpers/test-hg.sh  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
contrib/remote-helpers/test-bzr.sh +2 -1
index 5c50251..1e850c3 100755
@@ -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
contrib/remote-helpers/test-hg.sh +2 -1
index 72f745d..fa7d17b 100755
@@ -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
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#36 lore raw

PATCH v2 4/9 test-bzr.sh, test-hg.sh: prepare for change to push.default=simple

In reply to Richard Hansen

Change 'git push <remote>' to 'git push <remote> <branch>' in one of the test-bzr.sh tests to ensure that the test continues to pass when the default value of push.default changes to simple.

---
 contrib/remote-helpers/test-bzr.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/remote-helpers/test-bzr.sh +1 -1
index 1e850c3..1e53ff9 100755
@@ -379,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
 	) &&
 
 	(
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#37 lore raw

PATCH v2 5/9 test-hg.sh: eliminate 'local' bashism

In reply to Richard Hansen

Unlike bash, POSIX shell does not specify a 'local' command for declaring function-local variable scope. Except for IFS, the variable names are not used anywhere else in the script so simply remove the 'local'. For IFS, move the assignment to the 'read' command to prevent it from affecting code outside the function.

---
 contrib/remote-helpers/test-hg.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/remote-helpers/test-hg.sh +2 -2
index fa7d17b..ceef6b1 100755
@@ -54,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')
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#38 lore raw

PATCH v2 6/9 test-hg.sh: avoid obsolete 'test' syntax

In reply to Richard Hansen

The POSIX spec says that the '-a', '-o', and parentheses operands to the 'test' utility are obsolete extensions due to the potential for ambiguity. Replace '-o' with '|| test' to avoid unspecified behavior.

---
 contrib/remote-helpers/test-hg.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/remote-helpers/test-hg.sh +1 -1
index ceef6b1..5535e8c 100755
@@ -83,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
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#39 lore raw

PATCH v2 7/9 test-hg.sh: fix duplicate content strings in author tests

In reply to Richard Hansen

"beta" was used twice. Change the second copy to "gamma" and increment the remaining content strings.

---
 contrib/remote-helpers/test-hg.sh | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
contrib/remote-helpers/test-hg.sh +9 -9
index 5535e8c..eb72db8 100755
@@ -207,15 +207,15 @@ test_expect_success 'authors' '
 	>../expected &&
 	author_test alpha "" "H G Wells <[email protected]>" &&
 	author_test beta "test" "test <unknown>" &&
-	author_test beta "test <[email protected]> (comment)" "test <[email protected]>" &&
-	author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
-	author_test delta "name<[email protected]>" "name <[email protected]>" &&
-	author_test epsilon "name <[email protected]" "name <[email protected]>" &&
-	author_test zeta " test " "test <unknown>" &&
-	author_test eta "test < [email protected] >" "test <[email protected]>" &&
-	author_test theta "test >[email protected]>" "test <[email protected]>" &&
-	author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
-	author_test kappa "[email protected]" "Unknown <[email protected]>"
+	author_test gamma "test <[email protected]> (comment)" "test <[email protected]>" &&
+	author_test delta "<[email protected]>" "Unknown <[email protected]>" &&
+	author_test epsilon "name<[email protected]>" "name <[email protected]>" &&
+	author_test zeta "name <[email protected]" "name <[email protected]>" &&
+	author_test eta " test " "test <unknown>" &&
+	author_test theta "test < [email protected] >" "test <[email protected]>" &&
+	author_test iota "test >[email protected]>" "test <[email protected]>" &&
+	author_test kappa "test < test <at> example <dot> com>" "test <unknown>" &&
+	author_test lambda "[email protected]" "Unknown <[email protected]>"
 	) &&
 
 	git clone "hg::hgrepo" gitrepo &&
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#40 lore raw

PATCH v2 8/9 test-hg.sh: help user correlate verbose output with email test

In reply to Richard Hansen

It's hard to tell which author conversion test failed when the email addresses look similar.

---
 contrib/remote-helpers/test-hg.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
contrib/remote-helpers/test-hg.sh +10 -10
index eb72db8..642ad93 100755
@@ -206,16 +206,16 @@ test_expect_success 'authors' '
 
 	>../expected &&
 	author_test alpha "" "H G Wells <[email protected]>" &&
-	author_test beta "test" "test <unknown>" &&
-	author_test gamma "test <[email protected]> (comment)" "test <[email protected]>" &&
-	author_test delta "<[email protected]>" "Unknown <[email protected]>" &&
-	author_test epsilon "name<[email protected]>" "name <[email protected]>" &&
-	author_test zeta "name <[email protected]" "name <[email protected]>" &&
-	author_test eta " test " "test <unknown>" &&
-	author_test theta "test < [email protected] >" "test <[email protected]>" &&
-	author_test iota "test >[email protected]>" "test <[email protected]>" &&
-	author_test kappa "test < test <at> example <dot> com>" "test <unknown>" &&
-	author_test lambda "[email protected]" "Unknown <[email protected]>"
+	author_test beta "beta" "beta <unknown>" &&
+	author_test gamma "gamma <[email protected]> (comment)" "gamma <[email protected]>" &&
+	author_test delta "<[email protected]>" "Unknown <[email protected]>" &&
+	author_test epsilon "epsilon<[email protected]>" "epsilon <[email protected]>" &&
+	author_test zeta "zeta <[email protected]" "zeta <[email protected]>" &&
+	author_test eta " eta " "eta <unknown>" &&
+	author_test theta "theta < [email protected] >" "theta <[email protected]>" &&
+	author_test iota "iota >[email protected]>" "iota <[email protected]>" &&
+	author_test kappa "kappa < test <at> example <dot> com>" "kappa <unknown>" &&
+	author_test lambda "[email protected]" "Unknown <[email protected]>"
 	) &&
 
 	git clone "hg::hgrepo" gitrepo &&
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#41 lore raw

PATCH v2 9/9 remote-bzr, remote-hg: fix email address regular expression

In reply to Richard Hansen

Before, strings like "[email protected]" would be converted to "foo. <[email protected]>" when they should be "unknown <[email protected]>".

---
 contrib/remote-helpers/git-remote-bzr | 7 +++----
 contrib/remote-helpers/git-remote-hg  | 7 +++----
 contrib/remote-helpers/test-hg.sh     | 3 ++-
 3 files changed, 8 insertions(+), 9 deletions(-)
contrib/remote-helpers/git-remote-bzr +3 -4
index 054161a..7e34532 100755
@@ -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:
contrib/remote-helpers/git-remote-hg +3 -4
index c6026b9..30402d5 100755
@@ -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:
contrib/remote-helpers/test-hg.sh +2 -1
index 642ad93..347e812 100755
@@ -215,7 +215,8 @@ test_expect_success 'authors' '
 	author_test theta "theta < [email protected] >" "theta <[email protected]>" &&
 	author_test iota "iota >[email protected]>" "iota <[email protected]>" &&
 	author_test kappa "kappa < test <at> example <dot> com>" "kappa <unknown>" &&
-	author_test lambda "[email protected]" "Unknown <[email protected]>"
+	author_test lambda "[email protected]" "Unknown <[email protected]>" &&
+	author_test mu "[email protected]" "Unknown <[email protected]>"
 	) &&
 
 	git clone "hg::hgrepo" gitrepo &&
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#42 lore raw
In reply to Richard Hansen
Quoted 2 lines · Richard Hansen

A handful of fixes for the git-remote-hg and git-remote-bzr remote helpers and their unit tests.

I'm OK with the whole series.

Signature · 1 line
Felipe Contreras
#43 lore raw
In reply to Richard Hansen
Quoted 2 lines · Richard Hansen

A handful of fixes for the git-remote-hg and git-remote-bzr remote helpers and their unit tests.

Thanks; could you arrange with Felipe so that we can have
Acked-by: or Reviewed-by: after your Signed-off-by: lines of these patches?

#44 lore raw

v3 cover remote-hg, remote-bzr fixes

In reply to Richard Hansen

A handful of fixes for the git-remote-hg and git-remote-bzr remote helpers and their unit tests.

Changes from v2:
* changed the author on the following patches to Felipe Contreras:
- [2/9] test-lib.sh: convert $TEST_DIRECTORY to an absolute path
- [3/9] test-bzr.sh, test-hg.sh: allow running from any dir
* added 'Reviewed-by: Felipe Contreras <[email protected]>' to the other patches
* made the following comment change:

t/test-lib.sh +1 -1
index af172d9..d303e6c 100644
@@ -28,7 +28,7 @@ then
 	TEST_DIRECTORY=$(pwd)
 else
 	# ensure that TEST_DIRECTORY is an absolute path so that it
-	# works even if the current working directory is changed
+	# 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"

Felipe Contreras (2):
test-lib.sh: convert $TEST_DIRECTORY to an absolute path test-bzr.sh, test-hg.sh: allow running from any dir

Richard Hansen (7):
remote-hg: don't decode UTF-8 paths into Unicode objects test-bzr.sh, test-hg.sh: prepare for change to push.default=simple test-hg.sh: eliminate 'local' bashism
test-hg.sh: avoid obsolete 'test' syntax
test-hg.sh: fix duplicate content strings in author tests test-hg.sh: help user correlate verbose output with email test remote-bzr, remote-hg: fix email address regular expression

 contrib/remote-helpers/git-remote-bzr |  7 +++----
 contrib/remote-helpers/git-remote-hg  |  9 ++++-----
 contrib/remote-helpers/test-bzr.sh    |  5 +++--
 contrib/remote-helpers/test-hg.sh     | 30 ++++++++++++++++--------------
 t/test-lib.sh                         |  4 ++++
 5 files changed, 30 insertions(+), 25 deletions(-)
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#45 lore raw

PATCH v3 1/9 remote-hg: don't decode UTF-8 paths into Unicode objects

The internal mercurial API expects ordinary 8-bit string objects, not Unicode string objects. With this change, the test-hg.sh unit tests pass again.

---
 contrib/remote-helpers/git-remote-hg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/remote-helpers/git-remote-hg +1 -1
index 3222afd..c6026b9 100755
@@ -747,7 +747,7 @@ def parse_commit(parser):
             f = { 'deleted' : True }
         else:
             die('Unknown file command: %s' % line)
-        path = c_style_unescape(path).decode('utf-8')
+        path = c_style_unescape(path)
         files[path] = f
 
     # only export the commits if we are on an internal proxy repo
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#46 lore raw

PATCH v3 2/9 test-lib.sh: convert $TEST_DIRECTORY to an absolute path

In reply to Richard Hansen

From: Felipe Contreras <[email protected]>

If $TEST_DIRECTORY is specified in the environment, convert the value to an absolute path to ensure that it remains valid even when 'cd' is used.

---
 t/test-lib.sh | 4 ++++
 1 file changed, 4 insertions(+)
t/test-lib.sh +4 -0
index b25249e..d303e6c 100644
@@ -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
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#47 lore raw

PATCH v3 3/9 test-bzr.sh, test-hg.sh: allow running from any dir

In reply to Richard Hansen

From: Felipe Contreras <[email protected]>

Set TEST_DIRECTORY to the t/ directory (if TEST_DIRECTORY is not already set) so that the user doesn't already have to be in the test directory to run these test scripts.

---
 contrib/remote-helpers/test-bzr.sh | 3 ++-
 contrib/remote-helpers/test-hg.sh  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
contrib/remote-helpers/test-bzr.sh +2 -1
index 5c50251..1e850c3 100755
@@ -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
contrib/remote-helpers/test-hg.sh +2 -1
index 72f745d..fa7d17b 100755
@@ -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
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#48 lore raw

PATCH v3 4/9 test-bzr.sh, test-hg.sh: prepare for change to push.default=simple

In reply to Richard Hansen

Change 'git push <remote>' to 'git push <remote> <branch>' in one of the test-bzr.sh tests to ensure that the test continues to pass when the default value of push.default changes to simple.

---
 contrib/remote-helpers/test-bzr.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/remote-helpers/test-bzr.sh +1 -1
index 1e850c3..1e53ff9 100755
@@ -379,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
 	) &&
 
 	(
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#49 lore raw

PATCH v3 5/9 test-hg.sh: eliminate 'local' bashism

In reply to Richard Hansen

Unlike bash, POSIX shell does not specify a 'local' command for declaring function-local variable scope. Except for IFS, the variable names are not used anywhere else in the script so simply remove the 'local'. For IFS, move the assignment to the 'read' command to prevent it from affecting code outside the function.

---
 contrib/remote-helpers/test-hg.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
contrib/remote-helpers/test-hg.sh +2 -2
index fa7d17b..ceef6b1 100755
@@ -54,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')
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#50 lore raw

PATCH v3 6/9 test-hg.sh: avoid obsolete 'test' syntax

In reply to Richard Hansen

The POSIX spec says that the '-a', '-o', and parentheses operands to the 'test' utility are obsolete extensions due to the potential for ambiguity. Replace '-o' with '|| test' to avoid unspecified behavior.

---
 contrib/remote-helpers/test-hg.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
contrib/remote-helpers/test-hg.sh +1 -1
index ceef6b1..5535e8c 100755
@@ -83,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
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#51 lore raw

PATCH v3 7/9 test-hg.sh: fix duplicate content strings in author tests

In reply to Richard Hansen

"beta" was used twice. Change the second copy to "gamma" and increment the remaining content strings.

---
 contrib/remote-helpers/test-hg.sh | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
contrib/remote-helpers/test-hg.sh +9 -9
index 5535e8c..eb72db8 100755
@@ -207,15 +207,15 @@ test_expect_success 'authors' '
 	>../expected &&
 	author_test alpha "" "H G Wells <[email protected]>" &&
 	author_test beta "test" "test <unknown>" &&
-	author_test beta "test <[email protected]> (comment)" "test <[email protected]>" &&
-	author_test gamma "<[email protected]>" "Unknown <[email protected]>" &&
-	author_test delta "name<[email protected]>" "name <[email protected]>" &&
-	author_test epsilon "name <[email protected]" "name <[email protected]>" &&
-	author_test zeta " test " "test <unknown>" &&
-	author_test eta "test < [email protected] >" "test <[email protected]>" &&
-	author_test theta "test >[email protected]>" "test <[email protected]>" &&
-	author_test iota "test < test <at> example <dot> com>" "test <unknown>" &&
-	author_test kappa "[email protected]" "Unknown <[email protected]>"
+	author_test gamma "test <[email protected]> (comment)" "test <[email protected]>" &&
+	author_test delta "<[email protected]>" "Unknown <[email protected]>" &&
+	author_test epsilon "name<[email protected]>" "name <[email protected]>" &&
+	author_test zeta "name <[email protected]" "name <[email protected]>" &&
+	author_test eta " test " "test <unknown>" &&
+	author_test theta "test < [email protected] >" "test <[email protected]>" &&
+	author_test iota "test >[email protected]>" "test <[email protected]>" &&
+	author_test kappa "test < test <at> example <dot> com>" "test <unknown>" &&
+	author_test lambda "[email protected]" "Unknown <[email protected]>"
 	) &&
 
 	git clone "hg::hgrepo" gitrepo &&
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#52 lore raw

PATCH v3 8/9 test-hg.sh: help user correlate verbose output with email test

In reply to Richard Hansen

It's hard to tell which author conversion test failed when the email addresses look similar.

---
 contrib/remote-helpers/test-hg.sh | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
contrib/remote-helpers/test-hg.sh +10 -10
index eb72db8..642ad93 100755
@@ -206,16 +206,16 @@ test_expect_success 'authors' '
 
 	>../expected &&
 	author_test alpha "" "H G Wells <[email protected]>" &&
-	author_test beta "test" "test <unknown>" &&
-	author_test gamma "test <[email protected]> (comment)" "test <[email protected]>" &&
-	author_test delta "<[email protected]>" "Unknown <[email protected]>" &&
-	author_test epsilon "name<[email protected]>" "name <[email protected]>" &&
-	author_test zeta "name <[email protected]" "name <[email protected]>" &&
-	author_test eta " test " "test <unknown>" &&
-	author_test theta "test < [email protected] >" "test <[email protected]>" &&
-	author_test iota "test >[email protected]>" "test <[email protected]>" &&
-	author_test kappa "test < test <at> example <dot> com>" "test <unknown>" &&
-	author_test lambda "[email protected]" "Unknown <[email protected]>"
+	author_test beta "beta" "beta <unknown>" &&
+	author_test gamma "gamma <[email protected]> (comment)" "gamma <[email protected]>" &&
+	author_test delta "<[email protected]>" "Unknown <[email protected]>" &&
+	author_test epsilon "epsilon<[email protected]>" "epsilon <[email protected]>" &&
+	author_test zeta "zeta <[email protected]" "zeta <[email protected]>" &&
+	author_test eta " eta " "eta <unknown>" &&
+	author_test theta "theta < [email protected] >" "theta <[email protected]>" &&
+	author_test iota "iota >[email protected]>" "iota <[email protected]>" &&
+	author_test kappa "kappa < test <at> example <dot> com>" "kappa <unknown>" &&
+	author_test lambda "[email protected]" "Unknown <[email protected]>"
 	) &&
 
 	git clone "hg::hgrepo" gitrepo &&
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#53 lore raw

PATCH v3 9/9 remote-bzr, remote-hg: fix email address regular expression

In reply to Richard Hansen

Before, strings like "[email protected]" would be converted to "foo. <[email protected]>" when they should be "unknown <[email protected]>".

---
 contrib/remote-helpers/git-remote-bzr | 7 +++----
 contrib/remote-helpers/git-remote-hg  | 7 +++----
 contrib/remote-helpers/test-hg.sh     | 3 ++-
 3 files changed, 8 insertions(+), 9 deletions(-)
contrib/remote-helpers/git-remote-bzr +3 -4
index 054161a..7e34532 100755
@@ -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:
contrib/remote-helpers/git-remote-hg +3 -4
index c6026b9..30402d5 100755
@@ -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:
contrib/remote-helpers/test-hg.sh +2 -1
index 642ad93..347e812 100755
@@ -215,7 +215,8 @@ test_expect_success 'authors' '
 	author_test theta "theta < [email protected] >" "theta <[email protected]>" &&
 	author_test iota "iota >[email protected]>" "iota <[email protected]>" &&
 	author_test kappa "kappa < test <at> example <dot> com>" "kappa <unknown>" &&
-	author_test lambda "[email protected]" "Unknown <[email protected]>"
+	author_test lambda "[email protected]" "Unknown <[email protected]>" &&
+	author_test mu "[email protected]" "Unknown <[email protected]>"
 	) &&
 
 	git clone "hg::hgrepo" gitrepo &&
Signature · 1 line
1.8.5.rc1.208.g8ff7964
#55 lore raw
In reply to Richard Hansen
Quoted 10 lines · Richard Hansen

A handful of fixes for the git-remote-hg and git-remote-bzr remote helpers and their unit tests.

Changes from v2:
* changed the author on the following patches to Felipe Contreras:
- [2/9] test-lib.sh: convert $TEST_DIRECTORY to an absolute path
- [3/9] test-bzr.sh, test-hg.sh: allow running from any dir
* added 'Reviewed-by: Felipe Contreras <[email protected]>' to the other patches
* made the following comment change:

Thanks, both; will requeue.