Mercurial > hg4j
annotate src/org/tmatesoft/hg/repo/HgMergeState.java @ 423:9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 23 Mar 2012 22:51:18 +0100 |
parents | ee8264d80747 |
children | 12f668401613 |
rev | line source |
---|---|
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
2 * Copyright (c) 2011-2012 TMate Software Ltd |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.repo; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
19 import static org.tmatesoft.hg.core.Nodeid.NULL; |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
20 |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
21 import java.io.BufferedReader; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 import java.io.File; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 import java.io.FileReader; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 import java.io.IOException; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 import java.util.ArrayList; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 import java.util.Arrays; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 import java.util.Collections; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
28 import java.util.List; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
29 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
30 import org.tmatesoft.hg.core.HgFileRevision; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
31 import org.tmatesoft.hg.core.Nodeid; |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
32 import org.tmatesoft.hg.internal.ManifestRevision; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
33 import org.tmatesoft.hg.internal.Pool; |
284
7232b94f2ae3
HgDirstate shall operate with Path instead of String for file names. Use of Pair instead of array of unspecified length for parents.
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
270
diff
changeset
|
34 import org.tmatesoft.hg.util.Pair; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 import org.tmatesoft.hg.util.Path; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 import org.tmatesoft.hg.util.PathPool; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
37 import org.tmatesoft.hg.util.PathRewrite; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 /** |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
40 * Access to repository's merge state |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
41 * |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 * @author Artem Tikhomirov |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
43 * @author TMate Software Ltd. |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 */ |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 public class HgMergeState { |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
46 private Nodeid wcp1, wcp2, stateParent; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 public enum Kind { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
49 Resolved, Unresolved; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
50 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
51 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
52 public static class Entry { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
53 private final Kind state; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
54 private final HgFileRevision parent1; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
55 private final HgFileRevision parent2; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
56 private final HgFileRevision ancestor; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
57 private final Path wcFile; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
58 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
59 /*package-local*/Entry(Kind s, Path actualCopy, HgFileRevision p1, HgFileRevision p2, HgFileRevision ca) { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
60 if (p1 == null || p2 == null || ca == null || actualCopy == null) { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
61 throw new IllegalArgumentException(); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
62 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
63 state = s; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
64 wcFile = actualCopy; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
65 parent1 = p1; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
66 parent2 = p2; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
67 ancestor = ca; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
68 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
69 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
70 public Kind getState() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
71 return state; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
72 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
73 public Path getActualFile() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
74 return wcFile; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
75 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
76 public HgFileRevision getFirstParent() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
77 return parent1; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
78 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
79 public HgFileRevision getSecondParent() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
80 return parent2; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
81 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
82 public HgFileRevision getCommonAncestor() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
83 return ancestor; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
84 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
85 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
86 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
87 private final HgRepository repo; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
88 private Entry[] entries; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
89 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
90 HgMergeState(HgRepository hgRepo) { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
91 repo = hgRepo; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
92 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
93 |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
94 /** |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
95 * Update our knowledge about repository's merge state |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
96 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
97 */ |
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
98 public void refresh() throws HgRuntimeException { |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
99 entries = null; |
341
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
100 // it's possible there are two parents but no merge/state, we shall report this case as 'merging', with proper |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
101 // first and second parent values |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
102 stateParent = Nodeid.NULL; |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
103 Pool<Nodeid> nodeidPool = new Pool<Nodeid>(); |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
104 Pool<Path> fnamePool = new Pool<Path>(); |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
105 Pair<Nodeid, Nodeid> wcParents = repo.getWorkingCopyParents(); |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
106 wcp1 = nodeidPool.unify(wcParents.first()); wcp2 = nodeidPool.unify(wcParents.second()); |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
107 final File f = new File(repo.getRepositoryRoot(), "merge/state"); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
108 if (!f.canRead()) { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
109 // empty state |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
110 return; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
111 } |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
112 try { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
113 ArrayList<Entry> result = new ArrayList<Entry>(); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
114 // FIXME need to settle use of Pool<Path> and PathPool |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
115 // latter is pool that can create objects on demand, former is just cache |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
116 PathPool pathPool = new PathPool(new PathRewrite.Empty()); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
117 final ManifestRevision m1 = new ManifestRevision(nodeidPool, fnamePool); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
118 final ManifestRevision m2 = new ManifestRevision(nodeidPool, fnamePool); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
119 if (!wcp2.isNull()) { |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
120 final int rp2 = repo.getChangelog().getRevisionIndex(wcp2); |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
121 repo.getManifest().walk(rp2, rp2, m2); |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
122 } |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
123 BufferedReader br = new BufferedReader(new FileReader(f)); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
124 String s = br.readLine(); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
125 stateParent = nodeidPool.unify(Nodeid.fromAscii(s)); |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
126 final int rp1 = repo.getChangelog().getRevisionIndex(stateParent); |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
127 repo.getManifest().walk(rp1, rp1, m1); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
128 while ((s = br.readLine()) != null) { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
129 String[] r = s.split("\\00"); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
130 Path p1fname = pathPool.path(r[3]); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
131 Nodeid nidP1 = m1.nodeid(p1fname); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
132 Nodeid nidCA = nodeidPool.unify(Nodeid.fromAscii(r[5])); |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
133 HgFileRevision p1 = new HgFileRevision(repo, nidP1, m1.flags(p1fname), p1fname); |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
134 HgFileRevision ca; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
135 if (nidCA == nidP1 && r[3].equals(r[4])) { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
136 ca = p1; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
137 } else { |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
138 ca = new HgFileRevision(repo, nidCA, null, pathPool.path(r[4])); |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
139 } |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
140 HgFileRevision p2; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
141 if (!wcp2.isNull() || !r[6].equals(r[4])) { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
142 final Path p2fname = pathPool.path(r[6]); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
143 Nodeid nidP2 = m2.nodeid(p2fname); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
144 if (nidP2 == null) { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
145 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"; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
146 nidP2 = NULL; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
147 } |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
148 p2 = new HgFileRevision(repo, nidP2, m2.flags(p2fname), p2fname); |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
149 } else { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
150 // no second parent known. no idea what to do here, assume linear merge, use common ancestor as parent |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
151 p2 = ca; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
152 } |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
153 final Kind k; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
154 if ("u".equals(r[1])) { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
155 k = Kind.Unresolved; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
156 } else if ("r".equals(r[1])) { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
157 k = Kind.Resolved; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
158 } else { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
159 throw new HgInvalidStateException(String.format("Unknown merge kind %s", r[1])); |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
160 } |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
161 Entry e = new Entry(k, pathPool.path(r[0]), p1, p2, ca); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
162 result.add(e); |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
163 } |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
164 entries = result.toArray(new Entry[result.size()]); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
165 br.close(); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
166 pathPool.clear(); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
167 } catch (IOException ex) { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
168 throw new HgInvalidControlFileException("Merge state read failed", ex, f); |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
169 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
170 } |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
171 |
341
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
172 /** |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
173 * Repository is in 'merging' state when changeset to be committed got two parents. |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
174 * This method doesn't tell whether there are (un)resolved conflicts in the working copy, |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
175 * use {@link #getConflicts()} (which makes sense only when {@link #isStale()} is <code>false</code>). |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
176 * @return <code>true</code> when repository is being merged |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
177 */ |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
178 public boolean isMerging() { |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
179 return !getFirstParent().isNull() && !getSecondParent().isNull() && !isStale(); |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
180 } |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
181 |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
182 /** |
341
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
183 * Merge state file may not match actual working copy due to rollback or undo operations. |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
184 * Value of {@link #getConflicts()} is reasonable iff this method returned <code>false</code>. |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
185 * |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
186 * @return <code>true</code> when recorded merge state doesn't seem to correspond to present working copy |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
187 */ |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
188 public boolean isStale() { |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
189 if (wcp1 == null) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
190 refresh(); |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
191 } |
341
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
192 return !stateParent.isNull() /*there's merge state*/ && !wcp1.equals(stateParent) /*and it doesn't match*/; |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
193 } |
336
f74e36b7344b
Do not fail with HgBadStateException when there are no merge state
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
194 |
f74e36b7344b
Do not fail with HgBadStateException when there are no merge state
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
195 /** |
341
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
196 * It's possible for a repository to be in a 'merging' state (@see {@link #isMerging()} without any |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
197 * conflict to resolve (no merge state information file). |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
198 * |
341
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
199 * @return first parent of the working copy, never <code>null</code> |
336
f74e36b7344b
Do not fail with HgBadStateException when there are no merge state
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
200 */ |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
201 public Nodeid getFirstParent() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
202 if (wcp1 == null) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
203 refresh(); |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
204 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
205 return wcp1; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
206 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
207 |
341
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
208 /** |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
209 * @return second parent of the working copy, never <code>null</code> |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
210 */ |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
211 public Nodeid getSecondParent() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
212 if (wcp2 == null) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
213 refresh(); |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
214 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
215 return wcp2; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
216 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
217 |
336
f74e36b7344b
Do not fail with HgBadStateException when there are no merge state
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
218 /** |
f74e36b7344b
Do not fail with HgBadStateException when there are no merge state
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
219 * @return revision of the merge state or {@link Nodeid#NULL} if there's no merge state |
f74e36b7344b
Do not fail with HgBadStateException when there are no merge state
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
220 */ |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
221 public Nodeid getStateParent() { |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
222 if (stateParent == null) { |
423
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
223 refresh(); |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
224 } |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
225 return stateParent; |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
226 } |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
227 |
341
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
228 /** |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
229 * List of conflicts as recorded in the merge state information file. |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
230 * Note, this information is valid unless {@link #isStale()} is <code>true</code>. |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
231 * |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
232 * @return non-<code>null</code> list with both resolved and unresolved conflicts. |
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
336
diff
changeset
|
233 */ |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
234 public List<Entry> getConflicts() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
235 return entries == null ? Collections.<Entry>emptyList() : Arrays.asList(entries); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
236 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
237 } |