Handles these cases:

old package               new package
-----------               -----------
A (hash = XYZ)            B (hash = XYZ)
                          C (hash = XYZ)
                          D (hash = XYZ)

handled with relocations ( A -> B, A -> C, A -> D)

old package               new package
-----------               -----------
                          B (hash = XYZ)
                          C (hash = XYZ)
                          D (hash = XYZ)

set was again only adding one of these.. handled with
not using set and adding B, C, D as they were to delta.
This commit is contained in:
Faik Uygur
2007-02-06 12:14:17 +00:00
parent bc6de3d167
commit 9e9b097770
+7 -2
View File
@@ -105,7 +105,11 @@ def find_delta(oldfiles, newfiles):
files_old = set(map(lambda x:x.hash, oldfiles.list)) files_old = set(map(lambda x:x.hash, oldfiles.list))
files_delta = files_new - files_old files_delta = files_new - files_old
return map(lambda x:hashto_files[x][0], files_delta) deltas = []
for hash in files_delta:
deltas.extend(hashto_files[hash])
return deltas
def find_relocations(oldfiles, newfiles): def find_relocations(oldfiles, newfiles):
@@ -126,6 +130,7 @@ def find_relocations(oldfiles, newfiles):
if hash in files_old and files_new[hash][0].path != files_old[hash][0].path: if hash in files_old and files_new[hash][0].path != files_old[hash][0].path:
# symlinks are not relocated, they already come with the delta package # symlinks are not relocated, they already come with the delta package
if not os.path.islink("/" + files_old[hash][0].path): if not os.path.islink("/" + files_old[hash][0].path):
relocations.append((files_old[hash][0], files_new[hash][0])) for i in range(len(files_new[hash])):
relocations.append((files_old[hash][0], files_new[hash][i]))
return relocations return relocations