/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

  • Committer: Jelmer Vernooij
  • Date: 2018-03-02 01:59:40 UTC
  • mfrom: (0.200.1791 work)
  • mto: (0.200.1795 work)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180302015940-41gwnoymxc2go3bq
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
            todo.extend(revision_ids)
144
144
        if if_present_ids:
145
145
            todo.extend(revision_ids)
146
 
        self.source_store.lock_read()
147
 
        try:
 
146
        with self.source_store.lock_read():
148
147
            for revid in revision_ids:
149
148
                if revid == NULL_REVISION:
150
149
                    continue
157
156
                for (kind, type_data) in self.source_store.lookup_git_sha(entry.commit.id):
158
157
                    if kind == "commit":
159
158
                        missing_revids.add(type_data[0])
160
 
        finally:
161
 
            self.source_store.unlock()
162
159
        return self.source.revision_ids_to_search_result(missing_revids)
163
160
 
164
161
 
256
253
    def fetch_refs(self, update_refs, lossy):
257
254
        if not lossy and not self.mapping.roundtripping:
258
255
            raise NoPushSupport(self.source, self.target, self.mapping)
259
 
        self.source_store.lock_read()
260
 
        try:
 
256
        with self.source_store.lock_read():
261
257
            old_refs = self._get_target_bzr_refs()
262
258
            new_refs = update_refs(old_refs)
263
259
            revidmap = self.fetch_objects(
270
266
                        gitid = self.source_store._lookup_revision_sha1(revid)
271
267
                assert len(gitid) == 40 or gitid.startswith('ref: ')
272
268
                self.target_refs[name] = gitid
273
 
        finally:
274
 
            self.source_store.unlock()
275
269
        return revidmap, old_refs, new_refs
276
270
 
277
271
    def fetch_objects(self, revs, lossy, limit=None):
278
272
        if not lossy and not self.mapping.roundtripping:
279
273
            raise NoPushSupport(self.source, self.target, self.mapping)
280
 
        self.source_store.lock_read()
281
 
        try:
 
274
        with self.source_store.lock_read():
282
275
            todo = list(self.missing_revisions(revs))[:limit]
283
276
            revidmap = {}
284
277
            pb = ui.ui_factory.nested_progress_bar()
301
294
                return revidmap
302
295
            finally:
303
296
                pb.finished()
304
 
        finally:
305
 
            self.source_store.unlock()
306
297
 
307
298
    def fetch(self, revision_id=None, pb=None, find_ghosts=False,
308
299
            fetch_spec=None, mapped_refs=None):
348
339
                else:
349
340
                    ret[name] = gitid
350
341
            return ret
351
 
        self.source_store.lock_read()
352
 
        try:
 
342
        with self.source_store.lock_read():
353
343
            new_refs = self.target.send_pack(determine_wants,
354
344
                    self.source_store.generate_lossy_pack_contents)
355
 
        finally:
356
 
            self.source_store.unlock()
357
345
        # FIXME: revidmap?
358
346
        return revidmap, self.old_refs, self.new_refs
359
347