Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
ZopeVersionControl.VersionHistory.BranchInfo Class Reference
Inheritance diagram for ZopeVersionControl.VersionHistory.BranchInfo:
Inheritance graph
[legend]
Collaboration diagram for ZopeVersionControl.VersionHistory.BranchInfo:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def append
def versionIds
def latest
def __len__

Public Attributes

 date_created
 m_order
 m_date
 name
 root

Detailed Description

A utility class to hold branch (line-of-descent) information. It
   maintains the name of the branch, the version id of the root of
   the branch and indices to allow for efficient lookups.

Definition at line 225 of file VersionHistory.py.


Constructor & Destructor Documentation

def ZopeVersionControl.VersionHistory.BranchInfo.__init__ (   self,
  name,
  root 
)

Definition at line 230 of file VersionHistory.py.

00230 
00231     def __init__(self, name, root):
00232         # m_order maintains a newest-first mapping of int -> version id.
00233         # m_date maintains a mapping of a packed date (int # of minutes
00234         # since the epoch) to a lookup key in m_order. The two structures
00235         # are separate because we only support minute precision for date
00236         # lookups (and multiple versions could be added in a minute).
00237         self.date_created = time.time()
00238         self.m_order = IOBTree()
00239         self.m_date = IIBTree()
00240         self.name = name
00241         self.root = root


Member Function Documentation

Definition at line 264 of file VersionHistory.py.

00264 
00265     def __len__(self):
00266         return len(self.m_order)
00267 
00268 InitializeClass(BranchInfo)
Append a version to the branch information. Note that this
   does not store the actual version, but metadata about the
   version to support ordering and date lookups.

Definition at line 242 of file VersionHistory.py.

00242 
00243     def append(self, version):
00244         """Append a version to the branch information. Note that this
00245            does not store the actual version, but metadata about the
00246            version to support ordering and date lookups."""
00247         if len(self.m_order):
00248             key = self.m_order.minKey() - 1
00249         else: key = sys.maxint
00250         self.m_order[key] = version.id
00251         timestamp = int(version.date_created / 60.0)
00252         self.m_date[timestamp] = key

Here is the caller graph for this function:

Return the version id of the latest version in the branch.

Definition at line 257 of file VersionHistory.py.

00257 
00258     def latest(self):
00259         """Return the version id of the latest version in the branch."""
00260         mapping = self.m_order
00261         if not len(mapping):
00262             return self.root
00263         return mapping[mapping.keys()[0]]

Return a newest-first sequence of version ids in the branch.

Definition at line 253 of file VersionHistory.py.

00253 
00254     def versionIds(self):
00255         """Return a newest-first sequence of version ids in the branch."""
00256         return self.m_order.values()


Member Data Documentation

Definition at line 236 of file VersionHistory.py.

Definition at line 238 of file VersionHistory.py.

Definition at line 237 of file VersionHistory.py.

Definition at line 239 of file VersionHistory.py.

Definition at line 240 of file VersionHistory.py.


The documentation for this class was generated from the following file: