/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 fetch.py

Cope with kind changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
                and base_ie.kind == ie.kind):
116
116
                # If nothing has changed since the base revision, we're done
117
117
                return [], []
118
 
    if base_sha == hexsha:
 
118
    if base_sha == hexsha and base_ie.kind == ie.kind:
119
119
        ie.text_size = base_ie.text_size
120
120
        ie.text_sha1 = base_ie.text_sha1
121
121
        ie.symlink_target = base_ie.symlink_target
216
216
            shamap.extend(subshamap)
217
217
        else:
218
218
            fs_mode = stat.S_IMODE(mode)
219
 
            symlink = stat.S_ISLNK(mode)
220
219
            subinvdelta, subshamap = import_git_blob(texts, mapping, 
221
220
                    child_path, child_hexsha, base_inv, file_id, revision_id, 
222
221
                    parent_invs, shagitmap, lookup_object, 
223
 
                    bool(fs_mode & 0111), symlink)
 
222
                    bool(fs_mode & 0111), stat.S_ISLNK(mode))
224
223
            invdelta.extend(subinvdelta)
225
224
            shamap.extend(subshamap)
226
225
        if mode not in (stat.S_IFDIR, DEFAULT_FILE_MODE,
227
226
                        stat.S_IFLNK, DEFAULT_FILE_MODE|0111):
228
227
            child_modes[child_path] = mode
229
228
    # Remove any children that have disappeared
230
 
    if base_ie is not None:
 
229
    if base_ie is not None and base_ie.kind == 'directory':
231
230
        deletable = [v for k,v in base_ie.children.iteritems() if k not in existing_children]
232
231
        while deletable:
233
232
            ie = deletable.pop()
383
382
        def progress(text):
384
383
            pb.update("git: %s" % text.rstrip("\r\n"), 0, 0)
385
384
        store = BazaarObjectStore(self.target, mapping)
386
 
        self.target.lock_read()
 
385
        self.target.lock_write()
387
386
        try:
388
387
            heads = self.target.get_graph().heads(self.target.all_revision_ids())
389
 
        finally:
390
 
            self.target.unlock()
391
 
        graph_walker = store.get_graph_walker(
392
 
                [store._lookup_revision_sha1(head) for head in heads])
393
 
        create_pb = None
394
 
        if pb is None:
395
 
            create_pb = pb = ui.ui_factory.nested_progress_bar()
396
 
        recorded_wants = []
 
388
            graph_walker = store.get_graph_walker(
 
389
                    [store._lookup_revision_sha1(head) for head in heads])
 
390
            recorded_wants = []
397
391
 
398
 
        def record_determine_wants(heads):
399
 
            wants = determine_wants(heads)
400
 
            recorded_wants.extend(wants)
401
 
            return wants
 
392
            def record_determine_wants(heads):
 
393
                wants = determine_wants(heads)
 
394
                recorded_wants.extend(wants)
 
395
                return wants
402
396
        
403
 
        try:
404
 
            self.target.lock_write()
 
397
            create_pb = None
 
398
            if pb is None:
 
399
                create_pb = pb = ui.ui_factory.nested_progress_bar()
405
400
            try:
406
401
                self.target.start_write_group()
407
402
                try:
413
408
                finally:
414
409
                    self.target.commit_write_group()
415
410
            finally:
416
 
                self.target.unlock()
 
411
                if create_pb:
 
412
                    create_pb.finished()
417
413
        finally:
418
 
            if create_pb:
419
 
                create_pb.finished()
 
414
            self.target.unlock()
420
415
 
421
416
    @staticmethod
422
417
    def is_compatible(source, target):