Mercurial > jhg
comparison src/org/tmatesoft/hg/core/HgFileInformer.java @ 415:ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 22 Mar 2012 18:54:11 +0100 |
parents | 0ae53c32ecef |
children | ccd7d25e5aea |
comparison
equal
deleted
inserted
replaced
414:bb278ccf9866 | 415:ee8264d80747 |
---|---|
16 */ | 16 */ |
17 package org.tmatesoft.hg.core; | 17 package org.tmatesoft.hg.core; |
18 | 18 |
19 import org.tmatesoft.hg.internal.ManifestRevision; | 19 import org.tmatesoft.hg.internal.ManifestRevision; |
20 import org.tmatesoft.hg.repo.HgDataFile; | 20 import org.tmatesoft.hg.repo.HgDataFile; |
21 import org.tmatesoft.hg.repo.HgManifest; | |
21 import org.tmatesoft.hg.repo.HgRepository; | 22 import org.tmatesoft.hg.repo.HgRepository; |
22 import org.tmatesoft.hg.util.Path; | 23 import org.tmatesoft.hg.util.Path; |
23 import org.tmatesoft.hg.util.Status; | 24 import org.tmatesoft.hg.util.Status; |
24 | 25 |
25 /** | 26 /** |
119 if (!dataFile.exists()) { | 120 if (!dataFile.exists()) { |
120 checkResult = new Status(Status.Kind.OK, String.format("File named %s is not known in the repository", file)); | 121 checkResult = new Status(Status.Kind.OK, String.format("File named %s is not known in the repository", file)); |
121 return checkResult; | 122 return checkResult; |
122 } | 123 } |
123 Nodeid toExtract = null; | 124 Nodeid toExtract = null; |
125 HgManifest.Flags extractRevFlags = null; | |
124 String phaseMsg = "Extract manifest revision failed"; | 126 String phaseMsg = "Extract manifest revision failed"; |
125 try { | 127 try { |
126 if (cachedManifest == null) { | 128 if (cachedManifest == null) { |
127 int csetRev = repo.getChangelog().getRevisionIndex(cset); | 129 int csetRev = repo.getChangelog().getRevisionIndex(cset); |
128 cachedManifest = new ManifestRevision(null, null); // XXX how about context and cached manifest revisions | 130 cachedManifest = new ManifestRevision(null, null); // XXX how about context and cached manifest revisions |
129 repo.getManifest().walk(csetRev, csetRev, cachedManifest); | 131 repo.getManifest().walk(csetRev, csetRev, cachedManifest); |
130 // cachedManifest shall be meaningful - changelog.getRevisionIndex() above ensures we've got version that exists. | 132 // cachedManifest shall be meaningful - changelog.getRevisionIndex() above ensures we've got version that exists. |
131 } | 133 } |
132 toExtract = cachedManifest.nodeid(file); | 134 toExtract = cachedManifest.nodeid(file); |
135 extractRevFlags = cachedManifest.flags(file); | |
133 phaseMsg = "Follow copy/rename failed"; | 136 phaseMsg = "Follow copy/rename failed"; |
134 if (toExtract == null && followRenames) { | 137 if (toExtract == null && followRenames) { |
135 while (toExtract == null && dataFile.isCopy()) { | 138 while (toExtract == null && dataFile.isCopy()) { |
136 renamed = true; | 139 renamed = true; |
137 file = dataFile.getCopySourceName(); | 140 file = dataFile.getCopySourceName(); |
138 dataFile = repo.getFileNode(file); | 141 dataFile = repo.getFileNode(file); |
139 toExtract = cachedManifest.nodeid(file); | 142 toExtract = cachedManifest.nodeid(file); |
143 extractRevFlags = cachedManifest.flags(file); | |
140 } | 144 } |
141 } | 145 } |
142 } catch (HgException ex) { | 146 } catch (HgException ex) { |
143 checkResult = new Status(Status.Kind.ERROR, phaseMsg, ex); | 147 checkResult = new Status(Status.Kind.ERROR, phaseMsg, ex); |
144 return checkResult; | 148 return checkResult; |
145 } | 149 } |
146 if (toExtract != null) { | 150 if (toExtract != null) { |
147 fileRevision = new HgFileRevision(repo, toExtract, dataFile.getPath()); | 151 fileRevision = new HgFileRevision(repo, toExtract, extractRevFlags, dataFile.getPath()); |
148 checkResult = new Status(Status.Kind.OK, String.format("File %s, revision %s found at changeset %s", dataFile.getPath(), toExtract.shortNotation(), cset.shortNotation())); | 152 checkResult = new Status(Status.Kind.OK, String.format("File %s, revision %s found at changeset %s", dataFile.getPath(), toExtract.shortNotation(), cset.shortNotation())); |
149 return checkResult; | 153 return checkResult; |
150 } | 154 } |
151 checkResult = new Status(Status.Kind.OK, String.format("File %s nor its origins were known at repository %s revision", file, cset.shortNotation())); | 155 checkResult = new Status(Status.Kind.OK, String.format("File %s nor its origins were known at repository %s revision", file, cset.shortNotation())); |
152 return checkResult; | 156 return checkResult; |