InternalRevisionRecorder does not do anything; remove it.
[cvs2svn.git] / cvs2svn_lib / changeset_database.py
blob82ca9043c012f68f4a2340b469d167e5ce6130e4
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
37 # to the change:
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())
44 else:
45 return RecordTable(filename, mode, UnsignedIntegerPacker())
48 class ChangesetDatabase(IndexedStore):
49 def __init__(self, filename, index_filename, mode):
50 primer = (
51 Changeset,
52 RevisionChangeset,
53 OrderedChangeset,
54 SymbolChangeset,
55 BranchChangeset,
56 TagChangeset,
58 IndexedStore.__init__(
59 self, filename, index_filename, mode, PrimedPickleSerializer(primer))
61 def store(self, changeset):
62 self.add(changeset)
64 def keys(self):
65 return list(self.iterkeys())
67 def close(self):
68 IndexedStore.close(self)