@@ -0,0 +1,40 @@ | |||
/* | |||
* Copyright 2011 gitblit.com. | |||
* | |||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||
* you may not use this file except in compliance with the License. | |||
* You may obtain a copy of the License at | |||
* | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, software | |||
* distributed under the License is distributed on an "AS IS" BASIS, | |||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
* See the License for the specific language governing permissions and | |||
* limitations under the License. | |||
*/ | |||
package com.gitblit.models; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
import org.eclipse.jgit.revwalk.RevCommit; | |||
public class AnnotatedLine implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
public final String commitId; | |||
public final String author; | |||
public final Date when; | |||
public final int lineNumber; | |||
public final String data; | |||
public AnnotatedLine(RevCommit commit, int lineNumber, String data) { | |||
this.commitId = commit.getName(); | |||
this.author = commit.getAuthorIdent().getName(); | |||
this.when = commit.getAuthorIdent().getWhen(); | |||
this.lineNumber = lineNumber; | |||
this.data = data; | |||
} | |||
} |
@@ -22,7 +22,7 @@ public class GitNote implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
public String content; | |||
public RefModel notesRef; | |||
public RefModel notesRef; | |||
public GitNote(RefModel notesRef, String text) { | |||
this.notesRef = notesRef; |
@@ -127,7 +127,7 @@ public class RefModel implements Serializable, Comparable<RefModel> { | |||
public int compareTo(RefModel o) { | |||
return getDate().compareTo(o.getDate()); | |||
} | |||
@Override | |||
public String toString() { | |||
return displayName; |
@@ -16,10 +16,14 @@ | |||
package com.gitblit.utils; | |||
import java.io.ByteArrayOutputStream; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import org.eclipse.jgit.api.BlameCommand; | |||
import org.eclipse.jgit.blame.BlameResult; | |||
import org.eclipse.jgit.diff.DiffEntry; | |||
import org.eclipse.jgit.diff.DiffFormatter; | |||
import org.eclipse.jgit.diff.RawText; | |||
import org.eclipse.jgit.diff.RawTextComparator; | |||
import org.eclipse.jgit.lib.Repository; | |||
import org.eclipse.jgit.revwalk.RevCommit; | |||
@@ -30,6 +34,8 @@ import org.eclipse.jgit.treewalk.filter.TreeFilter; | |||
import org.slf4j.Logger; | |||
import org.slf4j.LoggerFactory; | |||
import com.gitblit.models.AnnotatedLine; | |||
public class DiffUtils { | |||
private static final Logger LOGGER = LoggerFactory.getLogger(DiffUtils.class); | |||
@@ -172,4 +178,24 @@ public class DiffUtils { | |||
} | |||
return null; | |||
} | |||
public static List<AnnotatedLine> blame(Repository r, String blobPath, String objectId) { | |||
List<AnnotatedLine> lines = new ArrayList<AnnotatedLine>(); | |||
try { | |||
BlameCommand blameCommand = new BlameCommand(r); | |||
blameCommand.setFilePath(blobPath); | |||
blameCommand.setStartCommit(r.resolve(objectId)); | |||
BlameResult blameResult = blameCommand.call(); | |||
RawText rawText = blameResult.getResultContents(); | |||
int length = rawText.size(); | |||
for (int i = 0; i < length; i++) { | |||
RevCommit commit = blameResult.getSourceCommit(i); | |||
AnnotatedLine line = new AnnotatedLine(commit, i + 1, rawText.getString(i)); | |||
lines.add(line); | |||
} | |||
} catch (Throwable t) { | |||
LOGGER.error("failed to generate blame!", t); | |||
} | |||
return lines; | |||
} | |||
} |
@@ -96,7 +96,8 @@ public class JGitUtils { | |||
return r.toString().trim(); | |||
} | |||
public static FetchResult cloneRepository(File repositoriesFolder, String name, String fromUrl) throws Exception { | |||
public static FetchResult cloneRepository(File repositoriesFolder, String name, String fromUrl) | |||
throws Exception { | |||
FetchResult result = null; | |||
if (!name.toLowerCase().endsWith(Constants.DOT_GIT_EXT)) { | |||
name += Constants.DOT_GIT_EXT; |
@@ -39,7 +39,8 @@ public class MetricUtils { | |||
private static final Logger LOGGER = LoggerFactory.getLogger(MetricUtils.class); | |||
public static List<Metric> getDateMetrics(Repository r, String objectId, boolean includeTotal, String format) { | |||
public static List<Metric> getDateMetrics(Repository r, String objectId, boolean includeTotal, | |||
String format) { | |||
Metric total = new Metric("TOTAL"); | |||
final Map<String, Metric> metricMap = new HashMap<String, Metric>(); | |||
if (StringUtils.isEmpty(objectId)) { |
@@ -134,8 +134,8 @@ public class StringUtils { | |||
} | |||
return ""; | |||
} | |||
public static String getRelativePath(String basePath, String fullPath) { | |||
public static String getRelativePath(String basePath, String fullPath) { | |||
String relativePath = fullPath.substring(basePath.length()).replace('\\', '/'); | |||
if (relativePath.charAt(0) == '/') { | |||
relativePath = relativePath.substring(1); |
@@ -30,14 +30,14 @@ public class TimeUtils { | |||
public static final long ONEYEAR = ONEDAY * 365L; | |||
public static boolean isToday(Date date) { | |||
return (System.currentTimeMillis() - date.getTime()) < ONEDAY; | |||
return (System.currentTimeMillis() - date.getTime()) < ONEDAY; | |||
} | |||
public static boolean isYesterday(Date date) { | |||
Calendar cal = Calendar.getInstance(); | |||
cal.setTime(date); | |||
cal.add(Calendar.DATE, 1); | |||
return (System.currentTimeMillis() - cal.getTimeInMillis()) < ONEDAY; | |||
return (System.currentTimeMillis() - cal.getTimeInMillis()) < ONEDAY; | |||
} | |||
public static String duration(int days) { |
@@ -87,7 +87,7 @@ public class GitBlitWebApp extends WebApplication { | |||
mount("/search", SearchPage.class); | |||
mount("/metrics", MetricsPage.class, "r"); | |||
mount("/blame", BlamePage.class, "r", "h", "f"); | |||
// setup ticket urls | |||
mount("/tickets", TicketsPage.class, "r"); | |||
mount("/ticket", TicketPage.class, "r", "h", "f"); |
@@ -299,7 +299,7 @@ public class WicketUtils { | |||
WicketUtils.setHtmlTooltip(label, title); | |||
return label; | |||
} | |||
public static IChartData getChartData(Collection<Metric> metrics) { | |||
final double[] commits = new double[metrics.size()]; | |||
final double[] tags = new double[metrics.size()]; | |||
@@ -334,7 +334,7 @@ public class WicketUtils { | |||
} | |||
return max; | |||
} | |||
public static IChartData getScatterData(Collection<Metric> metrics) { | |||
final double[] y = new double[metrics.size()]; | |||
final double[] x = new double[metrics.size()]; |
@@ -19,7 +19,7 @@ | |||
<div wicket:id="breadcrumbs">[breadcrumbs]</div> | |||
<!-- blame content --> | |||
<table> | |||
<table class="annotated" style="border-top: 0px; margin-bottom:5px;"> | |||
<tbody> | |||
<tr> | |||
<th>Commit</th> | |||
@@ -27,9 +27,9 @@ | |||
<th>Data</th> | |||
</tr> | |||
<tr wicket:id="annotation"> | |||
<td><span wicket:id="commit"></span></td> | |||
<td><span wicket:id="line"></span></td> | |||
<td><span wicket:id="data"></span></td> | |||
<td><span class="sha1" wicket:id="commit"></span></td> | |||
<td><span class="sha1" wicket:id="line"></span></td> | |||
<td><span class="sha1" wicket:id="data"></span></td> | |||
</tr> | |||
</tbody> | |||
</table> |
@@ -15,8 +15,9 @@ | |||
*/ | |||
package com.gitblit.wicket.pages; | |||
import java.io.Serializable; | |||
import java.util.Arrays; | |||
import java.text.DateFormat; | |||
import java.text.MessageFormat; | |||
import java.text.SimpleDateFormat; | |||
import java.util.List; | |||
import org.apache.wicket.PageParameters; | |||
@@ -28,6 +29,11 @@ import org.apache.wicket.markup.repeater.data.ListDataProvider; | |||
import org.eclipse.jgit.lib.Constants; | |||
import org.eclipse.jgit.revwalk.RevCommit; | |||
import com.gitblit.GitBlit; | |||
import com.gitblit.Keys; | |||
import com.gitblit.models.AnnotatedLine; | |||
import com.gitblit.utils.DiffUtils; | |||
import com.gitblit.utils.StringUtils; | |||
import com.gitblit.wicket.WicketUtils; | |||
import com.gitblit.wicket.panels.CommitHeaderPanel; | |||
import com.gitblit.wicket.panels.LinkPanel; | |||
@@ -43,8 +49,7 @@ public class BlamePage extends RepositoryPage { | |||
RevCommit commit = getCommit(); | |||
add(new BookmarkablePageLink<Void>("blobLink", BlobPage.class, | |||
WicketUtils.newPathParameter(repositoryName, objectId, | |||
blobPath))); | |||
WicketUtils.newPathParameter(repositoryName, objectId, blobPath))); | |||
add(new BookmarkablePageLink<Void>("commitLink", CommitPage.class, | |||
WicketUtils.newObjectParameter(repositoryName, objectId))); | |||
add(new BookmarkablePageLink<Void>("commitDiffLink", CommitDiffPage.class, | |||
@@ -60,38 +65,65 @@ public class BlamePage extends RepositoryPage { | |||
add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, blobPath, objectId)); | |||
List<BlameLine> blame = Arrays.asList(new BlameLine("HEAD", "1", "Under Construction")); | |||
ListDataProvider<BlameLine> blameDp = new ListDataProvider<BlameLine>(blame); | |||
DataView<BlameLine> blameView = new DataView<BlameLine>("annotation", blameDp) { | |||
String format = GitBlit.getString(Keys.web.datetimestampLongFormat, | |||
"EEEE, MMMM d, yyyy h:mm a z"); | |||
final DateFormat df = new SimpleDateFormat(format); | |||
df.setTimeZone(getTimeZone()); | |||
List<AnnotatedLine> lines = DiffUtils.blame(getRepository(), blobPath, objectId); | |||
ListDataProvider<AnnotatedLine> blameDp = new ListDataProvider<AnnotatedLine>(lines); | |||
DataView<AnnotatedLine> blameView = new DataView<AnnotatedLine>("annotation", blameDp) { | |||
private static final long serialVersionUID = 1L; | |||
private int count; | |||
private String lastCommitId = ""; | |||
private boolean showInitials = true; | |||
public void populateItem(final Item<BlameLine> item) { | |||
BlameLine entry = item.getModelObject(); | |||
item.add(new LinkPanel("commit", "list", entry.objectId, CommitPage.class, | |||
newCommitParameter(entry.objectId))); | |||
item.add(new Label("line", entry.line)); | |||
item.add(new Label("data", entry.data)); | |||
public void populateItem(final Item<AnnotatedLine> item) { | |||
AnnotatedLine entry = item.getModelObject(); | |||
item.add(new Label("line", "" + entry.lineNumber)); | |||
item.add(new Label("data", StringUtils.escapeForHtml(entry.data, true)) | |||
.setEscapeModelStrings(false)); | |||
if (!lastCommitId.equals(entry.commitId)) { | |||
lastCommitId = entry.commitId; | |||
count++; | |||
// show the link for first line | |||
LinkPanel commitLink = new LinkPanel("commit", null, | |||
getShortObjectId(entry.commitId), CommitPage.class, | |||
newCommitParameter(entry.commitId)); | |||
WicketUtils.setHtmlTooltip(commitLink, | |||
MessageFormat.format("{0}, {1}", entry.author, df.format(entry.when))); | |||
item.add(commitLink); | |||
showInitials = true; | |||
} else { | |||
if (showInitials) { | |||
showInitials = false; | |||
// show author initials | |||
item.add(new Label("commit", getInitials(entry.author))); | |||
} else { | |||
// hide the commit link until the next block | |||
item.add(new Label("commit").setVisible(false)); | |||
} | |||
} | |||
if (count % 2 == 0) { | |||
WicketUtils.setCssClass(item, "even"); | |||
} else { | |||
WicketUtils.setCssClass(item, "odd"); | |||
} | |||
} | |||
}; | |||
add(blameView); | |||
} | |||
private String getInitials(String author) { | |||
StringBuilder sb = new StringBuilder(); | |||
String[] chunks = author.split(" "); | |||
for (String chunk : chunks) { | |||
sb.append(chunk.charAt(0)); | |||
} | |||
return sb.toString().toUpperCase(); | |||
} | |||
@Override | |||
protected String getPageName() { | |||
return getString("gb.blame"); | |||
} | |||
private class BlameLine implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
final String objectId; | |||
final String line; | |||
final String data; | |||
BlameLine(String objectId, String line, String data) { | |||
this.objectId = objectId; | |||
this.line = line; | |||
this.data = data; | |||
} | |||
} | |||
} |
@@ -46,7 +46,8 @@ public class BlobPage extends RepositoryPage { | |||
// blob by objectid | |||
add(new BookmarkablePageLink<Void>("blameLink", BlamePage.class, | |||
WicketUtils.newPathParameter(repositoryName, objectId, blobPath)).setEnabled(false)); | |||
WicketUtils.newPathParameter(repositoryName, objectId, blobPath)) | |||
.setEnabled(false)); | |||
add(new BookmarkablePageLink<Void>("historyLink", HistoryPage.class).setEnabled(false)); | |||
add(new BookmarkablePageLink<Void>("rawLink", RawPage.class, | |||
WicketUtils.newPathParameter(repositoryName, objectId, blobPath))); |
@@ -101,7 +101,8 @@ public class CommitDiffPage extends RepositoryPage { | |||
item.add(new BookmarkablePageLink<Void>("blame", BlamePage.class, | |||
newPathParameter(entry.path))); | |||
item.add(new BookmarkablePageLink<Void>("history", HistoryPage.class, | |||
newPathParameter(entry.path)).setEnabled(!entry.changeType.equals(ChangeType.ADD))); | |||
newPathParameter(entry.path)).setEnabled(!entry.changeType | |||
.equals(ChangeType.ADD))); | |||
WicketUtils.setAlternatingBackground(item, counter); | |||
counter++; |
@@ -65,8 +65,8 @@ public class CommitPage extends RepositoryPage { | |||
add(new Label("parentLink", "none")); | |||
add(new Label("commitdiffLink", getString("gb.commitdiff"))); | |||
} else { | |||
add(new LinkPanel("parentLink", null, parents.get(0).substring(0, 8), CommitPage.class, | |||
newCommitParameter(parents.get(0)))); | |||
add(new LinkPanel("parentLink", null, getShortObjectId(parents.get(0)), | |||
CommitPage.class, newCommitParameter(parents.get(0)))); | |||
add(new LinkPanel("commitdiffLink", null, new StringResourceModel("gb.commitdiff", | |||
this, null), CommitDiffPage.class, WicketUtils.newObjectParameter( | |||
repositoryName, objectId))); |
@@ -107,11 +107,11 @@ public class EditRepositoryPage extends BasePage { | |||
repositoryModel.name = repositoryModel.name.replace("//", "/"); | |||
// prohibit folder paths | |||
if (repositoryModel.name.startsWith("/")) { | |||
if (repositoryModel.name.startsWith("/")) { | |||
error("Leading root folder references (/) are prohibited."); | |||
return; | |||
} | |||
if (repositoryModel.name.startsWith("../")) { | |||
if (repositoryModel.name.startsWith("../")) { | |||
error("Relative folder references (../) are prohibited."); | |||
return; | |||
} | |||
@@ -135,7 +135,7 @@ public class EditRepositoryPage extends BasePage { | |||
} | |||
} | |||
} | |||
// confirm access restriction selection | |||
if (repositoryModel.accessRestriction == null) { | |||
error("Please select access restriction!"); |
@@ -46,18 +46,18 @@ import com.gitblit.wicket.WicketUtils; | |||
public class MetricsPage extends RepositoryPage { | |||
public MetricsPage(PageParameters params) { | |||
super(params); | |||
super(params); | |||
Repository r = getRepository(); | |||
add(new Label("branchTitle", objectId)); | |||
Metric metricsTotal = null; | |||
List<Metric> metrics = MetricUtils.getDateMetrics(r, objectId, true, null); | |||
metricsTotal = metrics.remove(0); | |||
if (metricsTotal == null) { | |||
add(new Label("branchStats", "")); | |||
add(new Label("branchStats", "")); | |||
} else { | |||
add(new Label("branchStats", MessageFormat.format( | |||
"{0} commits and {1} tags in {2}", metricsTotal.count, metricsTotal.tag, | |||
TimeUtils.duration(metricsTotal.duration)))); | |||
add(new Label("branchStats", | |||
MessageFormat.format("{0} commits and {1} tags in {2}", metricsTotal.count, | |||
metricsTotal.tag, TimeUtils.duration(metricsTotal.duration)))); | |||
} | |||
insertLinePlot("commitsChart", metrics); | |||
insertBarPlot("dayOfWeekChart", getDayOfWeekMetrics(r, objectId)); |
@@ -218,6 +218,10 @@ public abstract class RepositoryPage extends BasePage { | |||
return commit; | |||
} | |||
protected String getShortObjectId(String objectId) { | |||
return objectId.substring(0, 8); | |||
} | |||
protected void addRefs(Repository r, RevCommit c) { | |||
add(new RefsPanel("refsPanel", repositoryName, c, JGitUtils.getAllRefs(r))); | |||
} |
@@ -89,13 +89,14 @@ public class SummaryPage extends RepositoryPage { | |||
add(WicketUtils.createTimestampLabel("repositoryLastChange", JGitUtils.getLastChange(r), | |||
getTimeZone())); | |||
if (metricsTotal == null) { | |||
add(new Label("branchStats", "")); | |||
add(new Label("branchStats", "")); | |||
} else { | |||
add(new Label("branchStats", MessageFormat.format( | |||
"{0} commits and {1} tags in {2}", metricsTotal.count, metricsTotal.tag, | |||
TimeUtils.duration(metricsTotal.duration)))); | |||
add(new Label("branchStats", | |||
MessageFormat.format("{0} commits and {1} tags in {2}", metricsTotal.count, | |||
metricsTotal.tag, TimeUtils.duration(metricsTotal.duration)))); | |||
} | |||
add(new BookmarkablePageLink<Void>("metrics", MetricsPage.class, WicketUtils.newRepositoryParameter(repositoryName))); | |||
add(new BookmarkablePageLink<Void>("metrics", MetricsPage.class, | |||
WicketUtils.newRepositoryParameter(repositoryName))); | |||
List<String> repositoryUrls = new ArrayList<String>(); | |||
@@ -203,7 +204,7 @@ public class SummaryPage extends RepositoryPage { | |||
metrics.get(metrics.size() / 2).name, metrics.get(metrics.size() - 1).name }); | |||
provider.addAxis(dateAxis); | |||
ChartAxis commitAxis = new ChartAxis(ChartAxisType.LEFT); | |||
ChartAxis commitAxis = new ChartAxis(ChartAxisType.LEFT); | |||
commitAxis.setLabels(new String[] { "", | |||
String.valueOf((int) WicketUtils.maxValue(metrics)) }); | |||
provider.addAxis(commitAxis); |
@@ -32,7 +32,7 @@ public class CommitHeaderPanel extends BasePanel { | |||
add(new Label("author")); | |||
add(new Label("date")); | |||
} | |||
public CommitHeaderPanel(String id, String repositoryName, RevCommit c) { | |||
super(id); | |||
add(new LinkPanel("shortmessage", "title", c.getShortMessage(), CommitPage.class, |
@@ -74,7 +74,7 @@ public class CommitLegendPanel extends Panel { | |||
}; | |||
add(legendsView); | |||
} | |||
protected Map<ChangeType, AtomicInteger> getChangedPathsStats(List<PathChangeModel> paths) { | |||
Map<ChangeType, AtomicInteger> stats = new HashMap<ChangeType, AtomicInteger>(); | |||
for (PathChangeModel path : paths) { |
@@ -127,7 +127,8 @@ public class LogPanel extends BasePanel { | |||
item.add(new BookmarkablePageLink<Void>("view", CommitPage.class, WicketUtils | |||
.newObjectParameter(repositoryName, entry.getName()))); | |||
item.add(new BookmarkablePageLink<Void>("diff", CommitDiffPage.class, WicketUtils | |||
.newObjectParameter(repositoryName, entry.getName())).setEnabled(entry.getParentCount() > 0)); | |||
.newObjectParameter(repositoryName, entry.getName())).setEnabled(entry | |||
.getParentCount() > 0)); | |||
item.add(new BookmarkablePageLink<Void>("tree", TreePage.class, WicketUtils | |||
.newObjectParameter(repositoryName, entry.getName()))); | |||
@@ -44,7 +44,7 @@ import com.gitblit.wicket.pages.TreePage; | |||
public class TagsPanel extends BasePanel { | |||
private static final long serialVersionUID = 1L; | |||
private final boolean hasTags; | |||
public TagsPanel(String wicketId, final String repositoryName, Repository r, final int maxCount) { | |||
@@ -164,10 +164,10 @@ public class TagsPanel extends BasePanel { | |||
add(new LinkPanel("allTags", "link", new StringResourceModel("gb.allTags", this, null), | |||
TagsPage.class, WicketUtils.newRepositoryParameter(repositoryName))); | |||
} | |||
hasTags = tags.size() > 0; | |||
} | |||
public TagsPanel hideIfEmpty() { | |||
setVisible(hasTags); | |||
return this; |
@@ -633,6 +633,19 @@ table.gitnotes td.message { | |||
border-left: 1px solid #ccc; | |||
} | |||
table.annotated { | |||
width: 100%; | |||
border: 1px solid #bbb; | |||
} | |||
table.annotated tr.even { | |||
background-color: white; | |||
} | |||
table.annotated tr.odd { | |||
background-color: #fdfbdf; | |||
} | |||
tr th a { padding-right: 15px; background-position: right; background-repeat:no-repeat; } | |||
tr th.wicket_orderDown a {background-image: url(arrow_down.png); } | |||
tr th.wicket_orderUp a { background-image: url(arrow_up.png); } |
@@ -96,10 +96,11 @@ public class JGitUtilsTest extends TestCase { | |||
public void testCreateRepository() throws Exception { | |||
String[] repositories = { "NewTestRepository.git", "NewTestRepository" }; | |||
for (String repositoryName : repositories) { | |||
for (String repositoryName : repositories) { | |||
Repository repository = JGitUtils.createRepository(GitBlitSuite.REPOSITORIES, | |||
repositoryName); | |||
File folder = FileKey.resolve(new File(GitBlitSuite.REPOSITORIES, repositoryName), FS.DETECTED); | |||
File folder = FileKey.resolve(new File(GitBlitSuite.REPOSITORIES, repositoryName), | |||
FS.DETECTED); | |||
assertTrue(repository != null); | |||
assertFalse(JGitUtils.hasCommits(repository)); | |||
assertTrue(JGitUtils.getFirstCommit(repository, null) == null); | |||
@@ -121,10 +122,11 @@ public class JGitUtilsTest extends TestCase { | |||
List<RefModel> list = entry.getValue(); | |||
for (RefModel ref : list) { | |||
if (ref.displayName.equals("refs/tags/spearce-gpg-pub")) { | |||
assertTrue(ref.getObjectId().getName().equals("8bbde7aacf771a9afb6992434f1ae413e010c6d8")); | |||
assertTrue(ref.getObjectId().getName() | |||
.equals("8bbde7aacf771a9afb6992434f1ae413e010c6d8")); | |||
assertTrue(ref.getAuthorIdent().getEmailAddress().equals("spearce@spearce.org")); | |||
assertTrue(ref.getShortMessage().startsWith("GPG key")); | |||
assertTrue(ref.getFullMessage().startsWith("GPG key")); | |||
assertTrue(ref.getFullMessage().startsWith("GPG key")); | |||
assertTrue(ref.getReferencedObjectType() == Constants.OBJ_BLOB); | |||
} else if (ref.displayName.equals("refs/tags/v0.12.1")) { | |||
assertTrue(ref.isAnnotatedTag()); | |||
@@ -168,13 +170,14 @@ public class JGitUtilsTest extends TestCase { | |||
+ model.getName().hashCode()); | |||
} | |||
repository.close(); | |||
repository = GitBlitSuite.getBluezGnomeRepository(); | |||
for (RefModel model : JGitUtils.getTags(repository, true, -1)) { | |||
if (model.getObjectId().getName().equals("728643ec0c438c77e182898c2f2967dbfdc231c8")) { | |||
assertFalse(model.isAnnotatedTag()); | |||
assertTrue(model.getAuthorIdent().getEmailAddress().equals("marcel@holtmann.org")); | |||
assertTrue(model.getFullMessage().equals("Update changelog and bump version number\n")); | |||
assertTrue(model.getFullMessage().equals( | |||
"Update changelog and bump version number\n")); | |||
} | |||
} | |||
repository.close(); |
@@ -32,7 +32,7 @@ public class MetricUtilsTest extends TestCase { | |||
repository.close(); | |||
assertTrue("No date metrics found!", metrics.size() > 0); | |||
} | |||
public void testAuthorMetrics() throws Exception { | |||
Repository repository = GitBlitSuite.getHelloworldRepository(); | |||
List<Metric> byEmail = MetricUtils.getAuthorMetrics(repository, null, true); |
@@ -38,10 +38,10 @@ public class StringUtilsTest extends TestCase { | |||
public void testEscapeForHtml() throws Exception { | |||
String input = "& < > \" \t"; | |||
String output_nochange = "& < > " \t"; | |||
String output_change = "& < > " "; | |||
assertTrue(StringUtils.escapeForHtml(input, false).equals(output_nochange)); | |||
assertTrue(StringUtils.escapeForHtml(input, true).equals(output_change)); | |||
String outputNoChange = "& < > " \t"; | |||
String outputChange = "& < > " "; | |||
assertTrue(StringUtils.escapeForHtml(input, false).equals(outputNoChange)); | |||
assertTrue(StringUtils.escapeForHtml(input, true).equals(outputChange)); | |||
} | |||
public void testFlattenStrings() throws Exception { |
@@ -33,7 +33,7 @@ public class TicgitUtilsTest extends TestCase { | |||
RefModel branch = TicgitUtils.getTicketsBranch(repository); | |||
repository.close(); | |||
assertTrue("Ticgit branch does not exist!", branch != null); | |||
repository = GitBlitSuite.getHelloworldRepository(); | |||
branch = TicgitUtils.getTicketsBranch(repository); | |||
repository.close(); | |||
@@ -60,7 +60,7 @@ public class TicgitUtilsTest extends TestCase { | |||
assertTrue(commentA.hashCode() == commentA.text.hashCode()); | |||
} | |||
} | |||
repository = GitBlitSuite.getHelloworldRepository(); | |||
List<TicketModel> ticketsC = TicgitUtils.getTickets(repository); | |||
repository.close(); |