Rev 59: Add more tests, fix revision history. in http://people.samba.org/bzr/jelmer/bzr-git/trunk
Jelmer Vernooij
jelmer at samba.org
Sat Jul 26 17:27:38 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-git/trunk
------------------------------------------------------------
revno: 59
revision-id: jelmer at samba.org-20080726131606-ifj2vk8pj8zujlwe
parent: jelmer at samba.org-20080726125912-52f3yj0dsqin5ugb
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: trunk
timestamp: Sat 2008-07-26 15:16:06 +0200
message:
Add more tests, fix revision history.
modified:
git_branch.py git_branch.py-20071108230535-su8dxk529f4uk9fx-2
git_dir.py git_dir.py-20071108234408-ygidvy5hviixghsd-1
git_repository.py git_repository.py-20071108234408-ygidvy5hviixghsd-2
tests/test_git_branch.py test_git_branch.py-20071108234408-ygidvy5hviixghsd-3
=== modified file 'git_branch.py'
--- a/git_branch.py 2008-07-26 12:59:12 +0000
+++ b/git_branch.py 2008-07-26 13:16:06 +0000
@@ -48,9 +48,10 @@
class GitBranch(branch.Branch):
"""An adapter to git repositories for bzr Branch objects."""
- def __init__(self, repository, head, base, lockfiles):
+ def __init__(self, bzrdir, repository, head, base, lockfiles):
super(GitBranch, self).__init__()
self.control_files = lockfiles
+ self.bzrdir = bzrdir
self.repository = repository
self.head = head
self.base = base
@@ -77,6 +78,7 @@
cms = self.repository._git.commits(self.head, max_count=max_count, skip=skip)
skip += max_count
ret += [ids.convert_revision_id_git_to_bzr(cm.id) for cm in cms]
+ ret.reverse()
return ret
def get_config(self):
=== modified file 'git_dir.py'
--- a/git_dir.py 2008-07-26 12:59:12 +0000
+++ b/git_dir.py 2008-07-26 13:16:06 +0000
@@ -86,7 +86,7 @@
head = None
else:
head = repo._git.heads[0].commit.id
- return git_branch.GitBranch(repo, head,
+ return git_branch.GitBranch(self, repo, head,
self.root_transport.base, self._lockfiles)
def open_repository(self, shared=False):
=== modified file 'git_repository.py'
--- a/git_repository.py 2008-07-26 12:59:12 +0000
+++ b/git_repository.py 2008-07-26 13:16:06 +0000
@@ -65,6 +65,7 @@
self.signatures = None
self.revisions = None
self._format = GitFormat()
+ self._fallback_repositories = []
def _init_cachedb(self):
self.cachedb.executescript("""
@@ -104,7 +105,7 @@
ret = {}
for revid in revision_ids:
commit = self._git.commit(ids.convert_revision_id_bzr_to_git(revid))
- ret[revid] = tuple([ids.convert_revision_id_git_to_bzr(p.commit.id) for p in commit.parents])
+ ret[revid] = tuple([ids.convert_revision_id_git_to_bzr(p.id) for p in commit.parents])
return ret
def get_revision(self, revision_id):
@@ -138,8 +139,8 @@
rev.parent_ids = tuple([ids.convert_revision_id_git_to_bzr(p.id) for p in commit.parents])
rev.inventory_sha1 = ""
rev.message = commit.message
- rev.committer = commit.committer
- rev.properties['author'] = commit.author
+ rev.committer = str(commit.committer)
+ rev.properties['author'] = str(commit.author)
rev.timestamp = time.mktime(commit.committed_date)
rev.timezone = 0
return rev
=== modified file 'tests/test_git_branch.py'
--- a/tests/test_git_branch.py 2008-07-26 12:59:12 +0000
+++ b/tests/test_git_branch.py 2008-07-26 13:16:06 +0000
@@ -61,9 +61,13 @@
self.build_tree(['a'])
tests.run_git('add', 'a')
tests.run_git('commit', '-m', 'a')
- head = tests.run_git('rev-parse', 'HEAD').strip()
+ reva = tests.run_git('rev-parse', 'HEAD').strip()
+ self.build_tree(['b'])
+ tests.run_git('add', 'b')
+ tests.run_git('commit', '-m', 'b')
+ revb = tests.run_git('rev-parse', 'HEAD').strip()
thebranch = branch.Branch.open('.')
- self.assertEqual([ids.convert_revision_id_git_to_bzr(head)],
+ self.assertEqual([ids.convert_revision_id_git_to_bzr(r) for r in (reva, revb)],
thebranch.revision_history())
More information about the bazaar-commits
mailing list