comparison src/org/tmatesoft/hg/core/HgChangeset.java @ 274:9fb50c04f03c

Use Nodeid.isNull check instead of NULL.equals
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 25 Aug 2011 03:57:39 +0200
parents 1792b37650f2
children ee6b467c1a5f
comparison
equal deleted inserted replaced
273:8f872bd7ddd2 274:9fb50c04f03c
14 * the terms of a license other than GNU General Public License 14 * the terms of a license other than GNU General Public License
15 * contact TMate Software at support@hg4j.com 15 * contact TMate Software at support@hg4j.com
16 */ 16 */
17 package org.tmatesoft.hg.core; 17 package org.tmatesoft.hg.core;
18 18
19 import static org.tmatesoft.hg.core.Nodeid.NULL;
20
21 import java.util.ArrayList; 19 import java.util.ArrayList;
22 import java.util.Collections; 20 import java.util.Collections;
23 import java.util.List; 21 import java.util.List;
24 22
25 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; 23 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
138 return deletedFiles; 136 return deletedFiles;
139 } 137 }
140 138
141 public boolean isMerge() { 139 public boolean isMerge() {
142 // p1 == -1 and p2 != -1 is legitimate case 140 // p1 == -1 and p2 != -1 is legitimate case
143 return !NULL.equals(getFirstParentRevision()) && !NULL.equals(getSecondParentRevision()); 141 return !(getFirstParentRevision().isNull() || getSecondParentRevision().isNull());
144 } 142 }
145 143
144 /**
145 * @return never <code>null</code>
146 */
146 public Nodeid getFirstParentRevision() { 147 public Nodeid getFirstParentRevision() {
147 if (parentHelper != null) { 148 if (parentHelper != null) {
148 return parentHelper.safeFirstParent(nodeid); 149 return parentHelper.safeFirstParent(nodeid);
149 } 150 }
150 // read once for both p1 and p2 151 // read once for both p1 and p2
154 statusHelper.getRepo().getChangelog().parents(revNumber, new int[2], parent1, parent2); 155 statusHelper.getRepo().getChangelog().parents(revNumber, new int[2], parent1, parent2);
155 } 156 }
156 return Nodeid.fromBinary(parent1, 0); 157 return Nodeid.fromBinary(parent1, 0);
157 } 158 }
158 159
160 /**
161 * @return never <code>null</code>
162 */
159 public Nodeid getSecondParentRevision() { 163 public Nodeid getSecondParentRevision() {
160 if (parentHelper != null) { 164 if (parentHelper != null) {
161 return parentHelper.safeSecondParent(nodeid); 165 return parentHelper.safeSecondParent(nodeid);
162 } 166 }
163 if (parent2 == null) { 167 if (parent2 == null) {