comparison src/org/tmatesoft/hg/core/HgChangeset.java @ 316:ee6b467c1a5f

Supply HGFileRevision with copy information when possible, calculate it otherwise
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 28 Sep 2011 13:09:16 +0200
parents 9fb50c04f03c
children 189dc6dc1c3e
comparison
equal deleted inserted replaced
315:8952f89be195 316:ee6b467c1a5f
17 package org.tmatesoft.hg.core; 17 package org.tmatesoft.hg.core;
18 18
19 import java.util.ArrayList; 19 import java.util.ArrayList;
20 import java.util.Collections; 20 import java.util.Collections;
21 import java.util.List; 21 import java.util.List;
22 import java.util.Map;
22 23
23 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; 24 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
24 import org.tmatesoft.hg.repo.HgChangelog; 25 import org.tmatesoft.hg.repo.HgChangelog;
25 import org.tmatesoft.hg.repo.HgRepository; 26 import org.tmatesoft.hg.repo.HgRepository;
26 import org.tmatesoft.hg.repo.HgStatusCollector; 27 import org.tmatesoft.hg.repo.HgStatusCollector;
193 for (Path s : r.getModified()) { 194 for (Path s : r.getModified()) {
194 Nodeid nid = r.nodeidAfterChange(s); 195 Nodeid nid = r.nodeidAfterChange(s);
195 if (nid == null) { 196 if (nid == null) {
196 throw new HgBadStateException(); 197 throw new HgBadStateException();
197 } 198 }
198 modified.add(new HgFileRevision(repo, nid, s)); 199 modified.add(new HgFileRevision(repo, nid, s, null));
199 } 200 }
201 final Map<Path, Path> copied = r.getCopied();
200 for (Path s : r.getAdded()) { 202 for (Path s : r.getAdded()) {
201 Nodeid nid = r.nodeidAfterChange(s); 203 Nodeid nid = r.nodeidAfterChange(s);
202 if (nid == null) { 204 if (nid == null) {
203 throw new HgBadStateException(); 205 throw new HgBadStateException();
204 } 206 }
205 added.add(new HgFileRevision(repo, nid, s)); 207 added.add(new HgFileRevision(repo, nid, s, copied.get(s)));
206 } 208 }
207 for (Path s : r.getRemoved()) { 209 for (Path s : r.getRemoved()) {
208 // with Path from getRemoved, may just copy 210 // with Path from getRemoved, may just copy
209 deleted.add(s); 211 deleted.add(s);
210 } 212 }