Exemplo n.º 1
0
class NewCVSItemStore:
    """A file of sequential CVSItems, grouped by CVSFile.

  The file consists of a sequence of pickles.  The zeroth one is a
  Serializer as described in the serializer module.  Subsequent ones
  are pickled lists of CVSItems, each list containing all of the
  CVSItems for a single file.

  We don't use a single pickler for all items because the memo would
  grow too large."""
    def __init__(self, filename):
        """Initialize an instance, creating the file and writing the primer."""

        self.f = open(filename, 'wb')

        self.serializer = PrimedPickleSerializer(cvs_item_primer +
                                                 (CVSFileItems, ))
        cPickle.dump(self.serializer, self.f, -1)

    def add(self, cvs_file_items):
        """Write CVS_FILE_ITEMS into the database."""

        self.serializer.dumpf(self.f, cvs_file_items)

    def close(self):
        self.f.close()
        self.f = None
Exemplo n.º 2
0
class NewCVSItemStore:
  """A file of sequential CVSItems, grouped by CVSFile.

  The file consists of a sequence of pickles.  The zeroth one is a
  Serializer as described in the serializer module.  Subsequent ones
  are pickled lists of CVSItems, each list containing all of the
  CVSItems for a single file.

  We don't use a single pickler for all items because the memo would
  grow too large."""

  def __init__(self, filename):
    """Initialize an instance, creating the file and writing the primer."""

    self.f = open(filename, 'wb')

    self.serializer = PrimedPickleSerializer(
        cvs_item_primer + (CVSFileItems,)
        )
    cPickle.dump(self.serializer, self.f, -1)

  def add(self, cvs_file_items):
    """Write CVS_FILE_ITEMS into the database."""

    self.serializer.dumpf(self.f, cvs_file_items)

  def close(self):
    self.f.close()
    self.f = None
Exemplo n.º 3
0
    def __init__(self, filename):
        """Initialize an instance, creating the file and writing the primer."""

        self.f = open(filename, 'wb')

        self.serializer = PrimedPickleSerializer(cvs_item_primer +
                                                 (CVSFileItems, ))
        cPickle.dump(self.serializer, self.f, -1)
Exemplo n.º 4
0
  def __init__(self, filename):
    """Initialize an instance, creating the file and writing the primer."""

    self.f = open(filename, 'wb')

    self.serializer = PrimedPickleSerializer(
        cvs_item_primer + (CVSFileItems,)
        )
    cPickle.dump(self.serializer, self.f, -1)
Exemplo n.º 5
0
 def start(self):
     self._tree_db = IndexedDatabase(
         artifact_manager.get_temp_file(config.RCS_TREES_STORE),
         artifact_manager.get_temp_file(config.RCS_TREES_INDEX_TABLE),
         DB_OPEN_READ)
     primer = (FullTextRecord, DeltaTextRecord)
     self._new_tree_db = IndexedDatabase(
         artifact_manager.get_temp_file(config.RCS_TREES_FILTERED_STORE),
         artifact_manager.get_temp_file(
             config.RCS_TREES_FILTERED_INDEX_TABLE), DB_OPEN_NEW,
         PrimedPickleSerializer(primer))
Exemplo n.º 6
0
 def __init__(self, filename, index_filename, mode):
     primer = (
         Changeset,
         RevisionChangeset,
         OrderedChangeset,
         SymbolChangeset,
         BranchChangeset,
         TagChangeset,
     )
     IndexedStore.__init__(self, filename, index_filename, mode,
                           PrimedPickleSerializer(primer))
Exemplo n.º 7
0
 def start(self):
     ser = MarshalSerializer()
     if self._compress:
         ser = CompressingSerializer(ser)
     self._rcs_deltas = IndexedDatabase(
         artifact_manager.get_temp_file(config.RCS_DELTAS_STORE),
         artifact_manager.get_temp_file(config.RCS_DELTAS_INDEX_TABLE),
         DB_OPEN_NEW, ser)
     primer = (FullTextRecord, DeltaTextRecord)
     self._rcs_trees = IndexedDatabase(
         artifact_manager.get_temp_file(config.RCS_TREES_STORE),
         artifact_manager.get_temp_file(config.RCS_TREES_INDEX_TABLE),
         DB_OPEN_NEW, PrimedPickleSerializer(primer))
Exemplo n.º 8
0
def MetadataDatabase(store_filename, index_table_filename, mode):
  """A Database to store Metadata instances that describe CVSRevisions.

  This database manages a map

      id -> Metadata instance

  where id is a unique identifier for the metadata."""

  return IndexedDatabase(
      store_filename, index_table_filename,
      mode, PrimedPickleSerializer((Metadata,)),
      )
Exemplo n.º 9
0
 def __init__(self, mode):
   self.mode = mode
   if mode not in (DB_OPEN_NEW, DB_OPEN_READ):
     raise RuntimeError, "Invalid 'mode' argument to PersistenceManager"
   primer = (
       SVNInitialProjectCommit,
       SVNPrimaryCommit,
       SVNPostCommit,
       SVNBranchCommit,
       SVNTagCommit,
       )
   serializer = PrimedPickleSerializer(primer)
   self.svn_commit_db = IndexedDatabase(
       artifact_manager.get_temp_file(config.SVN_COMMITS_INDEX_TABLE),
       artifact_manager.get_temp_file(config.SVN_COMMITS_STORE),
       mode, serializer)
   self.cvs2svn_db = RecordTable(
       artifact_manager.get_temp_file(config.CVS_REVS_TO_SVN_REVNUMS),
       mode, SignedIntegerPacker(SVN_INVALID_REVNUM))
Exemplo n.º 10
0
def IndexedCVSItemStore(filename, index_filename, mode):
    return IndexedStore(filename, index_filename, mode,
                        PrimedPickleSerializer(cvs_item_primer))