@Nullable
  private String getLastMergedRevision(final SVNRevision rev2, final SVNURL svnURL2) {
    if (!rev2.isValid() || rev2.isLocal()) {
      return null;
    } else {
      final long number = rev2.getNumber();
      if (number > 0) {
        return String.valueOf(number);
      } else {

        SVNRepository repos = null;
        try {
          repos = myVcs.createRepository(svnURL2.toString());
          final long latestRev = repos.getLatestRevision();
          return String.valueOf(latestRev);
        } catch (SVNException e) {
          return null;
        } finally {
          if (repos != null) {
            repos.closeSession();
          }
        }
      }
    }
  }
 private int compareRevisions(
     @NonNls final SVNRevision revision1, @NonNls final SVNRevision revision2) {
   if (revision1.equals(revision2)) {
     return 0;
   }
   // working(local) ahead of head
   if (SVNRevision.WORKING.equals(revision1)) {
     return 1;
   }
   if (SVNRevision.WORKING.equals(revision2)) {
     return -1;
   }
   if (SVNRevision.HEAD.equals(revision1)) {
     return 1;
   }
   if (SVNRevision.HEAD.equals(revision2)) {
     return -1;
   }
   return revision1.getNumber() > revision2.getNumber() ? 1 : -1;
 }
Пример #3
0
 /**
  * Compares this object with another <b>SVNRevision</b> object.
  *
  * @param o an object to be compared with; if it's not an <b>SVNRevision</b> then this method
  *     certainly returns <span class="javakeyword">false</span>
  * @return <span class="javakeyword">true</span> if equal, otherwise <span
  *     class="javakeyword">false</span>
  */
 public boolean equals(Object o) {
   if (o == null || o.getClass() != SVNRevision.class) {
     return false;
   }
   SVNRevision r = (SVNRevision) o;
   if (myRevision >= 0) {
     return myRevision == r.getNumber();
   } else if (myDate != null) {
     return myDate.equals(r.getDate());
   } else if (myName != null) {
     return myName.equals(r.getName());
   }
   return !r.isValid();
 }