list: fix weird mixup of mtime/isomtime

(cherry picked from commit 2ff29891f1)
This commit is contained in:
Marian Beermann 2017-08-07 13:01:33 +02:00 committed by Thomas Waldmann
parent 818e5c8e01
commit fa65c9b143
3 changed files with 16 additions and 3 deletions

View File

@ -131,6 +131,19 @@ The best check that everything is ok is to run a dry-run extraction::
Changelog Changelog
========= =========
Version 1.1.0rc2 (not released yet)
------------------------------------
Compatibility notes:
- list: corrected mix-up of "isomtime" and "mtime" formats. Previously,
"isomtime" was the default but produced a verbose human format,
while "mtime" produced a ISO-8601-like format.
The behaviours have been swapped (so "mtime" is human, "isomtime" is ISO-like),
and the default is now "mtime".
"isomtime" is now a real ISO-8601 format ("T" between date and time, not a space).
Version 1.1.0rc1 (2017-07-24) Version 1.1.0rc1 (2017-07-24)
----------------------------- -----------------------------

View File

@ -1334,7 +1334,7 @@ class Archiver:
elif args.short: elif args.short:
format = "{path}{NL}" format = "{path}{NL}"
else: else:
format = "{mode} {user:6} {group:6} {size:8} {isomtime} {path}{extra}{NL}" format = "{mode} {user:6} {group:6} {size:8} {mtime} {path}{extra}{NL}"
def _list_inner(cache): def _list_inner(cache):
archive = Archive(repository, key, manifest, args.location.archive, cache=cache, archive = Archive(repository, key, manifest, args.location.archive, cache=cache,
@ -3119,7 +3119,7 @@ class Archiver:
help='only print file/directory names, nothing else') help='only print file/directory names, nothing else')
subparser.add_argument('--format', '--list-format', metavar='FORMAT', dest='format', subparser.add_argument('--format', '--list-format', metavar='FORMAT', dest='format',
help='specify format for file listing ' help='specify format for file listing '
'(default: "{mode} {user:6} {group:6} {size:8d} {isomtime} {path}{extra}{NL}")') '(default: "{mode} {user:6} {group:6} {size:8d} {mtime} {path}{extra}{NL}")')
subparser.add_argument('--json', action='store_true', subparser.add_argument('--json', action='store_true',
help='Only valid for listing repository contents. Format output as JSON. ' help='Only valid for listing repository contents. Format output as JSON. '
'The form of ``--format`` is ignored, ' 'The form of ``--format`` is ignored, '

View File

@ -1787,7 +1787,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
output_warn = self.cmd('list', '--list-format', '-', test_archive) output_warn = self.cmd('list', '--list-format', '-', test_archive)
self.assert_in('--list-format" has been deprecated.', output_warn) self.assert_in('--list-format" has been deprecated.', output_warn)
output_1 = self.cmd('list', test_archive) output_1 = self.cmd('list', test_archive)
output_2 = self.cmd('list', '--format', '{mode} {user:6} {group:6} {size:8d} {isomtime} {path}{extra}{NEWLINE}', test_archive) output_2 = self.cmd('list', '--format', '{mode} {user:6} {group:6} {size:8d} {mtime} {path}{extra}{NEWLINE}', test_archive)
output_3 = self.cmd('list', '--format', '{mtime:%s} {path}{NL}', test_archive) output_3 = self.cmd('list', '--format', '{mtime:%s} {path}{NL}', test_archive)
self.assertEqual(output_1, output_2) self.assertEqual(output_1, output_2)
self.assertNotEqual(output_1, output_3) self.assertNotEqual(output_1, output_3)