92
96
self._format = _format
93
97
self._base = a_bzrdir.transport.base
94
98
self._ignore_fallbacks = False
95
foreign.ForeignBranch.__init__(self, DummyForeignVcsMapping(DummyForeignVcs()))
96
branch.BzrBranch6.__init__(self, _format, _control_files, a_bzrdir, *args, **kwargs)
99
foreign.ForeignBranch.__init__(self,
100
DummyForeignVcsMapping(DummyForeignVcs()))
101
branch.BzrBranch6.__init__(self, _format, _control_files, a_bzrdir,
98
104
def dpull(self, source, stop_revision=None):
99
# This just handles simple cases, but that's good enough for tests
100
my_history = self.revision_history()
101
their_history = source.revision_history()
102
if their_history[:min(len(my_history), len(their_history))] != my_history:
103
raise errors.DivergedBranches(self, source)
104
todo = their_history[len(my_history):]
107
rev = source.repository.get_revision(revid)
108
tree = source.repository.revision_tree(revid)
109
builder = self.get_commit_builder([self.last_revision()],
110
self.get_config(), rev.timestamp,
111
rev.timezone, rev.committer, rev.properties)
112
for path, ie in tree.inventory.iter_entries():
113
builder.record_entry_contents(ie.copy(),
114
[self.repository.get_inventory(self.last_revision())],
116
builder.finish_inventory()
117
revidmap[revid] = builder.commit(rev.message)
118
trace.mutter('lossily pushed revision %s -> %s',
119
revid, revidmap[revid])
107
# This just handles simple cases, but that's good enough for tests
108
my_history = self.revision_history()
109
their_history = source.revision_history()
110
if their_history[:min(len(my_history), len(their_history))] != my_history:
111
raise errors.DivergedBranches(self, source)
112
todo = their_history[len(my_history):]
115
rev = source.repository.get_revision(revid)
116
tree = source.repository.revision_tree(revid)
117
def get_file_with_stat(file_id, path=None):
118
return (tree.get_file(file_id), None)
119
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,
125
rev.timezone, rev.committer, rev.properties,
128
for path, ie in tree.inventory.iter_entries():
130
new_ie.revision = None
131
builder.record_entry_contents(new_ie,
132
[self.repository.get_inventory(parent_revid)],
134
(ie.kind, ie.text_size, ie.executable, ie.text_sha1))
135
builder.finish_inventory()
139
revidmap[revid] = builder.commit(rev.message)
140
self.set_last_revision_info(parent_revno+1, revidmap[revid])
141
trace.mutter('lossily pushed revision %s -> %s',
142
revid, revidmap[revid])