Browse Source

Merge changes I53f71dc0,I3a899a3a,I3e8bd245,Ie7c9db83,If396326e,I6f4cf8da,I3bf96dd0,I3a2a43a1,I292fe88c,Ia1cf40cf

* changes:
  git-servlet: Fix comparing uploadFactory with the wrong DISABLED instance
  Prefer static inner classes
  Override equals for SwingLane since super class PlotLane defines it
  Make sure a Stream is closed upon errors in IpLogGenerator
  Make constant static in RebuildCommitGraph
  Make inner classes static in http code
  Cache filemode in GitIndex 
  Remove unused parent field in PlotLane
  Removed unused repo field in WorkDirCheckout
  Extend DiffFormatter API to simplify styling
stable-0.9
Shawn Pearce 15 years ago committed by Code Review
parent
commit
86fcdc53ad
  1. 2
      org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java
  2. 2
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java
  3. 2
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java
  4. 2
      org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java
  5. 4
      org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java
  6. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java
  7. 6
      org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java
  8. 4
      org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/SwingCommitList.java
  9. 100
      org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java
  10. 3
      org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java
  11. 4
      org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java
  12. 2
      org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java
  13. 2
      org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotLane.java

2
org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/GitServlet.java

@ -185,7 +185,7 @@ public class GitServlet extends MetaServlet {
initialized = true;
if (uploadPackFactory != ReceivePackFactory.DISABLED) {
if (uploadPackFactory != UploadPackFactory.DISABLED) {
serve("*/git-upload-pack")//
.with(new UploadPackServlet(uploadPackFactory));
}

2
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/AsIsServiceTest.java

@ -112,7 +112,7 @@ public class AsIsServiceTest extends LocalDiskRepositoryTestCase {
service.access(new R("bob", "1.2.3.4"), db);
}
private final class R extends HttpServletRequestWrapper {
private static final class R extends HttpServletRequestWrapper {
private final String user;
private final String host;

2
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultReceivePackFactoryTest.java

@ -174,7 +174,7 @@ public class DefaultReceivePackFactoryTest extends LocalDiskRepositoryTestCase {
assertNotNull("have ReceivePack", rp);
}
private final class R extends HttpServletRequestWrapper {
private static final class R extends HttpServletRequestWrapper {
private final String user;
private final String host;

2
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/DefaultUploadPackFactoryTest.java

@ -136,7 +136,7 @@ public class DefaultUploadPackFactoryTest extends LocalDiskRepositoryTestCase {
assertSame(db, up.getRepository());
}
private final class R extends HttpServletRequestWrapper {
private static final class R extends HttpServletRequestWrapper {
private final String user;
private final String host;

4
org.eclipse.jgit.iplog/src/org/eclipse/jgit/iplog/IpLogGenerator.java

@ -236,6 +236,7 @@ public class IpLogGenerator {
SimpleDateFormat dt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
File list = new File(repo.getDirectory(), "gerrit_committers");
BufferedReader br = new BufferedReader(new FileReader(list));
try {
String line;
while ((line = br.readLine()) != null) {
@ -267,6 +268,9 @@ public class IpLogGenerator {
who.addActiveRange(new ActiveRange(begin, end));
committersByEmail.put(email, who);
}
} finally {
br.close();
}
}
private Date parseDate(SimpleDateFormat dt, String value)

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/debug/RebuildCommitGraph.java

@ -96,7 +96,7 @@ import org.eclipse.jgit.revwalk.RevWalk;
* <p>
*/
class RebuildCommitGraph extends TextBuiltin {
private final String REALLY = "--destroy-this-repository";
private static final String REALLY = "--destroy-this-repository";
@Option(name = REALLY, usage = "usage_approveDestructionOfRepository")
boolean really;

6
org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/CommitGraphPane.java

@ -176,7 +176,7 @@ public class CommitGraphPane extends JTable {
}
}
class NameCellRender extends DefaultTableCellRenderer {
static class NameCellRender extends DefaultTableCellRenderer {
private static final long serialVersionUID = 1L;
public Component getTableCellRendererComponent(final JTable table,
@ -194,7 +194,7 @@ public class CommitGraphPane extends JTable {
}
}
class DateCellRender extends DefaultTableCellRenderer {
static class DateCellRender extends DefaultTableCellRenderer {
private static final long serialVersionUID = 1L;
private final DateFormat fmt = new SimpleDateFormat(
@ -215,7 +215,7 @@ public class CommitGraphPane extends JTable {
}
}
class GraphCellRender extends DefaultTableCellRenderer {
static class GraphCellRender extends DefaultTableCellRenderer {
private static final long serialVersionUID = 1L;
private final AWTPlotRenderer renderer = new AWTPlotRenderer(this);

4
org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/SwingCommitList.java

@ -83,5 +83,9 @@ class SwingCommitList extends PlotCommitList<SwingCommitList.SwingLane> {
static class SwingLane extends PlotLane {
Color color;
@Override
public boolean equals(Object o) {
return super.equals(o) && color.equals(((SwingLane)o).color);
}
}
}

100
org.eclipse.jgit/src/org/eclipse/jgit/diff/DiffFormatter.java

@ -139,15 +139,15 @@ public class DiffFormatter {
while (aCur < aEnd || bCur < bEnd) {
if (aCur < curEdit.getBeginA() || endIdx + 1 < curIdx) {
writeLine(out, ' ', a, aCur);
writeContextLine(out, a, aCur, isEndOfLineMissing(a, aCur));
aCur++;
bCur++;
} else if (aCur < curEdit.getEndA()) {
writeLine(out, '-', a, aCur++);
writeRemovedLine(out, a, aCur, isEndOfLineMissing(a, aCur));
aCur++;
} else if (bCur < curEdit.getEndB()) {
writeLine(out, '+', b, bCur++);
writeAddedLine(out, b, bCur, isEndOfLineMissing(b, bCur));
bCur++;
}
if (end(curEdit, aCur, bCur) && ++curIdx < edits.size())
@ -156,12 +156,85 @@ public class DiffFormatter {
}
}
private void writeHunkHeader(final OutputStream out, int aCur, int aEnd,
int bCur, int bEnd) throws IOException {
/**
* Output a line of diff context
*
* @param out
* OutputStream
* @param text
* RawText for accessing raw data
* @param line
* the line number within text
* @param endOfLineMissing
* true if we should add the GNU end of line missing warning
* @throws IOException
*/
protected void writeContextLine(final OutputStream out, final RawText text,
final int line, boolean endOfLineMissing) throws IOException {
writeLine(out, ' ', text, line, endOfLineMissing);
}
private boolean isEndOfLineMissing(final RawText text, final int line) {
return line + 1 == text.size() && text.isMissingNewlineAtEnd();
}
/**
* Output an added line
*
* @param out
* OutputStream
* @param text
* RawText for accessing raw data
* @param line
* the line number within text
* @param endOfLineMissing
* true if we should add the gnu end of line missing warning
* @throws IOException
*/
protected void writeAddedLine(final OutputStream out, final RawText text, final int line, boolean endOfLineMissing)
throws IOException {
writeLine(out, '+', text, line, endOfLineMissing);
}
/**
* Output a removed line
*
* @param out
* OutputStream
* @param text
* RawText for accessing raw data
* @param line
* the line number within text
* @param endOfLineMissing
* true if we should add the gnu end of line missing warning
* @throws IOException
*/
protected void writeRemovedLine(final OutputStream out, final RawText text,
final int line, boolean endOfLineMissing) throws IOException {
writeLine(out, '-', text, line, endOfLineMissing);
}
/**
* Output a hunk header
*
* @param out
* OutputStream
* @param aStartLine
* within first source
* @param aEndLine
* within first source
* @param bStartLine
* within second source
* @param bEndLine
* within second source
* @throws IOException
*/
protected void writeHunkHeader(final OutputStream out, int aStartLine, int aEndLine,
int bStartLine, int bEndLine) throws IOException {
out.write('@');
out.write('@');
writeRange(out, '-', aCur + 1, aEnd - aCur);
writeRange(out, '+', bCur + 1, bEnd - bCur);
writeRange(out, '-', aStartLine + 1, aEndLine - aStartLine);
writeRange(out, '+', bStartLine + 1, bEndLine - bStartLine);
out.write(' ');
out.write('@');
out.write('@');
@ -199,11 +272,16 @@ public class DiffFormatter {
}
private static void writeLine(final OutputStream out, final char prefix,
final RawText text, final int cur) throws IOException {
final RawText text, final int cur, boolean noNewLineIndicator) throws IOException {
out.write(prefix);
text.writeLine(out, cur);
out.write('\n');
if (cur + 1 == text.size() && text.isMissingNewlineAtEnd())
if (noNewLineIndicator)
writeNoNewLine(out);
}
private static void writeNoNewLine(final OutputStream out)
throws IOException {
out.write(noNewLine);
}

3
org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java

@ -353,7 +353,8 @@ public class GitIndex {
if (filemode != null)
return filemode.booleanValue();
RepositoryConfig config = db.getConfig();
return config.getBoolean("core", null, "filemode", true);
filemode = Boolean.valueOf(config.getBoolean("core", null, "filemode", true));
return filemode.booleanValue();
}
/** An index entry */

4
org.eclipse.jgit/src/org/eclipse/jgit/lib/WorkDirCheckout.java

@ -64,8 +64,6 @@ import org.eclipse.jgit.lib.GitIndex.Entry;
* Three-way merges are no performed. See {@link #setFailOnConflict(boolean)}.
*/
public class WorkDirCheckout {
Repository repo;
File root;
GitIndex index;
@ -87,7 +85,6 @@ public class WorkDirCheckout {
WorkDirCheckout(Repository repo, File workDir,
GitIndex oldIndex, GitIndex newIndex) throws IOException {
this.repo = repo;
this.root = workDir;
this.index = oldIndex;
this.merge = repo.mapTree(newIndex.writeTree());
@ -103,7 +100,6 @@ public class WorkDirCheckout {
*/
public WorkDirCheckout(Repository repo, File root,
GitIndex index, Tree merge) {
this.repo = repo;
this.root = root;
this.index = index;
this.merge = merge;

2
org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotCommitList.java

@ -139,7 +139,6 @@ public class PlotCommitList<L extends PlotLane> extends
rObj.addPassingLane(c.lane);
}
currCommit.lane = c.lane;
currCommit.lane.parent = currCommit;
} else {
// More than one child, or our child is a merge.
// Use a different lane.
@ -154,7 +153,6 @@ public class PlotCommitList<L extends PlotLane> extends
}
currCommit.lane = nextFreeLane();
currCommit.lane.parent = currCommit;
activeLanes.add(currCommit.lane);
int remaining = nChildren;

2
org.eclipse.jgit/src/org/eclipse/jgit/revplot/PlotLane.java

@ -49,8 +49,6 @@ package org.eclipse.jgit.revplot;
* Commits are strung onto a lane. For many UIs a lane represents a column.
*/
public class PlotLane {
PlotCommit parent;
int position;
/**

Loading…
Cancel
Save