~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/branch.py

Format tweaks for latest merges.

Show diffs side-by-side

added added

removed removed

Lines of Context:
530
530
        """
531
531
        raise NotImplementedError('fileid_involved_by_set is abstract')
532
532
 
 
533
 
533
534
class BzrBranch(Branch):
534
535
    """A branch stored in the actual filesystem.
535
536
 
1173
1174
        #       If D is ever merged in the future, the weave
1174
1175
        #       won't be fixed, because AD never saw revision C
1175
1176
        #       to cause a conflict which would force a reweave.
1176
 
        w = self._get_inventory_weave( )
 
1177
        w = self._get_inventory_weave()
1177
1178
        from_set = set(w.inclusions([w.lookup(from_revid)]))
1178
1179
        to_set = set(w.inclusions([w.lookup(to_revid)]))
1179
1180
        included = to_set.difference(from_set)
1180
 
        changed = map(w.idx_to_name,included)
 
1181
        changed = map(w.idx_to_name, included)
1181
1182
        return self._fileid_involved_by_set(changed)
1182
1183
 
1183
1184
    def fileid_involved(self, last_revid=None):
1185
1186
 
1186
1187
        :param last_revid: If None, last_revision() will be used.
1187
1188
        """
1188
 
        w = self._get_inventory_weave( )
 
1189
        w = self._get_inventory_weave()
1189
1190
        if not last_revid:
1190
1191
            changed = set(w._names)
1191
1192
        else:
1202
1203
        #       or better yet, change _fileid_involved_by_set so
1203
1204
        #       that it takes the inventory weave, rather than
1204
1205
        #       pulling it out by itself.
1205
 
        w = self._get_inventory_weave( )
 
1206
        w = self._get_inventory_weave()
1206
1207
        return self._fileid_involved_by_set(changes)
1207
1208
 
1208
1209
    def _fileid_involved_by_set(self, changes):
1218
1219
        to have a single line per file/directory, and to have
1219
1220
        fileid="" and revision="" on that line.
1220
1221
        """
1221
 
        assert self._branch_format in (5,6), \
 
1222
        assert self._branch_format in (5, 6), \
1222
1223
            "fileid_involved only supported for branches which store inventory as xml"
1223
1224
 
1224
 
        w = self._get_inventory_weave( )
1225
 
        file_ids = set( )
 
1225
        w = self._get_inventory_weave()
 
1226
        file_ids = set()
1226
1227
        for line in w._weave:
1227
1228
 
1228
1229
            # it is ugly, but it is due to the weave structure
1229
 
            if not isinstance(line,basestring): continue
 
1230
            if not isinstance(line, basestring): continue
1230
1231
 
1231
1232
            start = line.find('file_id="')+9
1232
1233
            if start < 9: continue
1233
 
            end = line.find('"',start)
 
1234
            end = line.find('"', start)
1234
1235
            assert end>= 0
1235
1236
            file_id = xml.sax.saxutils.unescape(line[start:end])
1236
1237
 
1239
1240
 
1240
1241
            start = line.find('revision="')+10
1241
1242
            if start < 10: continue
1242
 
            end = line.find('"',start)
 
1243
            end = line.find('"', start)
1243
1244
            assert end>= 0
1244
1245
            revision_id = xml.sax.saxutils.unescape(line[start:end])
1245
1246
 
1312
1313
    filename = normpath(filename)
1313
1314
    while filename != '':
1314
1315
        head, tail = os.path.split(filename)
1315
 
        ## mutter('check %r for control file' % ((head, tail), ))
 
1316
        ## mutter('check %r for control file' % ((head, tail),))
1316
1317
        if tail == bzrlib.BZRDIR:
1317
1318
            return True
1318
1319
        if filename == head: