Represents one versioned file in the
Repository
,
including its name,
Directory
and
Revision
list.
Revisions can be created using the
addXXXRevision factory
methods. Revisions can be created in any order.
TODO: Rename class to something like VersionedFile, getCurrentLinesOfCode() to getCurrentLines(), maybe getFilenameXXX, isDead() to isDeleted()
addBeginOfLogRevision
public Revision addBeginOfLogRevision(Date date,
int lines,
SortedSet symbolicNames)
Adds a "begin of log" revision to the file. This kind of revision
only marks the beginning of the log timespan if the file was
already present in the repository at this time. It is not an actual
revision committed by an author.
date
- the begin of the loglines
- the number of lines in the file at that time
addChangeRevision
public Revision addChangeRevision(String revisionNumber,
Author author,
Date date,
String comment,
int lines,
int linesDelta,
int replacedLines,
SortedSet symbolicNames)
Adds a change revision to the file.
revisionNumber
- the revision number, for example "1.1"author
- the login from which the change was committeddate
- the time when the change was committedcomment
- the commit messagelines
- the number of lines in the file after the changelinesDelta
- the change in the number of linesreplacedLines
- number of lines that were removed and replaced by others
addDeletionRevision
public Revision addDeletionRevision(String revisionNumber,
Author author,
Date date,
String comment,
int lines,
SortedSet symbolicNames)
Adds a deletion revision to the file.
revisionNumber
- the revision number, for example "1.1"author
- the login from which the change was committeddate
- the time when the change was committedcomment
- the commit messagelines
- the number of lines in the file before it was deleted
addInitialRevision
public Revision addInitialRevision(String revisionNumber,
Author author,
Date date,
String comment,
int lines,
SortedSet symbolicNames)
Adds an initial revision to the file. An initial revision is either
the first revision of the file, or a re-add after the file was
deleted.
revisionNumber
- the revision number, for example "1.1"author
- the login from which the change was committeddate
- the time when the change was committedcomment
- the commit messagelines
- the number of lines of the new file
compareTo
public int compareTo(Object other)
Compares this file to another one, based on filename.
getAuthors
public Set getAuthors()
Returns a list of authors that have commited at least one revision of the file.
getCurrentLinesOfCode
public int getCurrentLinesOfCode()
Returns the current number of lines for this file. Binary files
and deleted files are assumed to have 0 lines.
- the current number of lines for this file
getDirectory
public Directory getDirectory()
Returns the file's Directory.
getFilename
public String getFilename()
Returns the filename without path.
- the filename without path
getFilenameWithPath
public String getFilenameWithPath()
Returns the full filename.
getInitialRevision
public Revision getInitialRevision()
Gets the earliest revision of this file.
- the earliest revision of this file
getLatestRevision
public Revision getLatestRevision()
Gets the latest revision of this file.
- the latest revision of this file
getPreviousRevision
public Revision getPreviousRevision(Revision revision)
Returns the revision which was replaced by the revision given as
argument. Returns null if the given revision is the initial
revision of this file.
revision
- a revision of this file
- this revision's predecessor
getRevisions
public SortedSet getRevisions()
Returns the list of
Revision
s of this file,
sorted from earliest to most recent.
hasAuthor
public boolean hasAuthor(Author author)
Returns true, if author
worked on this file.
author
- The Author
to search for
true
, if the author is listed in one of
this file's revisions
isDead
public boolean isDead()
Returns true
if the latest revision of this file was
a deletion.
true
if this file is deleted
toString
public String toString()