Browse Source

Merge changes I28a5c7e2,If90a6cca

* changes:
  Replace use of deprecated release() in BasePackPushConnection
  Replace use of deprecated release() in BasePackFetchConnection
stable-4.1
Shawn Pearce 10 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
a0bc9560aa
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java
  2. 10
      org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java

7
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackFetchConnection.java

@ -377,7 +377,7 @@ public abstract class BasePackFetchConnection extends BasePackConnection
@Override @Override
public void close() { public void close() {
if (walk != null) if (walk != null)
walk.release(); walk.close();
super.close(); super.close();
} }
@ -753,16 +753,13 @@ public abstract class BasePackFetchConnection extends BasePackConnection
input = new SideBandInputStream(input, monitor, getMessageWriter(), input = new SideBandInputStream(input, monitor, getMessageWriter(),
outputStream); outputStream);
ObjectInserter ins = local.newObjectInserter(); try (ObjectInserter ins = local.newObjectInserter()) {
try {
PackParser parser = ins.newPackParser(input); PackParser parser = ins.newPackParser(input);
parser.setAllowThin(thinPack); parser.setAllowThin(thinPack);
parser.setObjectChecker(transport.getObjectChecker()); parser.setObjectChecker(transport.getObjectChecker());
parser.setLockMessage(lockMessage); parser.setLockMessage(lockMessage);
packLock = parser.parse(monitor); packLock = parser.parse(monitor);
ins.flush(); ins.flush();
} finally {
ins.release();
} }
} }

10
org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackPushConnection.java

@ -279,9 +279,8 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
Set<ObjectId> remoteObjects = new HashSet<ObjectId>(); Set<ObjectId> remoteObjects = new HashSet<ObjectId>();
Set<ObjectId> newObjects = new HashSet<ObjectId>(); Set<ObjectId> newObjects = new HashSet<ObjectId>();
final PackWriter writer = new PackWriter(transport.getPackConfig(), try (final PackWriter writer = new PackWriter(transport.getPackConfig(),
local.newObjectReader()); local.newObjectReader())) {
try {
for (final Ref r : getRefs()) { for (final Ref r : getRefs()) {
// only add objects that we actually have // only add objects that we actually have
@ -303,10 +302,9 @@ public abstract class BasePackPushConnection extends BasePackConnection implemen
writer.setDeltaBaseAsOffset(capableOfsDelta); writer.setDeltaBaseAsOffset(capableOfsDelta);
writer.preparePack(monitor, newObjects, remoteObjects); writer.preparePack(monitor, newObjects, remoteObjects);
writer.writePack(monitor, monitor, out); writer.writePack(monitor, monitor, out);
} finally {
writer.release(); packTransferTime = writer.getStatistics().getTimeWriting();
} }
packTransferTime = writer.getStatistics().getTimeWriting();
} }
private void readStatusReport(final Map<String, RemoteRefUpdate> refUpdates) private void readStatusReport(final Map<String, RemoteRefUpdate> refUpdates)

Loading…
Cancel
Save