delta: Change the way in previous commit
No need to use an exception. Comparing the size of changed files and the new files is enough.
This commit is contained in:
@@ -21,10 +21,6 @@ import pisi.util as util
|
|||||||
import pisi.archive as archive
|
import pisi.archive as archive
|
||||||
|
|
||||||
|
|
||||||
class AllFilesChangedException(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
# FIXME Reduce code duplication
|
# FIXME Reduce code duplication
|
||||||
def create_delta_packages_from_obj(old_packages, new_package_obj, specdir):
|
def create_delta_packages_from_obj(old_packages, new_package_obj, specdir):
|
||||||
new_pkg_info = new_package_obj.metadata.package
|
new_pkg_info = new_package_obj.metadata.package
|
||||||
@@ -58,9 +54,9 @@ def create_delta_packages_from_obj(old_packages, new_package_obj, specdir):
|
|||||||
|
|
||||||
old_pkg_files = old_pkg.get_files()
|
old_pkg_files = old_pkg.get_files()
|
||||||
|
|
||||||
try:
|
files_delta = find_delta(old_pkg_files, new_pkg_files)
|
||||||
files_delta = find_delta(old_pkg_files, new_pkg_files)
|
|
||||||
except AllFilesChangedException:
|
if len(files_delta) == len(new_pkg_files.list):
|
||||||
ctx.ui.warning(_("All files in the package '%s' are different "
|
ctx.ui.warning(_("All files in the package '%s' are different "
|
||||||
"from the files in the new package. Skipping "
|
"from the files in the new package. Skipping "
|
||||||
"it...") % old_package)
|
"it...") % old_package)
|
||||||
@@ -162,9 +158,9 @@ def create_delta_packages(old_packages, new_package):
|
|||||||
|
|
||||||
old_pkg_files = old_pkg.get_files()
|
old_pkg_files = old_pkg.get_files()
|
||||||
|
|
||||||
try:
|
files_delta = find_delta(old_pkg_files, new_pkg_files)
|
||||||
files_delta = find_delta(old_pkg_files, new_pkg_files)
|
|
||||||
except AllFilesChangedException:
|
if len(files_delta) == len(new_pkg_files.list):
|
||||||
ctx.ui.warning(_("All files in the package '%s' are different "
|
ctx.ui.warning(_("All files in the package '%s' are different "
|
||||||
"from the files in the new package. Skipping "
|
"from the files in the new package. Skipping "
|
||||||
"it...") % old_package)
|
"it...") % old_package)
|
||||||
@@ -226,9 +222,6 @@ def find_delta(old_files, new_files):
|
|||||||
old_hashes = set([f.hash for f in old_files.list])
|
old_hashes = set([f.hash for f in old_files.list])
|
||||||
hashes_delta = new_hashes - old_hashes
|
hashes_delta = new_hashes - old_hashes
|
||||||
|
|
||||||
if hashes_delta == new_hashes:
|
|
||||||
raise AllFilesChangedException
|
|
||||||
|
|
||||||
deltas = []
|
deltas = []
|
||||||
for h in hashes_delta:
|
for h in hashes_delta:
|
||||||
deltas.extend(hashto_files[h])
|
deltas.extend(hashto_files[h])
|
||||||
|
|||||||
Reference in New Issue
Block a user