comparison src/org/tmatesoft/hg/repo/HgBundle.java @ 170:71ddbf8603e8

Initial clone: populate given directory from a bundle. Everything but remote server access is there, albeit prototype code style
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 23 Mar 2011 20:46:00 +0100
parents 8c8e3f372fa1
children f26ffe04ced0
comparison
equal deleted inserted replaced
169:8c8e3f372fa1 170:71ddbf8603e8
146 } else { 146 } else {
147 System.out.print("-"); 147 System.out.print("-");
148 } 148 }
149 RawChangeset cs = RawChangeset.parse(csetDataAccess); 149 RawChangeset cs = RawChangeset.parse(csetDataAccess);
150 System.out.println(cs.toString()); 150 System.out.println(cs.toString());
151 prevRevContent.done();
151 prevRevContent = csetDataAccess.reset(); 152 prevRevContent = csetDataAccess.reset();
152 } catch (CancelledException ex) { 153 } catch (CancelledException ex) {
153 return false; 154 return false;
154 } catch (Exception ex) { 155 } catch (Exception ex) {
155 throw new HgBadStateException(ex); // FIXME 156 throw new HgBadStateException(ex); // FIXME
188 void fileStart(String name); 189 void fileStart(String name);
189 190
190 void fileEnd(String name); 191 void fileEnd(String name);
191 192
192 /** 193 /**
193 * @param element 194 * XXX desperately need exceptions here
194 * data element, instance might be reused 195 * @param element data element, instance might be reused, don't keep a reference to it or its raw data
195 * @return <code>true</code> to continue 196 * @return <code>true</code> to continue
196 */ 197 */
197 boolean element(GroupElement element); 198 boolean element(GroupElement element);
198 } 199 }
199 200
347 DataAccess slice = new ByteArrayDataAccess(data); // XXX in fact, may pass a slicing DataAccess. 348 DataAccess slice = new ByteArrayDataAccess(data); // XXX in fact, may pass a slicing DataAccess.
348 // Just need to make sure that we seek to proper location afterwards (where next GroupElement starts), 349 // Just need to make sure that we seek to proper location afterwards (where next GroupElement starts),
349 // regardless whether that slice has read it or not. 350 // regardless whether that slice has read it or not.
350 GroupElement ge = new GroupElement(nb, slice); 351 GroupElement ge = new GroupElement(nb, slice);
351 good2go = inspector.element(ge); 352 good2go = inspector.element(ge);
353 slice.done(); // BADA doesn't implement done(), but it could (e.g. free array)
354 /// and we'd better tell it we are not going to use it any more. However, it's important to ensure Inspector
355 // implementations out there do not retain GroupElement.rawData()
352 len = da.isEmpty() ? 0 : da.readInt(); 356 len = da.isEmpty() ? 0 : da.readInt();
353 } 357 }
354 // need to skip up to group end if inspector told he don't want to continue with the group, 358 // need to skip up to group end if inspector told he don't want to continue with the group,
355 // because outer code may try to read next group immediately as we return back. 359 // because outer code may try to read next group immediately as we return back.
356 while (len > 4 && !da.isEmpty()) { 360 while (len > 4 && !da.isEmpty()) {