/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to push.py

More work on supporting roundtripping push.

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
    def missing_revisions(self, stop_revisions):
159
159
        """Find the revisions that are missing from the target repository.
160
160
 
161
 
        :param stop_revisions: Revisions to check for
 
161
        :param stop_revisions: Revisions to check for (tuples with 
 
162
            Git SHA1, bzr revid)
162
163
        :return: sequence of missing revisions, in topological order
163
164
        :raise: NoSuchRevision if the stop_revisions are not present in
164
165
            the source
165
166
        """
 
167
        stop_revids = [revid for (sha1, revid) in stop_revisions]
166
168
        missing = []
167
169
        graph = self.source.get_graph()
168
170
        pb = ui.ui_factory.nested_progress_bar()
169
171
        try:
170
 
            for revid, _ in graph.iter_ancestry(stop_revisions):
 
172
            for revid, _ in graph.iter_ancestry(stop_revids):
171
173
                assert type(revid) is str
172
174
                pb.update("determining revisions to fetch", len(missing))
173
175
                if self._revision_needs_fetching(revid):
202
204
        try:
203
205
            old_refs = self._get_target_bzr_refs()
204
206
            new_refs = update_refs(old_refs)
205
 
            # FIXME: Keep track of already looked up revid<->sha mappings
206
 
            fetch_spec = PendingAncestryResult(
207
 
                [revid for sha, revid in new_refs.values()], self.source)
208
 
            self.fetch(fetch_spec=fetch_spec)
 
207
            self.fetch(mapped_refs=new_refs.values())
209
208
        finally:
210
209
            self.source.unlock()
211
210
        return old_refs, new_refs
237
236
        revidmap = {}
238
237
        self.source.lock_read()
239
238
        try:
240
 
            todo = list(self.missing_revisions([revid for sha, revid in stop_revisions]))
 
239
            todo = list(self.missing_revisions(stop_revisions))
241
240
            pb = ui.ui_factory.nested_progress_bar()
242
241
            try:
243
242
                object_generator = self._get_missing_objects_iterator(pb)
254
253
        return revidmap, gitidmap
255
254
 
256
255
    def fetch(self, revision_id=None, pb=None, find_ghosts=False,
257
 
            fetch_spec=None):
258
 
        if revision_id is not None:
259
 
            stop_revisions = [revision_id]
 
256
            fetch_spec=None, mapped_refs=None):
 
257
        if mapped_refs is not None:
 
258
            stop_revisions = mapped_refs
 
259
        elif revision_id is not None:
 
260
            stop_revisions = [(None, revision_id)]
260
261
        elif fetch_spec is not None:
261
 
            stop_revisions = fetch_spec.heads
 
262
            stop_revisions = [(None, revid) for revid in fetch_spec.heads]
262
263
        else:
263
 
            stop_revisions = self.source.all_revision_ids()
 
264
            stop_revisions = [(None, revid) for revid in self.source.all_revision_ids()]
264
265
        self.source.lock_read()
265
266
        try:
266
267
            todo = list(self.missing_revisions(stop_revisions))