Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/StatusCollector.java @ 88:61eedab3eb3e
Status between two revisions to recognize copy/rename
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 26 Jan 2011 05:46:47 +0100 |
parents | 6f1b88693d48 |
children | 42bcb4bffd17 |
comparison
equal
deleted
inserted
replaced
87:25f2e5d1cd8b | 88:61eedab3eb3e |
---|---|
27 import java.util.List; | 27 import java.util.List; |
28 import java.util.Map; | 28 import java.util.Map; |
29 import java.util.TreeSet; | 29 import java.util.TreeSet; |
30 | 30 |
31 import org.tmatesoft.hg.core.Nodeid; | 31 import org.tmatesoft.hg.core.Nodeid; |
32 import org.tmatesoft.hg.core.Path; | |
32 | 33 |
33 | 34 |
34 /** | 35 /** |
35 * RevisionWalker? | 36 * RevisionWalker? |
36 * | 37 * |
122 inspector.clean(fname); | 123 inspector.clean(fname); |
123 } else { | 124 } else { |
124 inspector.modified(fname); | 125 inspector.modified(fname); |
125 } | 126 } |
126 } else { | 127 } else { |
127 inspector.added(fname); | 128 HgDataFile df = repo.getFileNode(fname); |
129 boolean isCopy = false; | |
130 while (df.isCopy()) { | |
131 Path original = df.getCopySourceName(); | |
132 if (r1Files.contains(original.toString())) { | |
133 df = repo.getFileNode(original); | |
134 int changelogRevision = df.getChangesetLocalRevision(0); | |
135 if (changelogRevision <= rev1) { | |
136 // copy/rename source was known prior to rev1 | |
137 // (both r1Files.contains is true and original was created earlier than rev1) | |
138 // without r1Files.contains changelogRevision <= rev1 won't suffice as the file | |
139 // might get removed somewhere in between (changelogRevision < R < rev1) | |
140 inspector.copied(original.toString(), fname); | |
141 isCopy = true; | |
142 } | |
143 break; | |
144 } | |
145 df = repo.getFileNode(original); // try more steps away | |
146 } | |
147 if (!isCopy) { | |
148 inspector.added(fname); | |
149 } | |
128 } | 150 } |
129 } | 151 } |
130 for (String left : r1Files) { | 152 for (String left : r1Files) { |
131 inspector.removed(left); | 153 inspector.removed(left); |
132 } | 154 } |