Exemple #1
0
 def test_finish_tells_versioned_file_finished(self):
     # pass through transactions allow writes so they
     # need to inform versioned files about finishing
     weave = DummyWeave('a weave')
     transaction = transactions.PassThroughTransaction()
     transaction.register_dirty(weave)
     transaction.finish()
     self.assertTrue(weave.finished)
Exemple #2
0
    def get_transaction(self):
        """Return the current active transaction.

        If no transaction is active, this returns a passthrough object
        for which all data is immediately flushed and no caching happens.
        """
        if self._transaction is not None:
            return self._transaction
        else:
            return transactions.PassThroughTransaction()
Exemple #3
0
 def lock_write(self, token=None):
     if token is not None:
         raise errors.TokenLockingNotSupported(self)
     if self._lock_mode is not None:
         if self._lock_mode != 'w':
             raise errors.ReadOnlyError(self)
         self._lock_count += 1
     else:
         self._lock_mode = 'w'
         self._lock = self._hgrepo.wlock(wait=False)
         self._transaction = transactions.PassThroughTransaction()
         self._lock_count = 1
Exemple #4
0
 def lock_read(self):
     if self._lock_mode:
         if self._lock_mode not in ('r', 'w'):
             raise ValueError("invalid lock mode %r" % (self._lock_mode, ))
         self._lock_count += 1
     else:
         self._lock_mode = 'r'
         if self._supports_read_lock:
             self._lock = self._hgrepo.lock()
         else:
             self._lock = None
         self._transaction = transactions.PassThroughTransaction()
         self._lock_count = 1
Exemple #5
0
 def test_writable(self):
     transaction = transactions.PassThroughTransaction()
     self.assertTrue(transaction.writeable())
Exemple #6
0
 def test_cache_is_ignored(self):
     transaction = transactions.PassThroughTransaction()
     transaction.set_cache_size(100)
     weave = "a weave"
     transaction.map.add_weave("id", weave)
     self.assertEqual(None, transaction.map.find_weave("id"))
Exemple #7
0
 def test_finish_returns(self):
     transaction = transactions.PassThroughTransaction()
     transaction.finish()
Exemple #8
0
 def test_add_and_get(self):
     transaction = transactions.PassThroughTransaction()
     weave = "a weave"
     transaction.map.add_weave("id", weave)
     self.assertEqual(None, transaction.map.find_weave("id"))
Exemple #9
0
 def test_map(self):
     transaction = transactions.PassThroughTransaction()
     self.assertNotEqual(None, getattr(transaction, "map", None))
Exemple #10
0
 def test_register_dirty(self):
     transaction = transactions.PassThroughTransaction()
     transaction.register_dirty("anobject")
Exemple #11
0
 def test_construct(self):
     transactions.PassThroughTransaction()