1 # (Be in -*- python -*- mode.)
3 # ====================================================================
4 # Copyright (c) 2006-2008 CollabNet. All rights reserved.
6 # This software is licensed as described in the file COPYING, which
7 # you should have received as part of this distribution. The terms
8 # are also available at http://subversion.tigris.org/license-1.html.
9 # If newer versions of this license are posted there, you may use a
10 # newer version instead, at your option.
12 # This software consists of voluntary contributions made by many
13 # individuals. For exact contribution history, see the revision
14 # history and logs, available at http://cvs2svn.tigris.org/.
15 # ====================================================================
17 """This module contains classes to store changesets."""
20 from cvs2svn_lib
.changeset
import Changeset
21 from cvs2svn_lib
.changeset
import RevisionChangeset
22 from cvs2svn_lib
.changeset
import OrderedChangeset
23 from cvs2svn_lib
.changeset
import SymbolChangeset
24 from cvs2svn_lib
.changeset
import BranchChangeset
25 from cvs2svn_lib
.changeset
import TagChangeset
26 from cvs2svn_lib
.record_table
import UnsignedIntegerPacker
27 from cvs2svn_lib
.record_table
import MmapRecordTable
28 from cvs2svn_lib
.record_table
import RecordTable
29 from cvs2svn_lib
.database
import IndexedStore
30 from cvs2svn_lib
.serializer
import PrimedPickleSerializer
33 # Should the CVSItemToChangesetTable database files be memory mapped?
34 # This speeds up the converstion but can cause the computer's virtual
35 # address space to be exhausted. This option can be changed
36 # externally, affecting any CVSItemToChangesetTables opened subsequent
38 use_mmap_for_cvs_item_to_changeset_table
= False
41 def CVSItemToChangesetTable(filename
, mode
):
42 if use_mmap_for_cvs_item_to_changeset_table
:
43 return MmapRecordTable(filename
, mode
, UnsignedIntegerPacker())
45 return RecordTable(filename
, mode
, UnsignedIntegerPacker())
48 class ChangesetDatabase(IndexedStore
):
49 def __init__(self
, filename
, index_filename
, mode
):
58 IndexedStore
.__init
__(
59 self
, filename
, index_filename
, mode
, PrimedPickleSerializer(primer
))
61 def store(self
, changeset
):
65 return list(self
.iterkeys())
68 IndexedStore
.close(self
)