public class GitLookup extends Object
Modifier and Type | Class and Description |
---|---|
static class |
GitLookup.DateSource |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_COMMITS_COUNT |
static TimeZone |
DEFAULT_ZONE |
Constructor and Description |
---|
GitLookup(File anyFile,
GitLookup.DateSource dateSource,
TimeZone timeZone,
int checkCommitsCount)
Creates a new
GitLookup for a repository that is detected from the supplied anyFile . |
Modifier and Type | Method and Description |
---|---|
int |
getYearOfLastChange(File file)
Returns the year of the last change of the given
file based on the history of the present git branch. |
public static final TimeZone DEFAULT_ZONE
public static final int DEFAULT_COMMITS_COUNT
public GitLookup(File anyFile, GitLookup.DateSource dateSource, TimeZone timeZone, int checkCommitsCount) throws IOException
GitLookup
for a repository that is detected from the supplied anyFile
.
Note on time zones:
anyFile
- - any path from the working tree of the git repository to consider in all subsequent calls to
getYearOfLastChange(File)
dateSource
- where to read the comit dates from - committer date or author datetimeZone
- the time zone if dateSource
is GitLookup.DateSource.COMMITER
; otherwise must be null
.checkCommitsCount
- IOException
public int getYearOfLastChange(File file) throws org.eclipse.jgit.api.errors.NoHeadException, org.eclipse.jgit.api.errors.GitAPIException, IOException
file
based on the history of the present git branch. The
year is taken either from the committer date or from the author identity depending on how dateSource
was
initialized.
See also the note on time zones in GitLookup(File, DateSource, TimeZone, int)
.
file
- org.eclipse.jgit.api.errors.NoHeadException
org.eclipse.jgit.api.errors.GitAPIException
IOException
Copyright © 2008–2016 Mycila. All rights reserved.