added revision to BlameLine

This commit is contained in:
Sebastian Sdorra
2011-09-14 11:58:58 +02:00
parent 77951efb71
commit f4367f2684
10 changed files with 51 additions and 18 deletions

View File

@@ -193,6 +193,7 @@ public abstract class AbstractRepositoryHandler<C extends SimpleRepositoryConfig
* @param repository
*
* @return
* @since 1.8
*/
@Override
public BlameViewer getBlameViewer(Repository repository)

View File

@@ -40,9 +40,8 @@ import java.util.Date;
/**
* Class description
*
*
* @version Enter version here..., 11/09/14
* @author Enter your name here...
* @author Sebastian Sdorra
* @since 1.8
*/
public class BlameLine
{
@@ -60,15 +59,17 @@ public class BlameLine
* @param emailAddress
* @param name
* @param when
* @param revision
* @param code
* @param lineNumber
*/
public BlameLine(String emailAddress, String name, Date when, String code,
int lineNumber)
public BlameLine(String emailAddress, String name, Date when,
String revision, String code, int lineNumber)
{
this.emailAddress = emailAddress;
this.name = name;
this.when = when;
this.revision = revision;
this.code = code;
this.lineNumber = lineNumber;
}
@@ -119,6 +120,17 @@ public class BlameLine
return name;
}
/**
* Method description
*
*
* @return
*/
public String getRevision()
{
return revision;
}
/**
* Method description
*
@@ -176,6 +188,17 @@ public class BlameLine
this.name = name;
}
/**
* Method description
*
*
* @param revision
*/
public void setRevision(String revision)
{
this.revision = revision;
}
/**
* Method description
*
@@ -201,6 +224,9 @@ public class BlameLine
/** Field description */
private String name;
/** Field description */
private String revision;
/** Field description */
private Date when;
}

View File

@@ -47,8 +47,8 @@ import javax.xml.bind.annotation.XmlRootElement;
* Class description
*
*
* @version Enter version here..., 11/09/14
* @author Enter your name here...
* @author Sebastian Sdorra
* @since 1.8
*/
@XmlRootElement(name = "blame-paging")
@XmlAccessorType(XmlAccessType.FIELD)

View File

@@ -37,8 +37,8 @@ package sonia.scm.repository;
* Interface description
*
*
* @version Enter version here..., 11/09/14
* @author Enter your name here...
* @author Sebastian Sdorra
* @since 1.8
*/
public interface BlameViewer
{

View File

@@ -49,9 +49,8 @@ import sonia.scm.util.AssertUtil;
/**
* Class description
*
*
* @version Enter version here..., 11/09/14
* @author Enter your name here...
* @author Sebastian Sdorra
* @since 1.8
*/
@Singleton
public class BlameViewerUtil extends CacheClearHook

View File

@@ -43,6 +43,7 @@ import sonia.scm.plugin.ExtensionPoint;
/**
*
* @author Sebastian Sdorra
* @since 1.8
*/
@ExtensionPoint
public interface RepositoryHandler

View File

@@ -73,6 +73,7 @@ public interface RepositoryManager
* @return null if BlameViewer is not supported
*
* @throws RepositoryException
* @since 1.8
*/
public BlameViewer getBlameViewer(Repository repository)
throws RepositoryException;

View File

@@ -57,8 +57,7 @@ import java.util.List;
* Class description
*
*
* @version Enter version here..., 11/09/14
* @author Enter your name here...
* @author Sebastian Sdorra
*/
public class GitBlameViewer implements BlameViewer
{
@@ -130,6 +129,10 @@ public class GitBlameViewer implements BlameViewer
blameLine.setEmailAddress(author.getEmailAddress());
blameLine.setWhen(author.getWhen());
String rev = blameResult.getSourceCommit(i).getId().getName();
blameLine.setRevision(rev);
String content = blameResult.getResultContents().getString(i);
blameLine.setCode(content);

View File

@@ -131,7 +131,9 @@ public class SvnBlameViewer implements BlameViewer
String mergedPath, int lineNumber)
throws SVNException
{
blameLines.add(new BlameLine(null, author, date, line, lineNumber));
blameLines.add(new BlameLine(null, author, date,
String.valueOf(revision), line,
lineNumber));
}
@Override
public boolean handleRevision(Date date, long revision, String author,

View File

@@ -118,11 +118,11 @@ public class PlainBlameProvider
for (BlameLine line : bpr.getBlameLines())
{
String name = line.getName();
String revision = line.getRevision();
if (Util.isNotEmpty(name))
if (Util.isNotEmpty(revision))
{
writer.append(name).append(" ");
writer.append(revision).append(" ");
}
writer.println(line.getCode());