Handle --preserve=all

This commit is contained in:
Matteo Cypriani 2018-04-22 07:39:31 +02:00
parent 2e0e8ba994
commit b83d37a5e9
3 changed files with 32 additions and 26 deletions

16
fr.po
View File

@ -197,8 +197,11 @@ msgid "force overwriting of existing files"
msgstr "force le remplacement des fichiers déjà existants"
#: gcp:545
msgid "preserve the specified attributes"
msgstr "garde les attributs spécifiés"
#, python-format
msgid "preserve the specified attributes; accepted values:\
'all', or one or more amongst %s"
msgstr "garde les attributs spécifiés; valeurs acceptées : 'all' ou\
un ou plusieurs éléments parmi %s"
#: gcp:551
msgid "don't fix filesystem name incompatibily"
@ -245,12 +248,9 @@ msgid "Progress bar is not available, deactivating"
msgstr "La barre de progression n'est pas disponible, désactivation"
#: gcp:595
msgid ""
"Invalid --preserve value\n"
"valid values are:"
msgstr ""
"La valeur de «--preserve» est invalide\n"
"Les valeurs valides sont:"
#, python-format
msgid "Invalid --preserve value '%s'"
msgstr "Valeur de --preserve invalide « %s »"
#: gcp:616
#, python-format

33
gcp
View File

@ -566,7 +566,8 @@ class GCP():
)
parser.add_argument("--preserve",
action="store", default='',
help=_("preserve the specified attributes")
help=_("preserve the specified attributes; accepted values:\
'all', or one or more amongst %s") % str(const_PRESERVE)
)
parser.add_argument("-L", "--dereference",
action="store_true", default=False,
@ -646,22 +647,26 @@ class GCP():
if options.no_fs_fix:
options.fs_fix = 'no'
preserve = set()
if options.p:
if not options.preserve:
options.preserve = const_PRESERVE_p
else:
options.preserve += ',' + const_PRESERVE_p
preserve.update(const_PRESERVE_p.split(','))
if options.preserve:
preserve = set(options.preserve.split(','))
if not preserve.issubset(const_PRESERVE):
error (_("Invalid --preserve value\nvalid values are:"))
for value in const_PRESERVE:
error('- %s' % value)
exit(1)
options.preserve = preserve
else:
options.preserve = set()
preserve.update(options.preserve.split(','))
preserve_all = False
for value in preserve:
if value == 'all':
preserve_all = True
continue
if value not in const_PRESERVE:
error (_("Invalid --preserve value '%s'") % value)
exit(1)
if preserve_all:
preserve.remove('all')
preserve.update(const_PRESERVE)
options.preserve = preserve
self.__sourcesSaving(options, args)

9
gcp.po
View File

@ -120,7 +120,9 @@ msgid "force overwriting of existing files"
msgstr ""
#: gcp:321
msgid "preserve the specified attributes"
#, python-format
msgid "preserve the specified attributes; accepted values:\
'all', or one or more amongst %s"
msgstr ""
#: gcp:324
@ -140,9 +142,8 @@ msgid "Progress bar is not available, deactivating"
msgstr ""
#: gcp:345
msgid ""
"Invalid --preserve value\n"
"valid values are:"
#, python-format
msgid "Invalid --preserve value '%s'"
msgstr ""
#: gcp:354