You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BasePackFetchConnection.java 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. /*
  2. * Copyright (C) 2008-2010, Google Inc.
  3. * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
  4. * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
  5. * and other copyright owners as documented in the project's IP log.
  6. *
  7. * This program and the accompanying materials are made available
  8. * under the terms of the Eclipse Distribution License v1.0 which
  9. * accompanies this distribution, is reproduced below, and is
  10. * available at http://www.eclipse.org/org/documents/edl-v10.php
  11. *
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or
  15. * without modification, are permitted provided that the following
  16. * conditions are met:
  17. *
  18. * - Redistributions of source code must retain the above copyright
  19. * notice, this list of conditions and the following disclaimer.
  20. *
  21. * - Redistributions in binary form must reproduce the above
  22. * copyright notice, this list of conditions and the following
  23. * disclaimer in the documentation and/or other materials provided
  24. * with the distribution.
  25. *
  26. * - Neither the name of the Eclipse Foundation, Inc. nor the
  27. * names of its contributors may be used to endorse or promote
  28. * products derived from this software without specific prior
  29. * written permission.
  30. *
  31. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
  32. * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
  33. * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  34. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  35. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  36. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  37. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  38. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  39. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  40. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  41. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  42. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  43. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  44. */
  45. package org.eclipse.jgit.transport;
  46. import java.io.IOException;
  47. import java.io.InputStream;
  48. import java.text.MessageFormat;
  49. import java.util.Collection;
  50. import java.util.Collections;
  51. import java.util.Date;
  52. import java.util.Set;
  53. import org.eclipse.jgit.JGitText;
  54. import org.eclipse.jgit.errors.PackProtocolException;
  55. import org.eclipse.jgit.errors.TransportException;
  56. import org.eclipse.jgit.lib.AnyObjectId;
  57. import org.eclipse.jgit.lib.Config;
  58. import org.eclipse.jgit.lib.Constants;
  59. import org.eclipse.jgit.lib.MutableObjectId;
  60. import org.eclipse.jgit.lib.ObjectId;
  61. import org.eclipse.jgit.lib.ObjectInserter;
  62. import org.eclipse.jgit.lib.ProgressMonitor;
  63. import org.eclipse.jgit.lib.Ref;
  64. import org.eclipse.jgit.lib.Config.SectionParser;
  65. import org.eclipse.jgit.revwalk.RevCommit;
  66. import org.eclipse.jgit.revwalk.RevCommitList;
  67. import org.eclipse.jgit.revwalk.RevFlag;
  68. import org.eclipse.jgit.revwalk.RevObject;
  69. import org.eclipse.jgit.revwalk.RevSort;
  70. import org.eclipse.jgit.revwalk.RevWalk;
  71. import org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter;
  72. import org.eclipse.jgit.revwalk.filter.RevFilter;
  73. import org.eclipse.jgit.storage.file.PackLock;
  74. import org.eclipse.jgit.transport.PacketLineIn.AckNackResult;
  75. import org.eclipse.jgit.util.TemporaryBuffer;
  76. /**
  77. * Fetch implementation using the native Git pack transfer service.
  78. * <p>
  79. * This is the canonical implementation for transferring objects from the remote
  80. * repository to the local repository by talking to the 'git-upload-pack'
  81. * service. Objects are packed on the remote side into a pack file and then sent
  82. * down the pipe to us.
  83. * <p>
  84. * This connection requires only a bi-directional pipe or socket, and thus is
  85. * easily wrapped up into a local process pipe, anonymous TCP socket, or a
  86. * command executed through an SSH tunnel.
  87. * <p>
  88. * If {@link BasePackConnection#statelessRPC} is {@code true}, this connection
  89. * can be tunneled over a request-response style RPC system like HTTP. The RPC
  90. * call boundary is determined by this class switching from writing to the
  91. * OutputStream to reading from the InputStream.
  92. * <p>
  93. * Concrete implementations should just call
  94. * {@link #init(java.io.InputStream, java.io.OutputStream)} and
  95. * {@link #readAdvertisedRefs()} methods in constructor or before any use. They
  96. * should also handle resources releasing in {@link #close()} method if needed.
  97. */
  98. public abstract class BasePackFetchConnection extends BasePackConnection
  99. implements FetchConnection {
  100. /**
  101. * Maximum number of 'have' lines to send before giving up.
  102. * <p>
  103. * During {@link #negotiate(ProgressMonitor)} we send at most this many
  104. * commits to the remote peer as 'have' lines without an ACK response before
  105. * we give up.
  106. */
  107. private static final int MAX_HAVES = 256;
  108. /**
  109. * Amount of data the client sends before starting to read.
  110. * <p>
  111. * Any output stream given to the client must be able to buffer this many
  112. * bytes before the client will stop writing and start reading from the
  113. * input stream. If the output stream blocks before this many bytes are in
  114. * the send queue, the system will deadlock.
  115. */
  116. protected static final int MIN_CLIENT_BUFFER = 2 * 32 * 46 + 8;
  117. static final String OPTION_INCLUDE_TAG = "include-tag";
  118. static final String OPTION_MULTI_ACK = "multi_ack";
  119. static final String OPTION_MULTI_ACK_DETAILED = "multi_ack_detailed";
  120. static final String OPTION_THIN_PACK = "thin-pack";
  121. static final String OPTION_SIDE_BAND = "side-band";
  122. static final String OPTION_SIDE_BAND_64K = "side-band-64k";
  123. static final String OPTION_OFS_DELTA = "ofs-delta";
  124. static final String OPTION_SHALLOW = "shallow";
  125. static final String OPTION_NO_PROGRESS = "no-progress";
  126. static enum MultiAck {
  127. OFF, CONTINUE, DETAILED;
  128. }
  129. private final RevWalk walk;
  130. /** All commits that are immediately reachable by a local ref. */
  131. private RevCommitList<RevCommit> reachableCommits;
  132. /** Marks an object as having all its dependencies. */
  133. final RevFlag REACHABLE;
  134. /** Marks a commit known to both sides of the connection. */
  135. final RevFlag COMMON;
  136. /** Like {@link #COMMON} but means its also in {@link #pckState}. */
  137. private final RevFlag STATE;
  138. /** Marks a commit listed in the advertised refs. */
  139. final RevFlag ADVERTISED;
  140. private MultiAck multiAck = MultiAck.OFF;
  141. private boolean thinPack;
  142. private boolean sideband;
  143. private boolean includeTags;
  144. private boolean allowOfsDelta;
  145. private String lockMessage;
  146. private PackLock packLock;
  147. /** RPC state, if {@link BasePackConnection#statelessRPC} is true. */
  148. private TemporaryBuffer.Heap state;
  149. private PacketLineOut pckState;
  150. /**
  151. * Create a new connection to fetch using the native git transport.
  152. *
  153. * @param packTransport
  154. * the transport.
  155. */
  156. public BasePackFetchConnection(final PackTransport packTransport) {
  157. super(packTransport);
  158. final FetchConfig cfg = local.getConfig().get(FetchConfig.KEY);
  159. includeTags = transport.getTagOpt() != TagOpt.NO_TAGS;
  160. thinPack = transport.isFetchThin();
  161. allowOfsDelta = cfg.allowOfsDelta;
  162. walk = new RevWalk(local);
  163. reachableCommits = new RevCommitList<RevCommit>();
  164. REACHABLE = walk.newFlag("REACHABLE");
  165. COMMON = walk.newFlag("COMMON");
  166. STATE = walk.newFlag("STATE");
  167. ADVERTISED = walk.newFlag("ADVERTISED");
  168. walk.carry(COMMON);
  169. walk.carry(REACHABLE);
  170. walk.carry(ADVERTISED);
  171. }
  172. private static class FetchConfig {
  173. static final SectionParser<FetchConfig> KEY = new SectionParser<FetchConfig>() {
  174. public FetchConfig parse(final Config cfg) {
  175. return new FetchConfig(cfg);
  176. }
  177. };
  178. final boolean allowOfsDelta;
  179. FetchConfig(final Config c) {
  180. allowOfsDelta = c.getBoolean("repack", "usedeltabaseoffset", true);
  181. }
  182. }
  183. public final void fetch(final ProgressMonitor monitor,
  184. final Collection<Ref> want, final Set<ObjectId> have)
  185. throws TransportException {
  186. markStartedOperation();
  187. doFetch(monitor, want, have);
  188. }
  189. public boolean didFetchIncludeTags() {
  190. return false;
  191. }
  192. public boolean didFetchTestConnectivity() {
  193. return false;
  194. }
  195. public void setPackLockMessage(final String message) {
  196. lockMessage = message;
  197. }
  198. public Collection<PackLock> getPackLocks() {
  199. if (packLock != null)
  200. return Collections.singleton(packLock);
  201. return Collections.<PackLock> emptyList();
  202. }
  203. /**
  204. * Execute common ancestor negotiation and fetch the objects.
  205. *
  206. * @param monitor
  207. * progress monitor to receive status updates.
  208. * @param want
  209. * the advertised remote references the caller wants to fetch.
  210. * @param have
  211. * additional objects to assume that already exist locally. This
  212. * will be added to the set of objects reachable from the
  213. * destination repository's references.
  214. * @throws TransportException
  215. * if any exception occurs.
  216. */
  217. protected void doFetch(final ProgressMonitor monitor,
  218. final Collection<Ref> want, final Set<ObjectId> have)
  219. throws TransportException {
  220. try {
  221. markRefsAdvertised();
  222. markReachable(have, maxTimeWanted(want));
  223. if (statelessRPC) {
  224. state = new TemporaryBuffer.Heap(Integer.MAX_VALUE);
  225. pckState = new PacketLineOut(state);
  226. }
  227. if (sendWants(want)) {
  228. negotiate(monitor);
  229. walk.dispose();
  230. reachableCommits = null;
  231. state = null;
  232. pckState = null;
  233. receivePack(monitor);
  234. }
  235. } catch (CancelledException ce) {
  236. close();
  237. return; // Caller should test (or just know) this themselves.
  238. } catch (IOException err) {
  239. close();
  240. throw new TransportException(err.getMessage(), err);
  241. } catch (RuntimeException err) {
  242. close();
  243. throw new TransportException(err.getMessage(), err);
  244. }
  245. }
  246. @Override
  247. public void close() {
  248. walk.release();
  249. super.close();
  250. }
  251. private int maxTimeWanted(final Collection<Ref> wants) {
  252. int maxTime = 0;
  253. for (final Ref r : wants) {
  254. try {
  255. final RevObject obj = walk.parseAny(r.getObjectId());
  256. if (obj instanceof RevCommit) {
  257. final int cTime = ((RevCommit) obj).getCommitTime();
  258. if (maxTime < cTime)
  259. maxTime = cTime;
  260. }
  261. } catch (IOException error) {
  262. // We don't have it, but we want to fetch (thus fixing error).
  263. }
  264. }
  265. return maxTime;
  266. }
  267. private void markReachable(final Set<ObjectId> have, final int maxTime)
  268. throws IOException {
  269. for (final Ref r : local.getAllRefs().values()) {
  270. try {
  271. final RevCommit o = walk.parseCommit(r.getObjectId());
  272. o.add(REACHABLE);
  273. reachableCommits.add(o);
  274. } catch (IOException readError) {
  275. // If we cannot read the value of the ref skip it.
  276. }
  277. }
  278. for (final ObjectId id : have) {
  279. try {
  280. final RevCommit o = walk.parseCommit(id);
  281. o.add(REACHABLE);
  282. reachableCommits.add(o);
  283. } catch (IOException readError) {
  284. // If we cannot read the value of the ref skip it.
  285. }
  286. }
  287. if (maxTime > 0) {
  288. // Mark reachable commits until we reach maxTime. These may
  289. // wind up later matching up against things we want and we
  290. // can avoid asking for something we already happen to have.
  291. //
  292. final Date maxWhen = new Date(maxTime * 1000L);
  293. walk.sort(RevSort.COMMIT_TIME_DESC);
  294. walk.markStart(reachableCommits);
  295. walk.setRevFilter(CommitTimeRevFilter.after(maxWhen));
  296. for (;;) {
  297. final RevCommit c = walk.next();
  298. if (c == null)
  299. break;
  300. if (c.has(ADVERTISED) && !c.has(COMMON)) {
  301. // This is actually going to be a common commit, but
  302. // our peer doesn't know that fact yet.
  303. //
  304. c.add(COMMON);
  305. c.carry(COMMON);
  306. reachableCommits.add(c);
  307. }
  308. }
  309. }
  310. }
  311. private boolean sendWants(final Collection<Ref> want) throws IOException {
  312. final PacketLineOut p = statelessRPC ? pckState : pckOut;
  313. boolean first = true;
  314. for (final Ref r : want) {
  315. try {
  316. if (walk.parseAny(r.getObjectId()).has(REACHABLE)) {
  317. // We already have this object. Asking for it is
  318. // not a very good idea.
  319. //
  320. continue;
  321. }
  322. } catch (IOException err) {
  323. // Its OK, we don't have it, but we want to fix that
  324. // by fetching the object from the other side.
  325. }
  326. final StringBuilder line = new StringBuilder(46);
  327. line.append("want ");
  328. line.append(r.getObjectId().name());
  329. if (first) {
  330. line.append(enableCapabilities());
  331. first = false;
  332. }
  333. line.append('\n');
  334. p.writeString(line.toString());
  335. }
  336. if (first)
  337. return false;
  338. p.end();
  339. outNeedsEnd = false;
  340. return true;
  341. }
  342. private String enableCapabilities() throws TransportException {
  343. final StringBuilder line = new StringBuilder();
  344. if (includeTags)
  345. includeTags = wantCapability(line, OPTION_INCLUDE_TAG);
  346. if (allowOfsDelta)
  347. wantCapability(line, OPTION_OFS_DELTA);
  348. if (wantCapability(line, OPTION_MULTI_ACK_DETAILED))
  349. multiAck = MultiAck.DETAILED;
  350. else if (wantCapability(line, OPTION_MULTI_ACK))
  351. multiAck = MultiAck.CONTINUE;
  352. else
  353. multiAck = MultiAck.OFF;
  354. if (thinPack)
  355. thinPack = wantCapability(line, OPTION_THIN_PACK);
  356. if (wantCapability(line, OPTION_SIDE_BAND_64K))
  357. sideband = true;
  358. else if (wantCapability(line, OPTION_SIDE_BAND))
  359. sideband = true;
  360. if (statelessRPC && multiAck != MultiAck.DETAILED) {
  361. // Our stateless RPC implementation relies upon the detailed
  362. // ACK status to tell us common objects for reuse in future
  363. // requests. If its not enabled, we can't talk to the peer.
  364. //
  365. throw new PackProtocolException(uri, MessageFormat.format(JGitText.get().statelessRPCRequiresOptionToBeEnabled, OPTION_MULTI_ACK_DETAILED));
  366. }
  367. return line.toString();
  368. }
  369. private void negotiate(final ProgressMonitor monitor) throws IOException,
  370. CancelledException {
  371. final MutableObjectId ackId = new MutableObjectId();
  372. int resultsPending = 0;
  373. int havesSent = 0;
  374. int havesSinceLastContinue = 0;
  375. boolean receivedContinue = false;
  376. boolean receivedAck = false;
  377. if (statelessRPC)
  378. state.writeTo(out, null);
  379. negotiateBegin();
  380. SEND_HAVES: for (;;) {
  381. final RevCommit c = walk.next();
  382. if (c == null)
  383. break SEND_HAVES;
  384. pckOut.writeString("have " + c.getId().name() + "\n");
  385. havesSent++;
  386. havesSinceLastContinue++;
  387. if ((31 & havesSent) != 0) {
  388. // We group the have lines into blocks of 32, each marked
  389. // with a flush (aka end). This one is within a block so
  390. // continue with another have line.
  391. //
  392. continue;
  393. }
  394. if (monitor.isCancelled())
  395. throw new CancelledException();
  396. pckOut.end();
  397. resultsPending++; // Each end will cause a result to come back.
  398. if (havesSent == 32 && !statelessRPC) {
  399. // On the first block we race ahead and try to send
  400. // more of the second block while waiting for the
  401. // remote to respond to our first block request.
  402. // This keeps us one block ahead of the peer.
  403. //
  404. continue;
  405. }
  406. READ_RESULT: for (;;) {
  407. final AckNackResult anr = pckIn.readACK(ackId);
  408. switch (anr) {
  409. case NAK:
  410. // More have lines are necessary to compute the
  411. // pack on the remote side. Keep doing that.
  412. //
  413. resultsPending--;
  414. break READ_RESULT;
  415. case ACK:
  416. // The remote side is happy and knows exactly what
  417. // to send us. There is no further negotiation and
  418. // we can break out immediately.
  419. //
  420. multiAck = MultiAck.OFF;
  421. resultsPending = 0;
  422. receivedAck = true;
  423. if (statelessRPC)
  424. state.writeTo(out, null);
  425. break SEND_HAVES;
  426. case ACK_CONTINUE:
  427. case ACK_COMMON:
  428. case ACK_READY:
  429. // The server knows this commit (ackId). We don't
  430. // need to send any further along its ancestry, but
  431. // we need to continue to talk about other parts of
  432. // our local history.
  433. //
  434. markCommon(walk.parseAny(ackId), anr);
  435. receivedAck = true;
  436. receivedContinue = true;
  437. havesSinceLastContinue = 0;
  438. break;
  439. }
  440. if (monitor.isCancelled())
  441. throw new CancelledException();
  442. }
  443. if (statelessRPC)
  444. state.writeTo(out, null);
  445. if (receivedContinue && havesSinceLastContinue > MAX_HAVES) {
  446. // Our history must be really different from the remote's.
  447. // We just sent a whole slew of have lines, and it did not
  448. // recognize any of them. Avoid sending our entire history
  449. // to them by giving up early.
  450. //
  451. break SEND_HAVES;
  452. }
  453. }
  454. // Tell the remote side we have run out of things to talk about.
  455. //
  456. if (monitor.isCancelled())
  457. throw new CancelledException();
  458. // When statelessRPC is true we should always leave SEND_HAVES
  459. // loop above while in the middle of a request. This allows us
  460. // to just write done immediately.
  461. //
  462. pckOut.writeString("done\n");
  463. pckOut.flush();
  464. if (!receivedAck) {
  465. // Apparently if we have never received an ACK earlier
  466. // there is one more result expected from the done we
  467. // just sent to the remote.
  468. //
  469. multiAck = MultiAck.OFF;
  470. resultsPending++;
  471. }
  472. READ_RESULT: while (resultsPending > 0 || multiAck != MultiAck.OFF) {
  473. final AckNackResult anr = pckIn.readACK(ackId);
  474. resultsPending--;
  475. switch (anr) {
  476. case NAK:
  477. // A NAK is a response to an end we queued earlier
  478. // we eat it and look for another ACK/NAK message.
  479. //
  480. break;
  481. case ACK:
  482. // A solitary ACK at this point means the remote won't
  483. // speak anymore, but is going to send us a pack now.
  484. //
  485. break READ_RESULT;
  486. case ACK_CONTINUE:
  487. case ACK_COMMON:
  488. case ACK_READY:
  489. // We will expect a normal ACK to break out of the loop.
  490. //
  491. multiAck = MultiAck.CONTINUE;
  492. break;
  493. }
  494. if (monitor.isCancelled())
  495. throw new CancelledException();
  496. }
  497. }
  498. private void negotiateBegin() throws IOException {
  499. walk.resetRetain(REACHABLE, ADVERTISED);
  500. walk.markStart(reachableCommits);
  501. walk.sort(RevSort.COMMIT_TIME_DESC);
  502. walk.setRevFilter(new RevFilter() {
  503. @Override
  504. public RevFilter clone() {
  505. return this;
  506. }
  507. @Override
  508. public boolean include(final RevWalk walker, final RevCommit c) {
  509. final boolean remoteKnowsIsCommon = c.has(COMMON);
  510. if (c.has(ADVERTISED)) {
  511. // Remote advertised this, and we have it, hence common.
  512. // Whether or not the remote knows that fact is tested
  513. // before we added the flag. If the remote doesn't know
  514. // we have to still send them this object.
  515. //
  516. c.add(COMMON);
  517. }
  518. return !remoteKnowsIsCommon;
  519. }
  520. });
  521. }
  522. private void markRefsAdvertised() {
  523. for (final Ref r : getRefs()) {
  524. markAdvertised(r.getObjectId());
  525. if (r.getPeeledObjectId() != null)
  526. markAdvertised(r.getPeeledObjectId());
  527. }
  528. }
  529. private void markAdvertised(final AnyObjectId id) {
  530. try {
  531. walk.parseAny(id).add(ADVERTISED);
  532. } catch (IOException readError) {
  533. // We probably just do not have this object locally.
  534. }
  535. }
  536. private void markCommon(final RevObject obj, final AckNackResult anr)
  537. throws IOException {
  538. if (statelessRPC && anr == AckNackResult.ACK_COMMON && !obj.has(STATE)) {
  539. StringBuilder s;
  540. s = new StringBuilder(6 + Constants.OBJECT_ID_STRING_LENGTH);
  541. s.append("have "); //$NON-NLS-1$
  542. s.append(obj.name());
  543. s.append('\n');
  544. pckState.writeString(s.toString());
  545. obj.add(STATE);
  546. }
  547. obj.add(COMMON);
  548. if (obj instanceof RevCommit)
  549. ((RevCommit) obj).carry(COMMON);
  550. }
  551. private void receivePack(final ProgressMonitor monitor) throws IOException {
  552. InputStream input = in;
  553. if (sideband)
  554. input = new SideBandInputStream(input, monitor, getMessageWriter());
  555. ObjectInserter ins = local.newObjectInserter();
  556. try {
  557. PackParser parser = ins.newPackParser(input);
  558. parser.setAllowThin(thinPack);
  559. parser.setObjectChecking(transport.isCheckFetchedObjects());
  560. parser.setLockMessage(lockMessage);
  561. packLock = parser.parse(monitor);
  562. ins.flush();
  563. } finally {
  564. ins.release();
  565. }
  566. }
  567. private static class CancelledException extends Exception {
  568. private static final long serialVersionUID = 1L;
  569. }
  570. }