pmb/helpers/repo.py: Diff ofthe package repo works properly now.

Previously, it would always report all files as new files, although
some of them may not have changed. I've added testcases for the
repo functions.
This commit is contained in:
Oliver Smith 2017-06-14 19:48:23 +02:00
parent 7543ae540b
commit c0f90ee65a
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 97 additions and 2 deletions

View file

@ -53,8 +53,16 @@ def diff(args, files_a, files_b=None):
ret = []
for arch in files_b.keys():
for file, timestamp in files_b[arch].items():
if (arch not in files_a or file not in files_a[arch] or
timestamp is not files_a[arch][file]):
add = False
if arch not in files_a:
add = True
elif file not in files_a[arch]:
add = True
elif timestamp != files_a[arch][file]:
add = True
if add:
ret.append(arch + "/" + file)
return sorted(ret)