Mercurial > hg4j
comparison src/org/tmatesoft/hg/core/HgChangeset.java @ 231:1792b37650f2
Introduced access to conflict resolution information (merge state)
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 01 Jun 2011 05:44:25 +0200 |
parents | 644ee58c9f16 |
children | 9fb50c04f03c |
comparison
equal
deleted
inserted
replaced
230:0dd9da7489dc | 231:1792b37650f2 |
---|---|
20 | 20 |
21 import java.util.ArrayList; | 21 import java.util.ArrayList; |
22 import java.util.Collections; | 22 import java.util.Collections; |
23 import java.util.List; | 23 import java.util.List; |
24 | 24 |
25 import org.tmatesoft.hg.core.HgLogCommand.FileRevision; | |
26 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; | 25 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; |
27 import org.tmatesoft.hg.repo.HgChangelog; | 26 import org.tmatesoft.hg.repo.HgChangelog; |
28 import org.tmatesoft.hg.repo.HgRepository; | 27 import org.tmatesoft.hg.repo.HgRepository; |
29 import org.tmatesoft.hg.repo.HgStatusCollector; | 28 import org.tmatesoft.hg.repo.HgStatusCollector; |
30 import org.tmatesoft.hg.util.Path; | 29 import org.tmatesoft.hg.util.Path; |
47 // | 46 // |
48 private RawChangeset changeset; | 47 private RawChangeset changeset; |
49 private Nodeid nodeid; | 48 private Nodeid nodeid; |
50 | 49 |
51 // | 50 // |
52 private List<FileRevision> modifiedFiles, addedFiles; | 51 private List<HgFileRevision> modifiedFiles, addedFiles; |
53 private List<Path> deletedFiles; | 52 private List<Path> deletedFiles; |
54 private int revNumber; | 53 private int revNumber; |
55 private byte[] parent1, parent2; | 54 private byte[] parent1, parent2; |
56 | 55 |
57 // XXX consider CommandContext with StatusCollector, PathPool etc. Commands optionally get CC through a cons or create new | 56 // XXX consider CommandContext with StatusCollector, PathPool etc. Commands optionally get CC through a cons or create new |
116 rv.add(pathHelper.path(name)); | 115 rv.add(pathHelper.path(name)); |
117 } | 116 } |
118 return rv; | 117 return rv; |
119 } | 118 } |
120 | 119 |
121 public List<FileRevision> getModifiedFiles() { | 120 public List<HgFileRevision> getModifiedFiles() { |
122 if (modifiedFiles == null) { | 121 if (modifiedFiles == null) { |
123 initFileChanges(); | 122 initFileChanges(); |
124 } | 123 } |
125 return modifiedFiles; | 124 return modifiedFiles; |
126 } | 125 } |
127 | 126 |
128 public List<FileRevision> getAddedFiles() { | 127 public List<HgFileRevision> getAddedFiles() { |
129 if (addedFiles == null) { | 128 if (addedFiles == null) { |
130 initFileChanges(); | 129 initFileChanges(); |
131 } | 130 } |
132 return addedFiles; | 131 return addedFiles; |
133 } | 132 } |
180 } | 179 } |
181 } | 180 } |
182 | 181 |
183 private /*synchronized*/ void initFileChanges() { | 182 private /*synchronized*/ void initFileChanges() { |
184 ArrayList<Path> deleted = new ArrayList<Path>(); | 183 ArrayList<Path> deleted = new ArrayList<Path>(); |
185 ArrayList<FileRevision> modified = new ArrayList<FileRevision>(); | 184 ArrayList<HgFileRevision> modified = new ArrayList<HgFileRevision>(); |
186 ArrayList<FileRevision> added = new ArrayList<FileRevision>(); | 185 ArrayList<HgFileRevision> added = new ArrayList<HgFileRevision>(); |
187 HgStatusCollector.Record r = new HgStatusCollector.Record(); | 186 HgStatusCollector.Record r = new HgStatusCollector.Record(); |
188 statusHelper.change(revNumber, r); | 187 statusHelper.change(revNumber, r); |
189 final HgRepository repo = statusHelper.getRepo(); | 188 final HgRepository repo = statusHelper.getRepo(); |
190 for (Path s : r.getModified()) { | 189 for (Path s : r.getModified()) { |
191 Nodeid nid = r.nodeidAfterChange(s); | 190 Nodeid nid = r.nodeidAfterChange(s); |
192 if (nid == null) { | 191 if (nid == null) { |
193 throw new HgBadStateException(); | 192 throw new HgBadStateException(); |
194 } | 193 } |
195 modified.add(new FileRevision(repo, nid, s)); | 194 modified.add(new HgFileRevision(repo, nid, s)); |
196 } | 195 } |
197 for (Path s : r.getAdded()) { | 196 for (Path s : r.getAdded()) { |
198 Nodeid nid = r.nodeidAfterChange(s); | 197 Nodeid nid = r.nodeidAfterChange(s); |
199 if (nid == null) { | 198 if (nid == null) { |
200 throw new HgBadStateException(); | 199 throw new HgBadStateException(); |
201 } | 200 } |
202 added.add(new FileRevision(repo, nid, s)); | 201 added.add(new HgFileRevision(repo, nid, s)); |
203 } | 202 } |
204 for (Path s : r.getRemoved()) { | 203 for (Path s : r.getRemoved()) { |
205 // with Path from getRemoved, may just copy | 204 // with Path from getRemoved, may just copy |
206 deleted.add(s); | 205 deleted.add(s); |
207 } | 206 } |