Merge branch 'fc/remote-helper-fixes'
authorJunio C Hamano <gitster@pobox.com>
Fri, 18 Apr 2014 18:17:40 +0000 (11:17 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 Apr 2014 18:17:40 +0000 (11:17 -0700)
* 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

contrib/remote-helpers/git-remote-bzr
contrib/remote-helpers/git-remote-hg
contrib/remote-helpers/test-bzr.sh
contrib/remote-helpers/test-hg-bidi.sh
contrib/remote-helpers/test-hg-hg-git.sh
index 5f4b2e3e160f60955e25f8b8fedf8c122dd5c73c..9abb58e6ab45077bf9b5e01658438817ea9b7126 100755 (executable)
@@ -618,10 +618,12 @@ def parse_commit(parser):
         files[path] = f
 
     committer, date, tz = committer
+    author, _, _ = author
     parents = [mark_to_rev(p) for p in parents]
     revid = bzrlib.generate_ids.gen_revision_id(committer, date)
     props = {}
     props['branch-nick'] = branch.nick
+    props['authors'] = author
 
     mtree = CustomTree(branch, revid, parents, files)
     changes = mtree.iter_changes()
@@ -784,7 +786,7 @@ def clone(path, remote_branch):
 def get_remote_branch(name):
     remote_branch = bzrlib.branch.Branch.open(branches[name],
                                               possible_transports=transports)
-    if isinstance(remote_branch.user_transport, bzrlib.transport.local.LocalTransport):
+    if isinstance(remote_branch.bzrdir.root_transport, bzrlib.transport.local.LocalTransport):
         return remote_branch
 
     branch_path = os.path.join(dirname, 'clone', name)
@@ -867,7 +869,7 @@ def get_repo(url, alias):
     if not wanted:
         try:
             repo = origin.open_repository()
-            if not repo.user_transport.listable():
+            if not repo.bzrdir.root_transport.listable():
                 # this repository is not usable for us
                 raise bzrlib.errors.NoRepositoryPresent(repo.bzrdir)
         except bzrlib.errors.NoRepositoryPresent:
index 36b526106ba7b3c61b70549770c1ec82f45e1baf..34cda027597f30ddacf340466778404f3705361d 100755 (executable)
@@ -260,6 +260,7 @@ class Parser:
         return (user, int(date), -tz)
 
 def fix_file_path(path):
+    path = os.path.normpath(path)
     if not os.path.isabs(path):
         return path
     return os.path.relpath(path, '/')
index 4f379c2ab499f2ca5556f844cbdcacb98fffa13c..a4656ce412cc8c192a636030a019c156bb58df7f 100755 (executable)
@@ -382,7 +382,7 @@ test_expect_success 'strip' '
 '
 
 test_expect_success 'export utf-8 authors' '
-       test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C && unset GIT_COMMITTER_NAME" &&
+       test_when_finished "rm -rf bzrrepo gitrepo && LC_ALL=C && GIT_COMMITTER_NAME=\"C O Mitter\""
 
        LC_ALL=en_US.UTF-8
        export LC_ALL
@@ -411,4 +411,28 @@ test_expect_success 'export utf-8 authors' '
        test_cmp expected actual
 '
 
+test_expect_success 'push different author' '
+       test_when_finished "rm -rf bzrrepo gitrepo" &&
+
+       bzr init bzrrepo &&
+
+       (
+       git init gitrepo &&
+       cd gitrepo &&
+       echo john >> content &&
+       git add content &&
+       git commit -m john --author "John Doe <jdoe@example.com>" &&
+       git remote add bzr "bzr::../bzrrepo" &&
+       git push bzr master
+       ) &&
+
+       (
+       cd bzrrepo &&
+       bzr log | grep "^author: " > ../actual
+       ) &&
+
+       echo "author: John Doe <jdoe@example.com>" > expected &&
+       test_cmp expected actual
+'
+
 test_done
index e24c51daad1038184bd6113ceee77c042dc26f17..d86e147d3d400e226b1afb95fa2de48e42883fbd 100755 (executable)
@@ -8,7 +8,8 @@
 
 test_description='Test bidirectionality of remote-hg'
 
-. ./test-lib.sh
+test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=${0%/*}/../../t
+. "$TEST_DIRECTORY"/test-lib.sh
 
 if ! test_have_prereq PYTHON
 then
index 6dcd95d10f618ee3ac4920f5f2ae684c0b8d4d36..b23909ae6ccc9cc5b2169c2898ea8de292bd0d22 100755 (executable)
@@ -8,7 +8,8 @@
 
 test_description='Test remote-hg output compared to hg-git'
 
-. ./test-lib.sh
+test -n "$TEST_DIRECTORY" || TEST_DIRECTORY=${0%/*}/../../t
+. "$TEST_DIRECTORY"/test-lib.sh
 
 if ! test_have_prereq PYTHON
 then