]> Savannah Git Hosting - gnulib.git/commitdiff
pygnulib: postpone ignore files backup
authorDmitry Selyutin <ghostmansd@gmail.com>
Fri, 29 Jun 2018 07:05:31 +0000 (10:05 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Fri, 29 Jun 2018 07:05:31 +0000 (10:05 +0300)
pygnulib.py

index 554fb2fd254625c1d05a6544ee8607afb49026c2..b7927de5d9b17c45c17714f1784cdabed30e3085 100755 (executable)
@@ -489,7 +489,6 @@ def import_hook(script, gnulib, namespace, explicit, verbosity, options, *args,
                 try:
                     with vfs_iostream(project, path,  "rb", "UTF-8") as stream:
                         ignores = [line.strip() for line in stream.readlines()]
-                    vfs_backup(project, path)
                     present = True
                 except:
                     present = False
@@ -505,6 +504,8 @@ def import_hook(script, gnulib, namespace, explicit, verbosity, options, *args,
                         include.add(name)
                 if include or (set(ignores) & exclude):
                     print(f"Updating {path} (backup in {path}~)", file=sys.stdout)
+                    if present:
+                        vfs_backup(project, path)
                     with vfs_iostream(project, path,  "wb", "UTF-8") as stream:
                         for entry in ignores:
                             if entry not in exclude: