Mercurial > hg4j
annotate src/org/tmatesoft/hg/repo/HgMergeState.java @ 712:a864fb309e4b
Issue 49: NoClassDefFoundError: org/tmatesoft/hg/auth/HgAuthenticator. Missing package in the binary bundle
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Sun, 03 Aug 2014 18:04:13 +0200 |
parents | 4ffc17c0b534 |
children |
rev | line source |
---|---|
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
628
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
2 * Copyright (c) 2011-2013 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.File; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 import java.util.ArrayList; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 import java.util.Arrays; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 import java.util.Collections; |
707
42b88709e41d
Merge: support 'unresolved' resolution with MergeStateBuilder
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
705
diff
changeset
|
25 import java.util.Iterator; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 import java.util.List; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
28 import org.tmatesoft.hg.core.HgFileRevision; |
707
42b88709e41d
Merge: support 'unresolved' resolution with MergeStateBuilder
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
705
diff
changeset
|
29 import org.tmatesoft.hg.core.HgIOException; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
30 import org.tmatesoft.hg.core.Nodeid; |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
31 import org.tmatesoft.hg.internal.Internals; |
707
42b88709e41d
Merge: support 'unresolved' resolution with MergeStateBuilder
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
705
diff
changeset
|
32 import org.tmatesoft.hg.internal.LineReader; |
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
|
33 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
|
34 import org.tmatesoft.hg.internal.Pool; |
708
4ffc17c0b534
Merge: tests for resolver and complex scenario. Enable commit for merged revisions. Reuse file revisions if nothing changed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
707
diff
changeset
|
35 import org.tmatesoft.hg.util.LogFacility.Severity; |
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
|
36 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
|
37 import org.tmatesoft.hg.util.Path; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 import org.tmatesoft.hg.util.PathRewrite; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 /** |
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
|
41 * 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
|
42 * |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
43 * @author Artem Tikhomirov |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 * @author TMate Software Ltd. |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 */ |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 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
|
47 private Nodeid wcp1, wcp2, stateParent; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
48 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
49 public enum Kind { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
50 Resolved, Unresolved; |
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 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
53 public static class Entry { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
54 private final Kind state; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
55 private final HgFileRevision parent1; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
56 private final HgFileRevision parent2; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
57 private final HgFileRevision ancestor; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
58 private final Path wcFile; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
59 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
60 /*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
|
61 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
|
62 throw new IllegalArgumentException(); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
63 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
64 state = s; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
65 wcFile = actualCopy; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
66 parent1 = p1; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
67 parent2 = p2; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
68 ancestor = ca; |
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 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
71 public Kind getState() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
72 return state; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
73 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
74 public Path getActualFile() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
75 return wcFile; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
76 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
77 public HgFileRevision getFirstParent() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
78 return parent1; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
79 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
80 public HgFileRevision getSecondParent() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
81 return parent2; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
82 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
83 public HgFileRevision getCommonAncestor() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
84 return ancestor; |
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 |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
88 private final Internals repo; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
89 private Entry[] entries; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
90 |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
91 HgMergeState(Internals internalRepo) { |
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
92 repo = internalRepo; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
93 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
94 |
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
|
95 /** |
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 * 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
|
97 * @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
|
98 */ |
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
|
99 public void refresh() throws HgRuntimeException { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
100 final HgRepository hgRepo = repo.getRepo(); |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
101 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
|
102 // 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
|
103 // 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
|
104 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
|
105 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
|
106 Pool<Path> fnamePool = new Pool<Path>(); |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
107 Pair<Nodeid, Nodeid> wcParents = hgRepo.getWorkingCopyParents(); |
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
|
108 wcp1 = nodeidPool.unify(wcParents.first()); wcp2 = nodeidPool.unify(wcParents.second()); |
707
42b88709e41d
Merge: support 'unresolved' resolution with MergeStateBuilder
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
705
diff
changeset
|
109 final File f = repo.getRepositoryFile(HgRepositoryFiles.MergeState); |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
110 if (!f.canRead()) { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
111 // empty state |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
112 return; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
113 } |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
114 try { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
115 ArrayList<Entry> result = new ArrayList<Entry>(); |
431
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
116 // pipe (already normalized) names from mergestate through same pool of filenames as use manifest revisions |
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
117 Path.Source pathPool = new Path.SimpleSource(new PathRewrite.Empty(), fnamePool); |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
118 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
|
119 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
|
120 if (!wcp2.isNull()) { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
121 final int rp2 = hgRepo.getChangelog().getRevisionIndex(wcp2); |
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
122 hgRepo.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
|
123 } |
707
42b88709e41d
Merge: support 'unresolved' resolution with MergeStateBuilder
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
705
diff
changeset
|
124 LineReader lr = new LineReader(f, repo.getLog()); |
42b88709e41d
Merge: support 'unresolved' resolution with MergeStateBuilder
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
705
diff
changeset
|
125 Iterator<String> lines = lr.read(new LineReader.SimpleLineCollector(), new ArrayList<String>()).iterator(); |
42b88709e41d
Merge: support 'unresolved' resolution with MergeStateBuilder
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
705
diff
changeset
|
126 String s = lines.next(); |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
127 stateParent = nodeidPool.unify(Nodeid.fromAscii(s)); |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
128 final int rp1 = hgRepo.getChangelog().getRevisionIndex(stateParent); |
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
129 hgRepo.getManifest().walk(rp1, rp1, m1); |
707
42b88709e41d
Merge: support 'unresolved' resolution with MergeStateBuilder
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
705
diff
changeset
|
130 while (lines.hasNext()) { |
708
4ffc17c0b534
Merge: tests for resolver and complex scenario. Enable commit for merged revisions. Reuse file revisions if nothing changed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
707
diff
changeset
|
131 s = lines.next(); |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
132 String[] r = s.split("\\00"); |
708
4ffc17c0b534
Merge: tests for resolver and complex scenario. Enable commit for merged revisions. Reuse file revisions if nothing changed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
707
diff
changeset
|
133 if (r.length < 7) { |
4ffc17c0b534
Merge: tests for resolver and complex scenario. Enable commit for merged revisions. Reuse file revisions if nothing changed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
707
diff
changeset
|
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); |
4ffc17c0b534
Merge: tests for resolver and complex scenario. Enable commit for merged revisions. Reuse file revisions if nothing changed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
707
diff
changeset
|
135 continue; |
4ffc17c0b534
Merge: tests for resolver and complex scenario. Enable commit for merged revisions. Reuse file revisions if nothing changed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
707
diff
changeset
|
136 } |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
137 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
|
138 Nodeid nidP1 = m1.nodeid(p1fname); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
139 Nodeid nidCA = nodeidPool.unify(Nodeid.fromAscii(r[5])); |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
140 HgFileRevision p1 = new HgFileRevision(hgRepo, 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
|
141 HgFileRevision ca; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
142 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
|
143 ca = p1; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
144 } else { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
145 ca = new HgFileRevision(hgRepo, 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
|
146 } |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
147 HgFileRevision p2; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
148 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
|
149 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
|
150 Nodeid nidP2 = m2.nodeid(p2fname); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
151 if (nidP2 == null) { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
152 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
|
153 nidP2 = NULL; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
154 } |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
155 p2 = new HgFileRevision(hgRepo, 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
|
156 } else { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
157 // 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
|
158 p2 = ca; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
159 } |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
160 final Kind k; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
161 if ("u".equals(r[1])) { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
162 k = Kind.Unresolved; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
163 } 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
|
164 k = Kind.Resolved; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
165 } 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
|
166 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
|
167 } |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
168 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
|
169 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
|
170 } |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
171 entries = result.toArray(new Entry[result.size()]); |
707
42b88709e41d
Merge: support 'unresolved' resolution with MergeStateBuilder
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
705
diff
changeset
|
172 } catch (HgIOException ex) { |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
173 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
|
174 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
175 } |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
176 |
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
|
177 /** |
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
|
178 * 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
|
179 * 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
|
180 * 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
|
181 * @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
|
182 */ |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
183 public boolean isMerging() { |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
184 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
|
185 } |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
186 |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
187 /** |
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
|
188 * 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
|
189 * 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
|
190 * |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
191 * @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
|
192 */ |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
193 public boolean isStale() { |
628
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
194 assert wcp1 != 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
|
195 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
|
196 } |
336
f74e36b7344b
Do not fail with HgBadStateException when there are no merge state
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
197 |
f74e36b7344b
Do not fail with HgBadStateException when there are no merge state
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
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 * 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
|
200 * 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
|
201 * |
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
|
202 * @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
|
203 */ |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
204 public Nodeid getFirstParent() { |
628
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
205 assert wcp1 != null; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
206 return wcp1; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
207 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
208 |
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
|
209 /** |
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 * @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
|
211 */ |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
212 public Nodeid getSecondParent() { |
628
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
213 assert wcp2 != null; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
214 return wcp2; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
215 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
216 |
336
f74e36b7344b
Do not fail with HgBadStateException when there are no merge state
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
217 /** |
f74e36b7344b
Do not fail with HgBadStateException when there are no merge state
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
218 * @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
|
219 */ |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
220 public Nodeid getStateParent() { |
628
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
221 assert stateParent != null; |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
222 return stateParent; |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
223 } |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
224 |
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
|
225 /** |
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
|
226 * List of conflicts as recorded in the merge state information file. |
708
4ffc17c0b534
Merge: tests for resolver and complex scenario. Enable commit for merged revisions. Reuse file revisions if nothing changed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
707
diff
changeset
|
227 * Note, this information is not valid when {@link #isStale()} is <code>true</code>. |
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 * @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
|
230 */ |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
231 public List<Entry> getConflicts() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
232 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
|
233 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
234 } |