mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-01 19:15:52 +01:00
added revision to BlameLine
This commit is contained in:
@@ -193,6 +193,7 @@ public abstract class AbstractRepositoryHandler<C extends SimpleRepositoryConfig
|
||||
* @param repository
|
||||
*
|
||||
* @return
|
||||
* @since 1.8
|
||||
*/
|
||||
@Override
|
||||
public BlameViewer getBlameViewer(Repository repository)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -43,6 +43,7 @@ import sonia.scm.plugin.ExtensionPoint;
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 1.8
|
||||
*/
|
||||
@ExtensionPoint
|
||||
public interface RepositoryHandler
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user