comparison src/org/tmatesoft/hg/repo/Revlog.java @ 192:e5407b5a586a

Incoming and Outgoing commands are alive
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 15 Apr 2011 03:17:03 +0200
parents b777502a06f5
children 3a7696fb457c
comparison
equal deleted inserted replaced
191:b777502a06f5 192:e5407b5a586a
206 206
207 public ParentWalker() { 207 public ParentWalker() {
208 firstParent = secondParent = Collections.emptyMap(); 208 firstParent = secondParent = Collections.emptyMap();
209 } 209 }
210 210
211 public HgRepository getRepo() {
212 return Revlog.this.getRepo();
213 }
214
211 public void init() { 215 public void init() {
212 final RevlogStream stream = Revlog.this.content; 216 final RevlogStream stream = Revlog.this.content;
213 final int revisionCount = stream.revisionCount(); 217 final int revisionCount = stream.revisionCount();
214 firstParent = new HashMap<Nodeid, Nodeid>(revisionCount); 218 firstParent = new HashMap<Nodeid, Nodeid>(revisionCount);
215 secondParent = new HashMap<Nodeid, Nodeid>(firstParent.size() >> 1); // assume branches/merges are less frequent 219 secondParent = new HashMap<Nodeid, Nodeid>(firstParent.size() >> 1); // assume branches/merges are less frequent
307 } 311 }
308 } 312 }
309 // leave only those of interest in ordered sequence 313 // leave only those of interest in ordered sequence
310 orderedResult.retainAll(result); 314 orderedResult.retainAll(result);
311 return orderedResult; 315 return orderedResult;
316 }
317
318 /**
319 * @param node possibly parent node
320 * @return <code>true</code> if there's any node in this revlog that has specified node as one of its parents.
321 */
322 public boolean hasChildren(Nodeid node) {
323 // FIXME containsValue is linear, likely. May want to optimize it with another (Tree|Hash)Set, created on demand
324 // on first use
325 return firstParent.containsValue(node) || secondParent.containsValue(node);
312 } 326 }
313 } 327 }
314 328
315 protected static class ContentPipe implements RevlogStream.Inspector, CancelSupport { 329 protected static class ContentPipe implements RevlogStream.Inspector, CancelSupport {
316 private final ByteChannel sink; 330 private final ByteChannel sink;