comparison src/org/tmatesoft/hg/repo/HgParentChildMap.java @ 628:6526d8adbc0f

Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 22 May 2013 15:52:31 +0200
parents be697c3e951e
children 14dac192aa26 a5cf64f2e7e4
comparison
equal deleted inserted replaced
627:5153eb73b18d 628:6526d8adbc0f
1 /* 1 /*
2 * Copyright (c) 2011-2012 TMate Software Ltd 2 * Copyright (c) 2011-2013 TMate Software Ltd
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License. 6 * the Free Software Foundation; version 2 of the License.
7 * 7 *
86 if (parent2Revision != -1) { // revlog of DataAccess.java has p2 set when p1 is -1 86 if (parent2Revision != -1) { // revlog of DataAccess.java has p2 set when p1 is -1
87 secondParent[ix] = sequential[parent2Revision]; 87 secondParent[ix] = sequential[parent2Revision];
88 } 88 }
89 } 89 }
90 90
91 public void init() throws HgInvalidControlFileException { 91 /**
92 * Prepare the map
93 * @throws HgInvalidControlFileException if failed to access revlog index/data entry. <em>Runtime exception</em>
94 * @throws HgRuntimeException subclass thereof to indicate other issues with the library. <em>Runtime exception</em>
95 */
96 public void init() throws HgRuntimeException {
92 final int revisionCount = revlog.getRevisionCount(); 97 final int revisionCount = revlog.getRevisionCount();
93 firstParent = new Nodeid[revisionCount]; 98 firstParent = new Nodeid[revisionCount];
94 // TODO [post 1.0] Branches/merges are less frequent, and most of secondParent would be -1/null, hence 99 // TODO [post 1.0] Branches/merges are less frequent, and most of secondParent would be -1/null, hence
95 // IntMap might be better alternative here, but need to carefully analyze (test) whether this brings 100 // IntMap might be better alternative here, but need to carefully analyze (test) whether this brings
96 // real improvement (IntMap has 2n capacity, and element lookup is log(n) instead of array's constant) 101 // real improvement (IntMap has 2n capacity, and element lookup is log(n) instead of array's constant)