comparison src/org/tmatesoft/hg/repo/HgMergeState.java @ 708:4ffc17c0b534

Merge: tests for resolver and complex scenario. Enable commit for merged revisions. Reuse file revisions if nothing changed
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 20 Aug 2013 18:41:34 +0200
parents 42b88709e41d
children
comparison
equal deleted inserted replaced
707:42b88709e41d 708:4ffc17c0b534
30 import org.tmatesoft.hg.core.Nodeid; 30 import org.tmatesoft.hg.core.Nodeid;
31 import org.tmatesoft.hg.internal.Internals; 31 import org.tmatesoft.hg.internal.Internals;
32 import org.tmatesoft.hg.internal.LineReader; 32 import org.tmatesoft.hg.internal.LineReader;
33 import org.tmatesoft.hg.internal.ManifestRevision; 33 import org.tmatesoft.hg.internal.ManifestRevision;
34 import org.tmatesoft.hg.internal.Pool; 34 import org.tmatesoft.hg.internal.Pool;
35 import org.tmatesoft.hg.util.LogFacility.Severity;
35 import org.tmatesoft.hg.util.Pair; 36 import org.tmatesoft.hg.util.Pair;
36 import org.tmatesoft.hg.util.Path; 37 import org.tmatesoft.hg.util.Path;
37 import org.tmatesoft.hg.util.PathRewrite; 38 import org.tmatesoft.hg.util.PathRewrite;
38 39
39 /** 40 /**
125 String s = lines.next(); 126 String s = lines.next();
126 stateParent = nodeidPool.unify(Nodeid.fromAscii(s)); 127 stateParent = nodeidPool.unify(Nodeid.fromAscii(s));
127 final int rp1 = hgRepo.getChangelog().getRevisionIndex(stateParent); 128 final int rp1 = hgRepo.getChangelog().getRevisionIndex(stateParent);
128 hgRepo.getManifest().walk(rp1, rp1, m1); 129 hgRepo.getManifest().walk(rp1, rp1, m1);
129 while (lines.hasNext()) { 130 while (lines.hasNext()) {
131 s = lines.next();
130 String[] r = s.split("\\00"); 132 String[] r = s.split("\\00");
133 if (r.length < 7) {
134 repo.getLog().dump(getClass(), Severity.Error, "Expect at least 7 zero-separated fields in the merge state file, not %d. Entry skipped", r.length);
135 continue;
136 }
131 Path p1fname = pathPool.path(r[3]); 137 Path p1fname = pathPool.path(r[3]);
132 Nodeid nidP1 = m1.nodeid(p1fname); 138 Nodeid nidP1 = m1.nodeid(p1fname);
133 Nodeid nidCA = nodeidPool.unify(Nodeid.fromAscii(r[5])); 139 Nodeid nidCA = nodeidPool.unify(Nodeid.fromAscii(r[5]));
134 HgFileRevision p1 = new HgFileRevision(hgRepo, nidP1, m1.flags(p1fname), p1fname); 140 HgFileRevision p1 = new HgFileRevision(hgRepo, nidP1, m1.flags(p1fname), p1fname);
135 HgFileRevision ca; 141 HgFileRevision ca;
216 return stateParent; 222 return stateParent;
217 } 223 }
218 224
219 /** 225 /**
220 * List of conflicts as recorded in the merge state information file. 226 * List of conflicts as recorded in the merge state information file.
221 * Note, this information is not valid unless {@link #isStale()} is <code>true</code>. 227 * Note, this information is not valid when {@link #isStale()} is <code>true</code>.
222 * 228 *
223 * @return non-<code>null</code> list with both resolved and unresolved conflicts. 229 * @return non-<code>null</code> list with both resolved and unresolved conflicts.
224 */ 230 */
225 public List<Entry> getConflicts() { 231 public List<Entry> getConflicts() {
226 return entries == null ? Collections.<Entry>emptyList() : Arrays.asList(entries); 232 return entries == null ? Collections.<Entry>emptyList() : Arrays.asList(entries);