Skip to content

Commit 8f87d54

Browse files
committed
Merge branch 'fc/remote-helper-fixes'
* fc/remote-helper-fixes: remote-bzr: trivial test fix remote-bzr: include authors field in pushed commits remote-bzr: add support for older versions remote-hg: always normalize paths remote-helpers: allow all tests running from any dir
2 parents 961c1b1 + 7569acc commit 8f87d54

File tree

5 files changed

+34
-5
lines changed

5 files changed

+34
-5
lines changed

contrib/remote-helpers/git-remote-bzr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,12 @@ def parse_commit(parser):
618618
files[path] = f
619619

620620
committer, date, tz = committer
621+
author, _, _ = author
621622
parents = [mark_to_rev(p) for p in parents]
622623
revid = bzrlib.generate_ids.gen_revision_id(committer, date)
623624
props = {}
624625
props['branch-nick'] = branch.nick
626+
props['authors'] = author
625627

626628
mtree = CustomTree(branch, revid, parents, files)
627629
changes = mtree.iter_changes()
@@ -784,7 +786,7 @@ def clone(path, remote_branch):
784786
def get_remote_branch(name):
785787
remote_branch = bzrlib.branch.Branch.open(branches[name],
786788
possible_transports=transports)
787-
if isinstance(remote_branch.user_transport, bzrlib.transport.local.LocalTransport):
789+
if isinstance(remote_branch.bzrdir.root_transport, bzrlib.transport.local.LocalTransport):
788790
return remote_branch
789791

790792
branch_path = os.path.join(dirname, 'clone', name)
@@ -867,7 +869,7 @@ def get_repo(url, alias):
867869
if not wanted:
868870
try:
869871
repo = origin.open_repository()
870-
if not repo.user_transport.listable():
872+
if not repo.bzrdir.root_transport.listable():
871873
# this repository is not usable for us
872874
raise bzrlib.errors.NoRepositoryPresent(repo.bzrdir)
873875
except bzrlib.errors.NoRepositoryPresent:

contrib/remote-helpers/git-remote-hg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ class Parser:
260260
return (user, int(date), -tz)
261261

262262
def fix_file_path(path):
263+
path = os.path.normpath(path)
263264
if not os.path.isabs(path):
264265
return path
265266
return os.path.relpath(path, '/')

contrib/remote-helpers/test-bzr.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ test_expect_success 'strip' '
382382
'
383383

384384
test_expect_success 'export utf-8 authors' '
385-
test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C && unset GIT_COMMITTER_NAME" &&
385+
test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C && GIT_COMMITTER_NAME=\"C O Mitter\""
386386
387387
LC_ALL=en_US.UTF-8
388388
export LC_ALL
@@ -411,4 +411,28 @@ test_expect_success 'export utf-8 authors' '
411411
test_cmp expected actual
412412
'
413413

414+
test_expect_success 'push different author' '
415+
test_when_finished "rm -rf bzrrepo gitrepo" &&
416+
417+
bzr init bzrrepo &&
418+
419+
(
420+
git init gitrepo &&
421+
cd gitrepo &&
422+
echo john >> content &&
423+
git add content &&
424+
git commit -m john --author "John Doe <[email protected]>" &&
425+
git remote add bzr "bzr::../bzrrepo" &&
426+
git push bzr master
427+
) &&
428+
429+
(
430+
cd bzrrepo &&
431+
bzr log | grep "^author: " > ../actual
432+
) &&
433+
434+
echo "author: John Doe <[email protected]>" > expected &&
435+
test_cmp expected actual
436+
'
437+
414438
test_done

contrib/remote-helpers/test-hg-bidi.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
test_description='Test bidirectionality of 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

contrib/remote-helpers/test-hg-hg-git.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
test_description='Test remote-hg output compared to hg-git'
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

0 commit comments

Comments
 (0)