changeset 39111:3b220bf31e58

pygnulib: fix substitutions; backup removed files
author Dmitry Selyutin <ghostmansd@gmail.com>
date Fri, 29 Jun 2018 01:45:09 +0300
parents cd0c5e1d7984
children 62e78104251e
files pygnulib.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pygnulib.py	Fri Jun 29 01:44:29 2018 +0300
+++ b/pygnulib.py	Fri Jun 29 01:45:09 2018 +0300
@@ -232,7 +232,8 @@
         fmt = (action + " file {file} (backup in {file}~)")
         if not dry_run:
             try:
-                vfs_unlink(project, file, backup=True)
+                vfs_backup(project, file)
+                vfs_unlink(project, file)
             except FileNotFoundError:
                 pass
         print(fmt.format(file=file), file=sys.stdout)
@@ -274,7 +275,7 @@
     # First the files that are in old_files, but not in new_files.
     # Then the files that are in new_files, but not in old_files.
     # Then the files that are in new_files and in old_files.
-    origin = lambda file: ("lib/" + file[len("tests=lib/"):]) if file.startswith("tests=lib/") else file
+    origin = lambda file: project[file]
     removed_files = set(map(origin, old_files)).difference(map(origin, new_files))
     added_files = new_files.difference(old_files)
     kept_files = (old_files & new_files)