/* (non-Javadoc)
  * @see java.lang.Object#equals(java.lang.Object)
  */
 public boolean equals(Object other) {
   if (this == other) return true;
   if (!(other instanceof CVSCompareSubscriber)) return false;
   CVSCompareSubscriber s = (CVSCompareSubscriber) other;
   CVSResourceVariantTree tree1 = (CVSResourceVariantTree) getRemoteTree();
   CVSResourceVariantTree tree2 = (CVSResourceVariantTree) s.getRemoteTree();
   IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
   CVSTag tag1 = tree1.getTag(root);
   CVSTag tag2 = tree2.getTag(root);
   if (tag1 == null || tag2 == null) return false;
   return tag1.equals(tag2) && rootsEqual(s);
 }
Beispiel #2
0
  /** Get the list of known branch tags for a given remote root. */
  public CVSTag[] getKnownTags(ICVSFolder project, int tagType) {
    try {
      CVSTag[] tags = getKnownTags(project);
      Set result = new HashSet();
      for (int i = 0; i < tags.length; i++) {
        CVSTag tag = tags[i];
        if (tag.getType() == tagType) result.add(tag);
      }

      return (CVSTag[]) result.toArray(new CVSTag[result.size()]);
    } catch (CVSException e) {
      CVSUIPlugin.log(e);
      return new CVSTag[0];
    }
  }
Beispiel #3
0
 public ICVSRemoteResource[] getFoldersForTag(
     ICVSRepositoryLocation location, CVSTag tag, IProgressMonitor monitor) throws CVSException {
   monitor = Policy.monitorFor(monitor);
   try {
     monitor.beginTask(
         NLS.bind(
             CVSUIMessages.RepositoryManager_fetchingRemoteFolders, new String[] {tag.getName()}),
         100);
     if (tag.getType() == CVSTag.HEAD) {
       ICVSRemoteResource[] resources =
           location.members(tag, false, Policy.subMonitorFor(monitor, 60));
       RepositoryRoot root = getRepositoryRootFor(location);
       ICVSRemoteResource[] modules =
           root.getDefinedModules(tag, Policy.subMonitorFor(monitor, 40));
       ICVSRemoteResource[] result = new ICVSRemoteResource[resources.length + modules.length];
       System.arraycopy(resources, 0, result, 0, resources.length);
       System.arraycopy(modules, 0, result, resources.length, modules.length);
       return result;
     }
     if (tag.getType() == CVSTag.DATE) {
       ICVSRemoteResource[] resources =
           location.members(tag, false, Policy.subMonitorFor(monitor, 60));
       RepositoryRoot root = getRepositoryRootFor(location);
       ICVSRemoteResource[] modules =
           root.getDefinedModules(tag, Policy.subMonitorFor(monitor, 40));
       ICVSRemoteResource[] result = new ICVSRemoteResource[resources.length + modules.length];
       System.arraycopy(resources, 0, result, 0, resources.length);
       System.arraycopy(modules, 0, result, resources.length, modules.length);
       return result;
     }
     Set result = new HashSet();
     // Get the tags for the location
     RepositoryRoot root = getRepositoryRootFor(location);
     String[] paths = root.getKnownRemotePaths();
     for (int i = 0; i < paths.length; i++) {
       String path = paths[i];
       List tags = Arrays.asList(root.getAllKnownTags(path));
       if (tags.contains(tag)) {
         ICVSRemoteFolder remote =
             root.getRemoteFolder(path, tag, Policy.subMonitorFor(monitor, 100));
         result.add(remote);
       }
     }
     return (ICVSRemoteResource[]) result.toArray(new ICVSRemoteResource[result.size()]);
   } finally {
     monitor.done();
   }
 }
Beispiel #4
0
 /** Get the list of known version tags for a given project. */
 public CVSTag[] getKnownTags(ICVSRepositoryLocation location, int tagType) {
   Set result = new HashSet();
   RepositoryRoot root = (RepositoryRoot) repositoryRoots.get(location.getLocation(false));
   if (root != null) {
     String[] paths = root.getKnownRemotePaths();
     for (int i = 0; i < paths.length; i++) {
       String path = paths[i];
       CVSTag[] tags = root.getAllKnownTags(path);
       for (int j = 0; j < tags.length; j++) {
         CVSTag tag = tags[j];
         if (tag.getType() == tagType) result.add(tag);
       }
     }
   }
   return (CVSTag[]) result.toArray(new CVSTag[0]);
 }
 public CVSCompareSubscriber(IResource[] resources, CVSTag tag) {
   super(
       getUniqueId(),
       NLS.bind(CVSMessages.CVSCompareSubscriber_2, new String[] {tag.getName()})); //
   this.resources = resources;
   tree =
       new CVSResourceVariantTree(
           new SessionResourceVariantByteStore(), tag, getCacheFileContentsHint());
   initialize();
 }