Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgMergeState.java @ 285:6dbbc53fc46d
Use Path instead of plain String for manifest file names
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Sat, 03 Sep 2011 21:46:13 +0200 |
| parents | 7232b94f2ae3 |
| children | f74e36b7344b |
comparison
equal
deleted
inserted
replaced
| 284:7232b94f2ae3 | 285:6dbbc53fc46d |
|---|---|
| 97 if (!f.canRead()) { | 97 if (!f.canRead()) { |
| 98 // empty state | 98 // empty state |
| 99 return; | 99 return; |
| 100 } | 100 } |
| 101 Pool<Nodeid> nodeidPool = new Pool<Nodeid>(); | 101 Pool<Nodeid> nodeidPool = new Pool<Nodeid>(); |
| 102 Pool<String> fnamePool = new Pool<String>(); | 102 Pool<Path> fnamePool = new Pool<Path>(); |
| 103 Pair<Nodeid, Nodeid> wcParents = repo.getWorkingCopyParents(); | 103 Pair<Nodeid, Nodeid> wcParents = repo.getWorkingCopyParents(); |
| 104 wcp1 = nodeidPool.unify(wcParents.first()); wcp2 = nodeidPool.unify(wcParents.second()); | 104 wcp1 = nodeidPool.unify(wcParents.first()); wcp2 = nodeidPool.unify(wcParents.second()); |
| 105 ArrayList<Entry> result = new ArrayList<Entry>(); | 105 ArrayList<Entry> result = new ArrayList<Entry>(); |
| 106 PathPool pathPool = new PathPool(new PathRewrite.Empty()); | 106 // FIXME need to settle use of Pool<Path> and PathPool |
| 107 // latter is pool that can create objects on demand, former is just cache | |
| 108 PathPool pathPool = new PathPool(new PathRewrite.Empty()); | |
| 107 final ManifestRevision m1 = new ManifestRevision(nodeidPool, fnamePool); | 109 final ManifestRevision m1 = new ManifestRevision(nodeidPool, fnamePool); |
| 108 final ManifestRevision m2 = new ManifestRevision(nodeidPool, fnamePool); | 110 final ManifestRevision m2 = new ManifestRevision(nodeidPool, fnamePool); |
| 109 if (!wcp2.isNull()) { | 111 if (!wcp2.isNull()) { |
| 110 final int rp2 = repo.getChangelog().getLocalRevision(wcp2); | 112 final int rp2 = repo.getChangelog().getLocalRevision(wcp2); |
| 111 repo.getManifest().walk(rp2, rp2, m2); | 113 repo.getManifest().walk(rp2, rp2, m2); |
| 115 stateParent = nodeidPool.unify(Nodeid.fromAscii(s)); | 117 stateParent = nodeidPool.unify(Nodeid.fromAscii(s)); |
| 116 final int rp1 = repo.getChangelog().getLocalRevision(stateParent); | 118 final int rp1 = repo.getChangelog().getLocalRevision(stateParent); |
| 117 repo.getManifest().walk(rp1, rp1, m1); | 119 repo.getManifest().walk(rp1, rp1, m1); |
| 118 while ((s = br.readLine()) != null) { | 120 while ((s = br.readLine()) != null) { |
| 119 String[] r = s.split("\\00"); | 121 String[] r = s.split("\\00"); |
| 120 Nodeid nidP1 = m1.nodeid(r[3]); | 122 Path p1fname = pathPool.path(r[3]); |
| 123 Nodeid nidP1 = m1.nodeid(p1fname); | |
| 121 Nodeid nidCA = nodeidPool.unify(Nodeid.fromAscii(r[5])); | 124 Nodeid nidCA = nodeidPool.unify(Nodeid.fromAscii(r[5])); |
| 122 HgFileRevision p1 = new HgFileRevision(repo, nidP1, pathPool.path(r[3])); | 125 HgFileRevision p1 = new HgFileRevision(repo, nidP1, p1fname); |
| 123 HgFileRevision ca; | 126 HgFileRevision ca; |
| 124 if (nidCA == nidP1 && r[3].equals(r[4])) { | 127 if (nidCA == nidP1 && r[3].equals(r[4])) { |
| 125 ca = p1; | 128 ca = p1; |
| 126 } else { | 129 } else { |
| 127 ca = new HgFileRevision(repo, nidCA, pathPool.path(r[4])); | 130 ca = new HgFileRevision(repo, nidCA, pathPool.path(r[4])); |
| 128 } | 131 } |
| 129 HgFileRevision p2; | 132 HgFileRevision p2; |
| 130 if (!wcp2.isNull() || !r[6].equals(r[4])) { | 133 if (!wcp2.isNull() || !r[6].equals(r[4])) { |
| 131 Nodeid nidP2 = m2.nodeid(r[6]); | 134 final Path p2fname = pathPool.path(r[6]); |
| 135 Nodeid nidP2 = m2.nodeid(p2fname); | |
| 132 if (nidP2 == null) { | 136 if (nidP2 == null) { |
| 133 assert false : "There's not enough information (or I don't know where to look) in merge/state to find out what's the second parent"; | 137 assert false : "There's not enough information (or I don't know where to look) in merge/state to find out what's the second parent"; |
| 134 nidP2 = NULL; | 138 nidP2 = NULL; |
| 135 } | 139 } |
| 136 p2 = new HgFileRevision(repo, nidP2, pathPool.path(r[6])); | 140 p2 = new HgFileRevision(repo, nidP2, p2fname); |
| 137 } else { | 141 } else { |
| 138 // no second parent known. no idea what to do here, assume linear merge, use common ancestor as parent | 142 // no second parent known. no idea what to do here, assume linear merge, use common ancestor as parent |
| 139 p2 = ca; | 143 p2 = ca; |
| 140 } | 144 } |
| 141 final Kind k; | 145 final Kind k; |
