Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/RepositoryComparator.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 | 41a778e3fd31 |
children | 981f9f50bb6c |
comparison
equal
deleted
inserted
replaced
273:8f872bd7ddd2 | 274:9fb50c04f03c |
---|---|
153 if (localRepo.knownNode(rb.root)) { | 153 if (localRepo.knownNode(rb.root)) { |
154 // we known branch start, common head is somewhere in its descendants line | 154 // we known branch start, common head is somewhere in its descendants line |
155 checkUp2Head.add(rb); | 155 checkUp2Head.add(rb); |
156 } else { | 156 } else { |
157 // dig deeper in the history, if necessary | 157 // dig deeper in the history, if necessary |
158 if (!NULL.equals(rb.p1) && !localRepo.knownNode(rb.p1)) { | 158 if (!rb.p1.isNull() && !localRepo.knownNode(rb.p1)) { |
159 toQuery.add(rb.p1); | 159 toQuery.add(rb.p1); |
160 } | 160 } |
161 if (!NULL.equals(rb.p2) && !localRepo.knownNode(rb.p2)) { | 161 if (!rb.p2.isNull() && !localRepo.knownNode(rb.p2)) { |
162 toQuery.add(rb.p2); | 162 toQuery.add(rb.p2); |
163 } | 163 } |
164 } | 164 } |
165 } | 165 } |
166 } | 166 } |
243 // we known branch start, common head is somewhere in its descendants line | 243 // we known branch start, common head is somewhere in its descendants line |
244 checkUp2Head.add(rb); | 244 checkUp2Head.add(rb); |
245 } else { | 245 } else { |
246 chainElement.branchRoot = rb.root; | 246 chainElement.branchRoot = rb.root; |
247 // dig deeper in the history, if necessary | 247 // dig deeper in the history, if necessary |
248 boolean hasP1 = !NULL.equals(rb.p1), hasP2 = !NULL.equals(rb.p2); | 248 boolean hasP1 = !rb.p1.isNull(), hasP2 = !rb.p2.isNull(); |
249 if (hasP1 && !localRepo.knownNode(rb.p1)) { | 249 if (hasP1 && !localRepo.knownNode(rb.p1)) { |
250 toQuery.add(rb.p1); | 250 toQuery.add(rb.p1); |
251 // we might have seen parent node already, and recorded it as a branch chain | 251 // we might have seen parent node already, and recorded it as a branch chain |
252 // we shall reuse existing BC to get it completely initializer (head2chain map | 252 // we shall reuse existing BC to get it completely initializer (head2chain map |
253 // on second put with the same key would leave first BC uninitialized. | 253 // on second put with the same key would leave first BC uninitialized. |
354 } | 354 } |
355 | 355 |
356 // true when this BranchChain is a branch that spans up to very start of the repository | 356 // true when this BranchChain is a branch that spans up to very start of the repository |
357 // Thus, the only common revision is NULL, recorded in a fake BranchChain object shared between p1 and p2 | 357 // Thus, the only common revision is NULL, recorded in a fake BranchChain object shared between p1 and p2 |
358 /*package-local*/ boolean isRepoStart() { | 358 /*package-local*/ boolean isRepoStart() { |
359 return p1 == p2 && p1 != null && p1.branchHead == p1.branchRoot && NULL.equals(p1.branchHead); | 359 return p1 == p2 && p1 != null && p1.branchHead == p1.branchRoot && p1.branchHead.isNull(); |
360 } | 360 } |
361 | 361 |
362 @Override | 362 @Override |
363 public String toString() { | 363 public String toString() { |
364 return String.format("BranchChain [%s, %s]", branchRoot, branchHead); | 364 return String.format("BranchChain [%s, %s]", branchRoot, branchHead); |