|
Lines 1-5
Link Here
|
| 1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
| 2 |
* Copyright (c) 2000, 2011 IBM Corporation and others. |
2 |
* Copyright (c) 2000, 2012 IBM Corporation and others. |
| 3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
|
Lines 25-31
Link Here
|
| 25 |
import org.eclipse.team.internal.ccvs.ui.Policy; |
25 |
import org.eclipse.team.internal.ccvs.ui.Policy; |
| 26 |
import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation; |
26 |
import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation; |
| 27 |
import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache; |
27 |
import org.eclipse.team.internal.ccvs.ui.operations.RemoteLogOperation.LogEntryCache; |
| 28 |
import org.eclipse.team.internal.ccvs.ui.tags.TagSource; |
|
|
| 29 |
|
28 |
|
| 30 |
public class RepositoryRoot extends PlatformObject { |
29 |
public class RepositoryRoot extends PlatformObject { |
| 31 |
|
30 |
|
|
Lines 34-41
Link Here
|
| 34 |
|
33 |
|
| 35 |
ICVSRepositoryLocation root; |
34 |
ICVSRepositoryLocation root; |
| 36 |
String name; |
35 |
String name; |
| 37 |
// Map of String (remote folder path) -> TagCacheEntry |
36 |
TagCacheEntry rootTagCacheEntry = new TagCacheEntry(Path.ROOT.toString(), |
| 38 |
Map versionAndBranchTags = new HashMap(); |
37 |
null); |
| 39 |
// Map of String (remote folder path) -> Set (file paths that are project relative) |
38 |
// Map of String (remote folder path) -> Set (file paths that are project relative) |
| 40 |
Map autoRefreshFiles = new HashMap(); |
39 |
Map autoRefreshFiles = new HashMap(); |
| 41 |
// Map of String (module name) -> ICVSRemoteFolder (that is a defined module) |
40 |
// Map of String (module name) -> ICVSRemoteFolder (that is a defined module) |
|
Lines 45-56
Link Here
|
| 45 |
List dateTags = new ArrayList(); |
44 |
List dateTags = new ArrayList(); |
| 46 |
|
45 |
|
| 47 |
public static class TagCacheEntry { |
46 |
public static class TagCacheEntry { |
|
|
47 |
String path; |
| 48 |
// Set of tags found for this path |
| 48 |
Set tags = new HashSet(); |
49 |
Set tags = new HashSet(); |
|
|
50 |
// String(last path segment) -> TagCacheEntry for child paths |
| 51 |
Map children = new HashMap(); |
| 52 |
TagCacheEntry parent; |
| 49 |
long lastAccessTime; |
53 |
long lastAccessTime; |
| 50 |
private static final int CACHE_LIFESPAN_IN_DAYS = 7; |
54 |
private static final int CACHE_LIFESPAN_IN_DAYS = 7; |
| 51 |
public TagCacheEntry() { |
55 |
|
| 52 |
accessed(); |
56 |
public TagCacheEntry(String path, TagCacheEntry parent) { |
| 53 |
} |
57 |
this.path = path; |
|
|
58 |
this.parent = parent; |
| 59 |
accessed(); |
| 60 |
} |
| 61 |
|
| 54 |
public boolean isExpired() { |
62 |
public boolean isExpired() { |
| 55 |
long currentTime = System.currentTimeMillis(); |
63 |
long currentTime = System.currentTimeMillis(); |
| 56 |
long ms = currentTime - lastAccessTime; |
64 |
long ms = currentTime - lastAccessTime; |
|
Lines 190-196
Link Here
|
| 190 |
* |
198 |
* |
| 191 |
* It is the responsibility of the caller to ensure that the given remote path is valid. |
199 |
* It is the responsibility of the caller to ensure that the given remote path is valid. |
| 192 |
*/ |
200 |
*/ |
| 193 |
public void addTags(String remotePath, CVSTag[] tags) { |
201 |
public void addTags(String remotePath, CVSTag[] tags) { |
|
|
202 |
if (tags.length == 0) { |
| 203 |
return; |
| 204 |
} |
| 194 |
addDateTags(tags); |
205 |
addDateTags(tags); |
| 195 |
addVersionAndBranchTags(remotePath, tags); |
206 |
addVersionAndBranchTags(remotePath, tags); |
| 196 |
} |
207 |
} |
|
Lines 203-224
Link Here
|
| 203 |
} |
214 |
} |
| 204 |
} |
215 |
} |
| 205 |
private void addVersionAndBranchTags(String remotePath, CVSTag[] tags) { |
216 |
private void addVersionAndBranchTags(String remotePath, CVSTag[] tags) { |
| 206 |
// Get the name to cache the version tags with |
217 |
TagCacheEntry entry = getTagCacheEntryFor(remotePath, true); |
| 207 |
String name = getCachePathFor(remotePath); |
218 |
entry.accessed(); |
| 208 |
|
219 |
|
| 209 |
// Make sure there is a table for the ancestor that holds the tags |
|
|
| 210 |
TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(name); |
| 211 |
if (entry == null) { |
| 212 |
entry = new TagCacheEntry(); |
| 213 |
versionAndBranchTags.put(name, entry); |
| 214 |
} else { |
| 215 |
entry.accessed(); |
| 216 |
} |
| 217 |
|
| 218 |
// Store the tag with the appropriate ancestor |
220 |
// Store the tag with the appropriate ancestor |
| 219 |
for (int i = 0; i < tags.length; i++) { |
221 |
for (int i = 0; i < tags.length; i++) { |
| 220 |
if(tags[i].getType() != CVSTag.DATE){ |
222 |
if (tags[i].getType() != CVSTag.DATE) { |
| 221 |
entry.tags.add(tags[i]); |
223 |
if (!getAllKnownTagsForParents(entry).contains(tags[i])) { |
|
|
224 |
removeTagFromChildrenCacheEntries(entry, tags[i], false); |
| 225 |
entry.tags.add(tags[i]); |
| 226 |
} |
| 222 |
} |
227 |
} |
| 223 |
} |
228 |
} |
| 224 |
} |
229 |
} |
|
Lines 264-283
Link Here
|
| 264 |
} |
269 |
} |
| 265 |
|
270 |
|
| 266 |
private void removeVersionAndBranchTags(String remotePath, CVSTag[] tags) { |
271 |
private void removeVersionAndBranchTags(String remotePath, CVSTag[] tags) { |
| 267 |
// Get the name to cache the version tags with |
272 |
TagCacheEntry entry = getTagCacheEntryFor(remotePath, false); |
| 268 |
String name = getCachePathFor(remotePath); |
273 |
// remove tags from this path and its children |
| 269 |
|
274 |
if (entry != null) { |
| 270 |
// Make sure there is a table for the ancestor that holds the tags |
275 |
removeTagsFromChildrenChacheEntries(entry, tags); |
| 271 |
TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(name); |
276 |
} |
| 272 |
if (entry == null) { |
277 |
|
|
|
278 |
// remove tags from all parents of this path |
| 279 |
entry = getKnownParentTagCacheEntryFor(remotePath); |
| 280 |
for (int i = 0; i < tags.length; i++) { |
| 281 |
TagCacheEntry currentEntry = entry; |
| 282 |
while (currentEntry != null) { |
| 283 |
if (currentEntry.tags.contains(tags[i])) { |
| 284 |
currentEntry.tags.remove(tags[i]); |
| 285 |
currentEntry.accessed(); |
| 286 |
break; |
| 287 |
} else { |
| 288 |
currentEntry = currentEntry.parent; |
| 289 |
} |
| 290 |
} |
| 291 |
} |
| 292 |
cleanEmptyParents(entry); |
| 293 |
} |
| 294 |
|
| 295 |
private void cleanEmptyParents(TagCacheEntry entry) { |
| 296 |
if (entry.parent == null) { |
| 297 |
// we don't remove the root cache entry |
| 273 |
return; |
298 |
return; |
| 274 |
} |
299 |
} |
| 275 |
|
300 |
if (entry.tags.isEmpty() && entry.children.isEmpty()) { |
| 276 |
// Store the tag with the appropriate ancestor |
301 |
entry.parent.children.remove(new Path(entry.path).lastSegment()); |
| 277 |
for (int i = 0; i < tags.length; i++) { |
302 |
entry.parent.accessed(); |
| 278 |
entry.tags.remove(tags[i]); |
|
|
| 279 |
} |
303 |
} |
| 280 |
entry.accessed(); |
304 |
cleanEmptyParents(entry.parent); |
| 281 |
} |
305 |
} |
| 282 |
|
306 |
|
| 283 |
/** |
307 |
/** |
|
Lines 287-294
Link Here
|
| 287 |
* @return String[] |
311 |
* @return String[] |
| 288 |
*/ |
312 |
*/ |
| 289 |
public String[] getAutoRefreshFiles(String remotePath) { |
313 |
public String[] getAutoRefreshFiles(String remotePath) { |
| 290 |
String name = getCachePathFor(remotePath); |
314 |
Set files = (Set) autoRefreshFiles.get(remotePath); |
| 291 |
Set files = (Set)autoRefreshFiles.get(name); |
|
|
| 292 |
if (files == null || files.isEmpty()) { |
315 |
if (files == null || files.isEmpty()) { |
| 293 |
// convert the default relative file paths to full paths |
316 |
// convert the default relative file paths to full paths |
| 294 |
if (isDefinedModuleName(remotePath)) { |
317 |
if (isDefinedModuleName(remotePath)) { |
|
Lines 324-367
Link Here
|
| 324 |
} |
347 |
} |
| 325 |
} |
348 |
} |
| 326 |
if (isDefault) { |
349 |
if (isDefault) { |
| 327 |
this.autoRefreshFiles.remove(getCachePathFor(remotePath)); |
350 |
this.autoRefreshFiles.remove(remotePath); |
| 328 |
return; |
351 |
return; |
| 329 |
} |
352 |
} |
| 330 |
} |
353 |
} |
| 331 |
this.autoRefreshFiles.put(getCachePathFor(remotePath), newFiles); |
354 |
this.autoRefreshFiles.put(remotePath, newFiles); |
| 332 |
} |
355 |
} |
| 333 |
|
356 |
|
| 334 |
/** |
357 |
/** |
| 335 |
* Fetches tags from auto-refresh files. |
358 |
* Fetches tags from auto-refresh files. |
| 336 |
*/ |
359 |
*/ |
| 337 |
public CVSTag[] refreshDefinedTags(ICVSFolder folder, boolean recurse, IProgressMonitor monitor) throws TeamException { |
360 |
public CVSTag[] refreshDefinedTags(ICVSFolder folder, boolean recurse, |
|
|
361 |
IProgressMonitor monitor) throws TeamException { |
| 338 |
monitor = Policy.monitorFor(monitor); |
362 |
monitor = Policy.monitorFor(monitor); |
| 339 |
monitor.beginTask(null, 100); |
363 |
monitor.beginTask(null, recurse ? 210 : 100); |
| 340 |
CVSTag[] tags = null; |
364 |
try { |
| 341 |
if (!recurse && !folder.getFolderSyncInfo().isVirtualDirectory()) { |
365 |
CVSTag[] tags = null; |
| 342 |
// Only try the auto-refresh file(s) if we are not recursing into sub-folders |
366 |
if (!folder.getFolderSyncInfo().isVirtualDirectory()) { |
| 343 |
tags = fetchTagsUsingAutoRefreshFiles(folder, Policy.subMonitorFor(monitor, 50)); |
367 |
// Only try the auto-refresh file(s) if we are not recursing |
| 344 |
} |
368 |
// into sub-folders |
| 345 |
if (tags == null || tags.length == 0) { |
369 |
tags = fetchTagsUsingAutoRefreshFiles(folder, |
| 346 |
// There we're no tags found on the auto-refresh files or we we're aksed to go deep |
370 |
Policy.subMonitorFor(monitor, 50)); |
| 347 |
// Try using the log command |
371 |
} |
| 348 |
tags = fetchTagsUsingLog(folder, recurse, Policy.subMonitorFor(monitor, 50)); |
372 |
if (tags == null || tags.length == 0) { |
| 349 |
} |
373 |
// There we're no tags found on the auto-refresh files or we |
| 350 |
if (tags != null && tags.length > 0) { |
374 |
// we're asked to go deep |
| 351 |
String remotePath = getRemotePathFor(folder); |
375 |
// Try using the log command |
| 352 |
addTags(remotePath, tags); |
376 |
tags = fetchTagsUsingLog(folder, |
|
|
377 |
Policy.subMonitorFor(monitor, 50)); |
| 378 |
} |
| 379 |
if (tags != null && tags.length > 0) { |
| 380 |
String remotePath = getRemotePathFor(folder); |
| 381 |
addTags(remotePath, tags); |
| 382 |
return tags; |
| 383 |
} |
| 384 |
if (recurse) { |
| 385 |
folder.fetchChildren(Policy.subMonitorFor(monitor, 10)); |
| 386 |
ICVSResource[] children = folder |
| 387 |
.members(ICVSFolder.FOLDER_MEMBERS); |
| 388 |
for (int i = 0; i < children.length; i++) { |
| 389 |
refreshDefinedTags( |
| 390 |
(ICVSFolder) children[i], |
| 391 |
recurse, |
| 392 |
Policy.subMonitorFor(monitor, 100 / children.length)); |
| 393 |
} |
| 394 |
} |
| 395 |
return tags; |
| 396 |
} finally { |
| 397 |
monitor.done(); |
| 353 |
} |
398 |
} |
| 354 |
monitor.done(); |
|
|
| 355 |
return tags; |
| 356 |
} |
399 |
} |
| 357 |
|
400 |
|
| 358 |
private CVSTag[] fetchTagsUsingLog(ICVSFolder folder, final boolean recurse, IProgressMonitor monitor) throws CVSException { |
401 |
private CVSTag[] fetchTagsUsingLog(ICVSFolder folder, IProgressMonitor monitor) throws CVSException { |
| 359 |
LogEntryCache logEntries = new LogEntryCache(); |
402 |
LogEntryCache logEntries = new LogEntryCache(); |
| 360 |
RemoteLogOperation operation = new RemoteLogOperation(null, new ICVSRemoteResource[] { asRemoteResource(folder) }, null, null, logEntries) { |
403 |
RemoteLogOperation operation = new RemoteLogOperation(null, new ICVSRemoteResource[] { asRemoteResource(folder) }, null, null, logEntries) { |
| 361 |
protected Command.LocalOption[] getLocalOptions(CVSTag tag1,CVSTag tag2) { |
404 |
protected Command.LocalOption[] getLocalOptions(CVSTag tag1,CVSTag tag2) { |
| 362 |
Command.LocalOption[] options = new Command.LocalOption[] {}; |
405 |
Command.LocalOption[] options = new Command.LocalOption[] {}; |
| 363 |
if (recurse) |
|
|
| 364 |
return options; |
| 365 |
Command.LocalOption[] newOptions = new Command.LocalOption[options.length + 1]; |
406 |
Command.LocalOption[] newOptions = new Command.LocalOption[options.length + 1]; |
| 366 |
System.arraycopy(options, 0, newOptions, 0, options.length); |
407 |
System.arraycopy(options, 0, newOptions, 0, options.length); |
| 367 |
newOptions[options.length] = Command.DO_NOT_RECURSE; |
408 |
newOptions[options.length] = Command.DO_NOT_RECURSE; |
|
Lines 443-465
Link Here
|
| 443 |
} |
484 |
} |
| 444 |
return (CVSTag[])tagSet.toArray(new CVSTag[0]); |
485 |
return (CVSTag[])tagSet.toArray(new CVSTag[0]); |
| 445 |
} |
486 |
} |
| 446 |
|
487 |
|
| 447 |
/** |
488 |
private TagCacheEntry getTagCacheEntryFor(String remotePath, boolean create) { |
| 448 |
* Return the cache key (path) for the given folder path. For root projects |
489 |
String[] segments = new Path(null, remotePath).segments(); |
| 449 |
* it returns the folder the project is mapped to as the tag source. For |
490 |
TagCacheEntry currentTagCacheEntry = rootTagCacheEntry; |
| 450 |
* non-root projects it returns only the first segment of the path because |
491 |
for (int i = 0; i < segments.length; i++) { |
| 451 |
* for the time being tag lists are kept for the remote ancestors of the |
492 |
String segment = segments[i]; |
| 452 |
* resource that is a direct child of the remote root. |
493 |
if (currentTagCacheEntry.children.containsKey(segment)) { |
| 453 |
* |
494 |
currentTagCacheEntry = (TagCacheEntry) currentTagCacheEntry.children |
| 454 |
* @see TagSource |
495 |
.get(segment); |
| 455 |
* @see #addTags(String, CVSTag[]) |
496 |
continue; |
| 456 |
* |
497 |
} |
| 457 |
* @param remotePath |
498 |
if (!create) { |
| 458 |
* the remote folder path |
499 |
return null; |
| 459 |
* @return the cache key (path) for the given folder path |
500 |
} |
| 460 |
*/ |
501 |
TagCacheEntry newTagCacheEntry = new TagCacheEntry(new Path(null, |
| 461 |
private String getCachePathFor(String remotePath) { |
502 |
remotePath).removeLastSegments(segments.length - (i + 1)) |
| 462 |
return new Path(null, remotePath).segment(0); |
503 |
.toString(), currentTagCacheEntry); |
|
|
504 |
currentTagCacheEntry.children.put(segment, newTagCacheEntry); |
| 505 |
currentTagCacheEntry = newTagCacheEntry; |
| 506 |
} |
| 507 |
return currentTagCacheEntry; |
| 508 |
} |
| 509 |
|
| 510 |
private TagCacheEntry getKnownParentTagCacheEntryFor(String remotePath) { |
| 511 |
String[] segments = new Path(null, remotePath).segments(); |
| 512 |
TagCacheEntry currentTagCacheEntry = rootTagCacheEntry; |
| 513 |
for (int i = 0; i < segments.length; i++) { |
| 514 |
String segment = segments[i]; |
| 515 |
if (currentTagCacheEntry.children.containsKey(segment)) { |
| 516 |
currentTagCacheEntry = (TagCacheEntry) currentTagCacheEntry.children |
| 517 |
.get(segment); |
| 518 |
} else { |
| 519 |
break; // we reached the last existing parent |
| 520 |
} |
| 521 |
} |
| 522 |
return currentTagCacheEntry; |
| 523 |
} |
| 524 |
|
| 525 |
private void removeTagsFromChildrenChacheEntries(TagCacheEntry entry, |
| 526 |
CVSTag[] tags) { |
| 527 |
for (int i = 0; i < tags.length; i++) { |
| 528 |
removeTagFromChildrenCacheEntries(entry, tags[i], true); |
| 529 |
} |
| 530 |
} |
| 531 |
|
| 532 |
private void removeTagFromChildrenCacheEntries(TagCacheEntry entry, |
| 533 |
CVSTag tag, boolean includeThisEntry) { |
| 534 |
Iterator childrenIterator = entry.children.values().iterator(); |
| 535 |
while (childrenIterator.hasNext()) { |
| 536 |
TagCacheEntry child = (TagCacheEntry) childrenIterator.next(); |
| 537 |
removeTagFromChildrenCacheEntries(child, tag, true); |
| 538 |
} |
| 539 |
if (includeThisEntry) { |
| 540 |
entry.tags.remove(tag); |
| 541 |
entry.accessed(); |
| 542 |
if (entry.tags.size() == 0 && entry.children.size() == 0 |
| 543 |
&& entry.parent != null) { |
| 544 |
// remove this entry when the last tag was removed |
| 545 |
// keep the entry if there are any children that have tags |
| 546 |
Map newParentChildren = new HashMap(); |
| 547 |
newParentChildren.putAll(entry.parent.children); |
| 548 |
newParentChildren.remove(new Path(entry.path).lastSegment()); |
| 549 |
entry.parent.children = newParentChildren; |
| 550 |
} |
| 551 |
} |
| 463 |
} |
552 |
} |
| 464 |
|
553 |
|
| 465 |
/** |
554 |
/** |
|
Lines 504-510
Link Here
|
| 504 |
attributes.put(RepositoriesViewContentHandler.TYPE_ATTRIBUTE, RepositoriesViewContentHandler.DEFINED_MODULE_TYPE); |
593 |
attributes.put(RepositoriesViewContentHandler.TYPE_ATTRIBUTE, RepositoriesViewContentHandler.DEFINED_MODULE_TYPE); |
| 505 |
} |
594 |
} |
| 506 |
attributes.put(RepositoriesViewContentHandler.PATH_ATTRIBUTE, name); |
595 |
attributes.put(RepositoriesViewContentHandler.PATH_ATTRIBUTE, name); |
| 507 |
TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(path); |
596 |
TagCacheEntry entry = (TagCacheEntry) getTagCacheEntryFor(path, |
|
|
597 |
false); |
| 508 |
boolean writeOutTags = entry != null && !entry.isExpired(); |
598 |
boolean writeOutTags = entry != null && !entry.isExpired(); |
| 509 |
if (writeOutTags) |
599 |
if (writeOutTags) |
| 510 |
attributes.put(RepositoriesViewContentHandler.LAST_ACCESS_TIME_ATTRIBUTE, Long.toString(entry.lastAccessTime)); |
600 |
attributes.put(RepositoriesViewContentHandler.LAST_ACCESS_TIME_ATTRIBUTE, Long.toString(entry.lastAccessTime)); |
|
Lines 538-571
Link Here
|
| 538 |
writer.startAndEndTag(s, attributes, true); |
628 |
writer.startAndEndTag(s, attributes, true); |
| 539 |
} |
629 |
} |
| 540 |
|
630 |
|
|
|
631 |
private Set getAllKnownTagsForParents(TagCacheEntry entry) { |
| 632 |
Set tags = new HashSet(); |
| 633 |
if (entry.parent != null) { |
| 634 |
tags.addAll(getAllKnownTagsForParents(entry.parent)); |
| 635 |
} |
| 636 |
tags.addAll(entry.tags); |
| 637 |
return tags; |
| 638 |
} |
| 639 |
|
| 640 |
private Set getAllKnownTagsForChildren(TagCacheEntry entry) { |
| 641 |
Set tags = new HashSet(); |
| 642 |
Iterator childrenIterator = entry.children.values().iterator(); |
| 643 |
while (childrenIterator.hasNext()) { |
| 644 |
TagCacheEntry child = (TagCacheEntry) childrenIterator.next(); |
| 645 |
tags.addAll(getAllKnownTagsForChildren(child)); |
| 646 |
} |
| 647 |
tags.addAll(entry.tags); |
| 648 |
return tags; |
| 649 |
} |
| 650 |
|
| 541 |
/** |
651 |
/** |
| 542 |
* Method getKnownTags. |
652 |
* Method getKnownTags. |
| 543 |
* @param remotePath |
653 |
* @param remotePath |
| 544 |
* @return CVSTag[] |
654 |
* @return CVSTag[] |
| 545 |
*/ |
655 |
*/ |
| 546 |
public CVSTag[] getAllKnownTags(String remotePath) { |
656 |
public CVSTag[] getAllKnownTags(String remotePath) { |
| 547 |
TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(getCachePathFor(remotePath)); |
657 |
Set tags = getAllKnownTagsForParents(getKnownParentTagCacheEntryFor(remotePath)); |
| 548 |
if(entry != null){ |
658 |
TagCacheEntry entry = getTagCacheEntryFor(remotePath, false); |
| 549 |
entry.accessed(); |
659 |
if (entry != null) { |
| 550 |
CVSTag [] tags1 = (CVSTag[]) entry.tags.toArray(new CVSTag[entry.tags.size()]); |
660 |
tags.addAll(getAllKnownTagsForChildren(entry)); |
| 551 |
CVSTag[] tags2 = getDateTags(); |
|
|
| 552 |
int len = tags1.length + tags2.length; |
| 553 |
CVSTag[] tags = new CVSTag[len]; |
| 554 |
for(int i = 0; i < len; i++){ |
| 555 |
if(i < tags1.length){ |
| 556 |
tags[i] = tags1[i]; |
| 557 |
}else{ |
| 558 |
tags[i] = tags2[i-tags1.length]; |
| 559 |
} |
| 560 |
} |
| 561 |
return tags; |
| 562 |
} |
661 |
} |
| 563 |
return getDateTags(); |
662 |
return (CVSTag[]) tags.toArray(new CVSTag[tags.size()]); |
| 564 |
} |
663 |
} |
| 565 |
|
664 |
|
| 566 |
public String[] getKnownRemotePaths() { |
665 |
public CVSTag[] getAllKnownTags() { |
|
|
666 |
Set tags = getAllKnownTagsForChildren(rootTagCacheEntry); |
| 667 |
return (CVSTag[]) tags.toArray(new CVSTag[tags.size()]); |
| 668 |
} |
| 669 |
|
| 670 |
public String[] getRemoteChildrenForTag(String remotePath, CVSTag tag) { |
| 671 |
TagCacheEntry entry; |
| 672 |
if (remotePath == null) { |
| 673 |
entry = rootTagCacheEntry; |
| 674 |
} else { |
| 675 |
entry = getTagCacheEntryFor(remotePath, false); |
| 676 |
} |
| 677 |
if (entry == null) { |
| 678 |
return new String[0]; |
| 679 |
} |
| 680 |
|
| 567 |
Set paths = new HashSet(); |
681 |
Set paths = new HashSet(); |
| 568 |
paths.addAll(versionAndBranchTags.keySet()); |
682 |
Iterator childrenIterator = entry.children.values().iterator(); |
|
|
683 |
while (childrenIterator.hasNext()) { |
| 684 |
TagCacheEntry child = (TagCacheEntry) childrenIterator.next(); |
| 685 |
if (getAllKnownTagsForChildren(child).contains(tag)) { |
| 686 |
paths.add(child.path); |
| 687 |
} |
| 688 |
} |
| 689 |
return (String[]) paths.toArray(new String[paths.size()]); |
| 690 |
} |
| 691 |
|
| 692 |
private Set getKnownRemotePaths(TagCacheEntry root) { |
| 693 |
Set paths = new HashSet(); |
| 694 |
Iterator childrenIterator = root.children.values().iterator(); |
| 695 |
while(childrenIterator.hasNext()){ |
| 696 |
paths.addAll(getKnownRemotePaths((TagCacheEntry) childrenIterator.next())); |
| 697 |
} |
| 698 |
paths.add(root.path); |
| 699 |
return paths; |
| 700 |
|
| 701 |
} |
| 702 |
public String[] getKnownRemotePaths() { |
| 703 |
Set paths = getKnownRemotePaths(rootTagCacheEntry); |
| 569 |
paths.addAll(autoRefreshFiles.keySet()); |
704 |
paths.addAll(autoRefreshFiles.keySet()); |
| 570 |
return (String[]) paths.toArray(new String[paths.size()]); |
705 |
return (String[]) paths.toArray(new String[paths.size()]); |
| 571 |
} |
706 |
} |
|
Lines 585-591
Link Here
|
| 585 |
public boolean tagIsKnown(ICVSRemoteResource remoteResource) { |
720 |
public boolean tagIsKnown(ICVSRemoteResource remoteResource) { |
| 586 |
if (remoteResource instanceof ICVSRemoteFolder) { |
721 |
if (remoteResource instanceof ICVSRemoteFolder) { |
| 587 |
ICVSRemoteFolder folder = (ICVSRemoteFolder) remoteResource; |
722 |
ICVSRemoteFolder folder = (ICVSRemoteFolder) remoteResource; |
| 588 |
String path = getCachePathFor(folder.getRepositoryRelativePath()); |
723 |
String path = folder.getRepositoryRelativePath(); |
| 589 |
CVSTag[] tags = getAllKnownTags(path); |
724 |
CVSTag[] tags = getAllKnownTags(path); |
| 590 |
CVSTag tag = folder.getTag(); |
725 |
CVSTag tag = folder.getTag(); |
| 591 |
for (int i = 0; i < tags.length; i++) { |
726 |
for (int i = 0; i < tags.length; i++) { |
|
Lines 620-626
Link Here
|
| 620 |
* as it was read from the persistent store. |
755 |
* as it was read from the persistent store. |
| 621 |
*/ |
756 |
*/ |
| 622 |
/* package */ void setLastAccessedTime(String remotePath, long lastAccessTime) { |
757 |
/* package */ void setLastAccessedTime(String remotePath, long lastAccessTime) { |
| 623 |
TagCacheEntry entry = (TagCacheEntry)versionAndBranchTags.get(getCachePathFor(remotePath)); |
758 |
TagCacheEntry entry = getTagCacheEntryFor(remotePath, false); |
| 624 |
if(entry != null){ |
759 |
if(entry != null){ |
| 625 |
entry.lastAccessTime = lastAccessTime; |
760 |
entry.lastAccessTime = lastAccessTime; |
| 626 |
} |
761 |
} |