Mercurial > hg4j
comparison src/org/tmatesoft/hg/repo/HgStatusCollector.java @ 282:e51dd9a14b6f
Yet another WC status fix, where dirstate parent and base revision are treated right (dirstate parent other than tip and explicit baseRevision are not the same)
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Sat, 03 Sep 2011 01:21:03 +0200 |
| parents | 81e9a3c9bafe |
| children | 7232b94f2ae3 |
comparison
equal
deleted
inserted
replaced
| 281:81e9a3c9bafe | 282:e51dd9a14b6f |
|---|---|
| 168 int[] parents = new int[2]; | 168 int[] parents = new int[2]; |
| 169 repo.getChangelog().parents(rev, parents, null, null); | 169 repo.getChangelog().parents(rev, parents, null, null); |
| 170 walk(parents[0], rev, inspector); | 170 walk(parents[0], rev, inspector); |
| 171 } | 171 } |
| 172 | 172 |
| 173 // I assume revision numbers are the same for changelog and manifest - here | 173 // rev1 and rev2 are changelog revision numbers, argument order matters. |
| 174 // user would like to pass changelog revision numbers, and I use them directly to walk manifest. | 174 // Either rev1 or rev2 may be -1 to indicate comparison to empty repository (XXX this is due to use of |
| 175 // if this assumption is wrong, fix this (lookup manifest revisions from changeset). | 175 // parents in #change(), I believe. Perhaps, need a constant for this? Otherwise this hidden knowledge gets |
| 176 // rev1 and rev2 may be -1 to indicate comparison to empty repository | 176 // exposed to e.g. Record |
| 177 // argument order matters | |
| 178 public void walk(int rev1, int rev2, HgStatusInspector inspector) { | 177 public void walk(int rev1, int rev2, HgStatusInspector inspector) { |
| 179 if (rev1 == rev2) { | 178 if (rev1 == rev2) { |
| 180 throw new IllegalArgumentException(); | 179 throw new IllegalArgumentException(); |
| 181 } | 180 } |
| 182 if (inspector == null) { | 181 if (inspector == null) { |
| 183 throw new IllegalArgumentException(); | 182 throw new IllegalArgumentException(); |
| 184 } | 183 } |
| 185 if (inspector instanceof Record) { | |
| 186 ((Record) inspector).init(rev1, rev2, this); | |
| 187 } | |
| 188 final int lastManifestRevision = repo.getChangelog().getLastRevision(); | 184 final int lastManifestRevision = repo.getChangelog().getLastRevision(); |
| 189 if (rev1 == TIP) { | 185 if (rev1 == TIP) { |
| 190 rev1 = lastManifestRevision; | 186 rev1 = lastManifestRevision; |
| 191 } | 187 } |
| 192 if (rev2 == TIP) { | 188 if (rev2 == TIP) { |
| 193 rev2 = lastManifestRevision; | 189 rev2 = lastManifestRevision; |
| 190 } | |
| 191 if (inspector instanceof Record) { | |
| 192 ((Record) inspector).init(rev1, rev2, this); | |
| 194 } | 193 } |
| 195 // in fact, rev1 and rev2 are often next (or close) to each other, | 194 // in fact, rev1 and rev2 are often next (or close) to each other, |
| 196 // thus, we can optimize Manifest reads here (manifest.walk(rev1, rev2)) | 195 // thus, we can optimize Manifest reads here (manifest.walk(rev1, rev2)) |
| 197 ManifestRevision r1, r2 ; | 196 ManifestRevision r1, r2 ; |
| 198 boolean need1 = !cached(rev1), need2 = !cached(rev2); | 197 boolean need1 = !cached(rev1), need2 = !cached(rev2); |
