Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 5
0
 def test_writable(self):
     transaction = transactions.PassThroughTransaction()
     self.assertTrue(transaction.writeable())
Ejemplo n.º 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"))
Ejemplo n.º 7
0
 def test_finish_returns(self):
     transaction = transactions.PassThroughTransaction()
     transaction.finish()
Ejemplo n.º 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"))
Ejemplo n.º 9
0
 def test_map(self):
     transaction = transactions.PassThroughTransaction()
     self.assertNotEqual(None, getattr(transaction, "map", None))
Ejemplo n.º 10
0
 def test_register_dirty(self):
     transaction = transactions.PassThroughTransaction()
     transaction.register_dirty("anobject")
Ejemplo n.º 11
0
 def test_construct(self):
     transactions.PassThroughTransaction()