Browse Source

dump-repo-objs: filename layout improvements

(cherry picked from commit 24812b03172365e7f3989ae98d49095cd7a4dba5)
Thomas Waldmann 7 năm trước cách đây
mục cha
commit
eebc33a281

+ 1 - 1
src/borg/archiver.py

@@ -1758,7 +1758,7 @@ class Archiver:
             segment_str = '_' + str(segment) if segment is not None else ''
             segment_str = '_' + str(segment) if segment is not None else ''
             offset_str = '_' + str(offset) if offset is not None else ''
             offset_str = '_' + str(offset) if offset is not None else ''
             id_str = '_' + bin_to_hex(id) if id is not None else ''
             id_str = '_' + bin_to_hex(id) if id is not None else ''
-            filename = '%06d%s%s%s%s.obj' % (i, tag_str, segment_str, offset_str, id_str)
+            filename = '%08d%s%s%s%s.obj' % (i, segment_str, offset_str, tag_str, id_str)
             print('Dumping', filename)
             print('Dumping', filename)
             with open(filename, 'wb') as fd:
             with open(filename, 'wb') as fd:
                 fd.write(data)
                 fd.write(data)

+ 1 - 1
src/borg/testsuite/archiver.py

@@ -2331,7 +2331,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         with changedir('output'):
         with changedir('output'):
             output = self.cmd('debug', 'dump-repo-objs', self.repository_location)
             output = self.cmd('debug', 'dump-repo-objs', self.repository_location)
         output_dir = sorted(os.listdir('output'))
         output_dir = sorted(os.listdir('output'))
-        assert len(output_dir) > 0 and output_dir[0].startswith('000000_')
+        assert len(output_dir) > 0 and output_dir[0].startswith('00000000_')
         assert 'Done.' in output
         assert 'Done.' in output
 
 
     def test_debug_put_get_delete_obj(self):
     def test_debug_put_get_delete_obj(self):