Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/Revlog.java @ 308:3f40262153a4
Recognize closed branches
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Sat, 24 Sep 2011 07:29:05 +0200 |
parents | 2f2ab5c27f41 |
children | 09628675bcee |
comparison
equal
deleted
inserted
replaced
307:2f2ab5c27f41 | 308:3f40262153a4 |
---|---|
355 } | 355 } |
356 return result; | 356 return result; |
357 } | 357 } |
358 | 358 |
359 /** | 359 /** |
360 * @return revisions that have supplied revision as their immediate parent | |
361 */ | |
362 public List<Nodeid> directChildren(Nodeid nid) { | |
363 LinkedList<Nodeid> result = new LinkedList<Nodeid>(); | |
364 int x = Arrays.binarySearch(sorted, nid); | |
365 assertSortedIndex(x); | |
366 nid = sorted[x]; // canonical instance | |
367 int start = sorted2natural[x]; | |
368 for (int i = start + 1; i < sequential.length; i++) { | |
369 if (nid == firstParent[i] || nid == secondParent[i]) { | |
370 result.add(sequential[i]); | |
371 } | |
372 } | |
373 return result; | |
374 } | |
375 | |
376 /** | |
360 * @param nid possibly parent node, shall be {@link #knownNode(Nodeid) known} in this revlog. | 377 * @param nid possibly parent node, shall be {@link #knownNode(Nodeid) known} in this revlog. |
361 * @return <code>true</code> if there's any node in this revlog that has specified node as one of its parents. | 378 * @return <code>true</code> if there's any node in this revlog that has specified node as one of its parents. |
362 */ | 379 */ |
363 public boolean hasChildren(Nodeid nid) { | 380 public boolean hasChildren(Nodeid nid) { |
364 int x = Arrays.binarySearch(sorted, nid); | 381 int x = Arrays.binarySearch(sorted, nid); |