Skip to content

Commit

Permalink
remote-bzr: fix partially pushed merge
Browse files Browse the repository at this point in the history
If part of the merge was already pushed, we don't have the blob_marks
available, however, the commits are already stored in bazaar, so we can
use the revision_tree to fetch the contents.

We want to do this only when there's no other option.

There's no easy way to test this.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Felipe Contreras authored and Junio C Hamano committed May 1, 2013
1 parent 38e7167 commit b25df87
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions contrib/remote-helpers/git-remote-bzr
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ class CustomTree():
global files_cache

self.updates = {}
self.branch = repo

def copy_tree(revid):
files = files_cache[revid] = {}
Expand Down Expand Up @@ -515,13 +516,21 @@ class CustomTree():

return changes

def get_file_with_stat(self, file_id, path=None):
def get_content(self, file_id):
path, mark = self.rev_files[file_id]
return (StringIO.StringIO(blob_marks[mark]), None)
if mark:
return blob_marks[mark]

# last resort
tree = self.branch.repository.revision_tree(self.base_id)
return tree.get_file_text(file_id)

def get_file_with_stat(self, file_id, path=None):
content = self.get_content(file_id)
return (StringIO.StringIO(content), None)

def get_symlink_target(self, file_id):
path, mark = self.rev_files[file_id]
return blob_marks[mark]
return self.get_content(file_id)

def id2path(self, file_id):
path, mark = self.rev_files[file_id]
Expand Down

0 comments on commit b25df87

Please sign in to comment.