101
101
branch.BzrBranch6.__init__(self, _format, _control_files, a_bzrdir,
104
def dpull(self, source, stop_revision=None):
105
class InterToDummyVcsBranch(branch.GenericInterBranch,
106
foreign.InterToForeignBranch):
109
def is_compatible(source, target):
110
return isinstance(target, DummyForeignVcsBranch)
112
def lossy_push(self, stop_revision=None):
113
self.source.lock_read()
107
115
# This just handles simple cases, but that's good enough for tests
108
my_history = self.revision_history()
109
their_history = source.revision_history()
116
my_history = self.target.revision_history()
117
their_history = self.source.revision_history()
110
118
if their_history[:min(len(my_history), len(their_history))] != my_history:
111
raise errors.DivergedBranches(self, source)
119
raise errors.DivergedBranches(self.target, self.source)
112
120
todo = their_history[len(my_history):]
114
122
for revid in todo:
115
rev = source.repository.get_revision(revid)
116
tree = source.repository.revision_tree(revid)
123
rev = self.source.repository.get_revision(revid)
124
tree = self.source.repository.revision_tree(revid)
117
125
def get_file_with_stat(file_id, path=None):
118
126
return (tree.get_file(file_id), None)
119
127
tree.get_file_with_stat = get_file_with_stat
120
new_revid = self.mapping.revision_id_foreign_to_bzr(
121
(str(rev.timestamp), str(rev.timezone), str(self.revno())))
122
parent_revno, parent_revid= self.last_revision_info()
123
builder = self.get_commit_builder([parent_revid],
124
self.get_config(), rev.timestamp,
128
new_revid = self.target.mapping.revision_id_foreign_to_bzr(
129
(str(rev.timestamp), str(rev.timezone),
130
str(self.target.revno())))
131
parent_revno, parent_revid= self.target.last_revision_info()
132
builder = self.target.get_commit_builder([parent_revid],
133
self.target.get_config(), rev.timestamp,
125
134
rev.timezone, rev.committer, rev.properties,
129
138
new_ie = ie.copy()
130
139
new_ie.revision = None
131
140
builder.record_entry_contents(new_ie,
132
[self.repository.get_inventory(parent_revid)],
141
[self.target.repository.get_inventory(parent_revid)],
134
143
(ie.kind, ie.text_size, ie.executable, ie.text_sha1))
135
144
builder.finish_inventory()