The new format of lock info is recognized. BLD200310281900
authormentlicher@netbeans.org
Mon, 27 Oct 2003 17:33:02 +0000
changeset 3603327fdc52d96f
parent 3602 0bee06da924a
child 3604 90a995fcd141
The new format of lock info is recognized.
This is a partial fix of issue #36819.
vcs.profiles.pvcs/src/org/netbeans/modules/vcs/profiles/pvcs/list/PvcsListCommand.java
     1.1 --- a/vcs.profiles.pvcs/src/org/netbeans/modules/vcs/profiles/pvcs/list/PvcsListCommand.java	Mon Oct 27 17:31:17 2003 +0000
     1.2 +++ b/vcs.profiles.pvcs/src/org/netbeans/modules/vcs/profiles/pvcs/list/PvcsListCommand.java	Mon Oct 27 17:33:02 2003 +0000
     1.3 @@ -53,6 +53,10 @@
     1.4      private static final String ENTITY_NAME = "Name="; // NOI18N
     1.5      private static final String ARCHIVE_PATH = "ArchivePath="; // NOI18N
     1.6      private static final String ARCHIVE_LOCK_INFO = "Archive:LockInfo=["; // NOI18N
     1.7 +    private static final String LOCK_INFO_LOCKED_REVISION = "Locked Revision:"; // NOI18N
     1.8 +    private static final String LOCK_INFO_NEW_REVISION = "New Revision:"; // NOI18N
     1.9 +    private static final String LOCK_INFO_LOCKED_BY = "Locked By:"; // NOI18N
    1.10 +    private static final String LOCK_INFO_END = "]"; // NOI18N
    1.11      private static final String LOCKS_SEPARATOR = " : "; // NOI18N
    1.12      
    1.13      private static final String MISSING_STATUS = "Missing"; // NOI18N
    1.14 @@ -292,6 +296,7 @@
    1.15      private boolean folder = false;
    1.16      private String lastFile = null;
    1.17      private boolean skipNextName = false;
    1.18 +    private boolean newLockInfo = false;
    1.19      
    1.20      /** Called with the line of LIST command output */
    1.21      public void outputData(String[] elements) {
    1.22 @@ -333,18 +338,32 @@
    1.23              }
    1.24              if (elements[0].startsWith(ARCHIVE_LOCK_INFO) && fileStatuses != null) {
    1.25                  String lockInfo = elements[0].substring(ARCHIVE_LOCK_INFO.length());
    1.26 -                int index = lockInfo.indexOf(LOCKS_SEPARATOR);
    1.27 -                int index2 = lockInfo.indexOf(LOCKS_SEPARATOR, index + 1);
    1.28 -                if (index2 < 0) return ;
    1.29 -                String revision = lockInfo.substring(index + LOCKS_SEPARATOR.length(), index2).intern();
    1.30 -                index = index2;
    1.31 -                index2 = lockInfo.indexOf(LOCKS_SEPARATOR, index + 1);
    1.32 -                String locker = lockInfo.substring(index + LOCKS_SEPARATOR.length(), index2).intern();
    1.33 -                fileStatuses[2] = locker;
    1.34 -                fileStatuses[3] = revision;
    1.35 -                fileStatuses[4] = (String) archivesByNames.get(fileStatuses[0]);
    1.36 +                if (!lockInfo.endsWith(LOCK_INFO_END)) { // New structured lock info
    1.37 +                    fileStatuses[4] = (String) archivesByNames.get(fileStatuses[0]);
    1.38 +                    newLockInfo = true;
    1.39 +                } else { // Old one-line lock info
    1.40 +                    int index = lockInfo.indexOf(LOCKS_SEPARATOR);
    1.41 +                    int index2 = lockInfo.indexOf(LOCKS_SEPARATOR, index + 1);
    1.42 +                    if (index2 < 0) return ;
    1.43 +                    String revision = lockInfo.substring(index + LOCKS_SEPARATOR.length(), index2).intern();
    1.44 +                    index = index2;
    1.45 +                    index2 = lockInfo.indexOf(LOCKS_SEPARATOR, index + 1);
    1.46 +                    String locker = lockInfo.substring(index + LOCKS_SEPARATOR.length(), index2).intern();
    1.47 +                    fileStatuses[2] = locker;
    1.48 +                    fileStatuses[3] = revision;
    1.49 +                    fileStatuses[4] = (String) archivesByNames.get(fileStatuses[0]);
    1.50 +                }
    1.51 +            }
    1.52 +            if (newLockInfo && elements[0].startsWith(LOCK_INFO_NEW_REVISION) && fileStatuses != null) {
    1.53 +                fileStatuses[3] = elements[0].substring(LOCK_INFO_NEW_REVISION.length()).trim();
    1.54 +            }
    1.55 +            if (newLockInfo && elements[0].startsWith(LOCK_INFO_LOCKED_BY) && fileStatuses != null) {
    1.56 +                fileStatuses[2] = elements[0].substring(LOCK_INFO_LOCKED_BY.length()).trim();
    1.57 +            }
    1.58 +            if (newLockInfo && elements[0].startsWith(LOCK_INFO_END) && fileStatuses != null) {
    1.59 +                newLockInfo = false;
    1.60              }
    1.61          }
    1.62      }
    1.63 -
    1.64 +    
    1.65  }