Explorar o código

Add begin_txn progress message

Abogical %!s(int64=8) %!d(string=hai) anos
pai
achega
be6341b956
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      src/borg/cache.py

+ 5 - 0
src/borg/cache.py

@@ -233,14 +233,19 @@ Chunk index:    {0.total_unique_chunks:20d} {0.total_chunks:20d}"""
 
 
     def begin_txn(self):
     def begin_txn(self):
         # Initialize transaction snapshot
         # Initialize transaction snapshot
+        pi = ProgressIndicatorMessage()
         txn_dir = os.path.join(self.path, 'txn.tmp')
         txn_dir = os.path.join(self.path, 'txn.tmp')
         os.mkdir(txn_dir)
         os.mkdir(txn_dir)
+        pi.output('Initializing cache transaction: Reading config')
         shutil.copy(os.path.join(self.path, 'config'), txn_dir)
         shutil.copy(os.path.join(self.path, 'config'), txn_dir)
+        pi.output('Initializing cache transaction: Reading chunks')
         shutil.copy(os.path.join(self.path, 'chunks'), txn_dir)
         shutil.copy(os.path.join(self.path, 'chunks'), txn_dir)
+        pi.output('Initializing cache transaction: Reading files')
         shutil.copy(os.path.join(self.path, 'files'), txn_dir)
         shutil.copy(os.path.join(self.path, 'files'), txn_dir)
         os.rename(os.path.join(self.path, 'txn.tmp'),
         os.rename(os.path.join(self.path, 'txn.tmp'),
                   os.path.join(self.path, 'txn.active'))
                   os.path.join(self.path, 'txn.active'))
         self.txn_active = True
         self.txn_active = True
+        pi.finish()
 
 
     def commit(self):
     def commit(self):
         """Commit transaction
         """Commit transaction