Skip to content

Commit b25df87

Browse files
felipecgitster
authored andcommitted
remote-bzr: fix partially pushed merge
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 38e7167 commit b25df87

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

contrib/remote-helpers/git-remote-bzr

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ class CustomTree():
387387
global files_cache
388388

389389
self.updates = {}
390+
self.branch = repo
390391

391392
def copy_tree(revid):
392393
files = files_cache[revid] = {}
@@ -515,13 +516,21 @@ class CustomTree():
515516

516517
return changes
517518

518-
def get_file_with_stat(self, file_id, path=None):
519+
def get_content(self, file_id):
519520
path, mark = self.rev_files[file_id]
520-
return (StringIO.StringIO(blob_marks[mark]), None)
521+
if mark:
522+
return blob_marks[mark]
523+
524+
# last resort
525+
tree = self.branch.repository.revision_tree(self.base_id)
526+
return tree.get_file_text(file_id)
527+
528+
def get_file_with_stat(self, file_id, path=None):
529+
content = self.get_content(file_id)
530+
return (StringIO.StringIO(content), None)
521531

522532
def get_symlink_target(self, file_id):
523-
path, mark = self.rev_files[file_id]
524-
return blob_marks[mark]
533+
return self.get_content(file_id)
525534

526535
def id2path(self, file_id):
527536
path, mark = self.rev_files[file_id]

0 commit comments

Comments
 (0)