mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 09:19:31 +00:00
Store stat data even for hard links to make file listing prettier
This commit is contained in:
parent
fa6a45cb1c
commit
af95b7c996
2 changed files with 14 additions and 4 deletions
|
@ -258,8 +258,9 @@ def process_file(self, path, st, cache):
|
||||||
if st.st_nlink > 1:
|
if st.st_nlink > 1:
|
||||||
source = self.hard_links.get((st.st_ino, st.st_dev))
|
source = self.hard_links.get((st.st_ino, st.st_dev))
|
||||||
if (st.st_ino, st.st_dev) in self.hard_links:
|
if (st.st_ino, st.st_dev) in self.hard_links:
|
||||||
self.add_item({'mode': st.st_mode,
|
item = self.stat_attrs(st, path)
|
||||||
'path': path, 'source': source})
|
item.update({'path': path, 'source': source})
|
||||||
|
self.add_item(item)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.hard_links[st.st_ino, st.st_dev] = safe_path
|
self.hard_links[st.st_ino, st.st_dev] = safe_path
|
||||||
|
|
|
@ -150,8 +150,17 @@ def do_list(self, args):
|
||||||
mode = format_file_mode(item['mode'])
|
mode = format_file_mode(item['mode'])
|
||||||
size = item.get('size', 0)
|
size = item.get('size', 0)
|
||||||
mtime = format_time(datetime.fromtimestamp(item['mtime']))
|
mtime = format_time(datetime.fromtimestamp(item['mtime']))
|
||||||
print '%s%s %-6s %-6s %8d %s %s' % (type, mode, item['user'],
|
if 'source' in item:
|
||||||
item['group'], size, mtime, item['path'])
|
if type == 'l':
|
||||||
|
extra = ' -> %s' % item['source']
|
||||||
|
else:
|
||||||
|
type = 'h'
|
||||||
|
extra = ' link to %s' % item['source']
|
||||||
|
else:
|
||||||
|
extra = ''
|
||||||
|
print '%s%s %-6s %-6s %8d %s %s%s' % (type, mode, item['user'],
|
||||||
|
item['group'], size, mtime,
|
||||||
|
item['path'], extra)
|
||||||
else:
|
else:
|
||||||
for archive in sorted(Archive.list_archives(store, keychain), key=attrgetter('ts')):
|
for archive in sorted(Archive.list_archives(store, keychain), key=attrgetter('ts')):
|
||||||
print '%-20s %s' % (archive.metadata['name'], to_localtime(archive.ts).strftime('%c'))
|
print '%-20s %s' % (archive.metadata['name'], to_localtime(archive.ts).strftime('%c'))
|
||||||
|
|
Loading…
Reference in a new issue