Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
RevisionTable Class Reference

Provides a way to map from a file path to its CVS revision number. More...

Collaboration diagram for RevisionTable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

String getRevision (String path) throws IOException

Private Member Functions

boolean readEntries (String dirPath) throws IOException
 Reads all of the entries from a CVS Entries file, and populates the hashtable with the revisions, keyed by file paths.

Private Attributes

Hashtable revisions = new Hashtable()

Detailed Description

Provides a way to map from a file path to its CVS revision number.

Definition at line 43 of file RevisionTable.java.


Member Function Documentation

String RevisionTable.getRevision ( String  path) throws IOException [inline]

Definition at line 46 of file RevisionTable.java.

                                                                 {
              String revision = (String) revisions.get(path);
              if (revision == null) {
                     int lastSlash = path.lastIndexOf('/');
                     String dirPath = path.substring(0, lastSlash + 1);
                     if (!readEntries(dirPath))
                            revisions.put(path, "");
                     revision = (String) revisions.get(path);
              }
              return revision;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

boolean RevisionTable.readEntries ( String  dirPath) throws IOException [inline, private]

Reads all of the entries from a CVS Entries file, and populates the hashtable with the revisions, keyed by file paths.

Definition at line 62 of file RevisionTable.java.

                                                                      {
              File entriesFile = new File(dirPath + "CVS/Entries");
              if (entriesFile.exists()) {        
                     BufferedReader entries = new BufferedReader(new InputStreamReader(new FileInputStream(entriesFile)));
                     for (String line = entries.readLine(); line != null; line = entries.readLine()) {
                            if (line.charAt(0) == '/') {
                                   int secondSlash = line.indexOf('/', 1);
                                   String fileName = line.substring(1, secondSlash);
                                   int thirdSlash = line.indexOf('/', secondSlash + 1);
                                   String revision = line.substring(secondSlash + 1, thirdSlash);
                                   revisions.put(dirPath + fileName, revision);
                            }
                     }
                     entries.close();
                     return true;
              }
              return false;
       }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Hashtable RevisionTable.revisions = new Hashtable() [private]

Definition at line 44 of file RevisionTable.java.


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