Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > subclipse commit: r1058 - branches/subclipse-3/core/src/org/tigris/subversion/subclipse/core/sync

subclipse
Discussion topic

Back to topic list

subclipse commit: r1058 - branches/subclipse-3/core/src/org/tigris/subversion/subclipse/core/sync

Author pkorros
Full name Panagiotis Korros
Date 2004-11-14 07:37:03 PST
Message Author: pkorros
Date: Sun Nov 14 09:36:57 2004
New Revision: 1058

Modified:
   branches/subclipse-3​/core/src/org/tigris​/subversion/subclips​e/core/sync/SVNStatu​sSyncInfo.java
   branches/subclipse-3​/core/src/org/tigris​/subversion/subclips​e/core/sync/SVNWorks​paceSubscriber.java
Log:
Changed the SVNWorkspaceSubscriber to use the ISVNLocalResource.getStatus() to get local changes.

Modified: branches/subclipse-3​/core/src/org/tigris​/subversion/subclips​e/core/sync/SVNStatu​sSyncInfo.java
Url: http://svn.collab.ne​t/viewcvs/subclipse/​branches/subclipse-3​/core/src/org/tigris​/subversion/subclips​e/core/sync/SVNStatu​sSyncInfo.java?view=​diff&rev=1058​&p1=branches/subcli​pse-3/core/src/org/t​igris/subversion/sub​clipse/core/sync/SVN​StatusSyncInfo.java​&r1=1057&p2=b​ranches/subclipse-3/​core/src/org/tigris/​subversion/subclipse​/core/sync/SVNStatus​SyncInfo.java&r2​=1058
====================​====================​====================​==================
--- branches/subclipse-3​/core/src/org/tigris​/subversion/subclips​e/core/sync/SVNStatu​sSyncInfo.java (original)
+++ branches/subclipse-3​/core/src/org/tigris​/subversion/subclips​e/core/sync/SVNStatu​sSyncInfo.java Sun Nov 14 09:36:57 2004
@@ -37,7 +37,9 @@
      */
     protected int calculateKind() throws TeamException {
         SVNStatusKind localKind = localStatusInfo.getKind();
- SVNStatusKind repositoryKind = remoteStatusInfo.getKind();
+ SVNStatusKind repositoryKind = SVNStatusKind.NORMAL;
+ if( remoteStatusInfo != null)
+ repositoryKind = remoteStatusInfo.getKind();
 
         if( localKind == SVNStatusKind.NONE
          || localKind == SVNStatusKind.MISSING

Modified: branches/subclipse-3​/core/src/org/tigris​/subversion/subclips​e/core/sync/SVNWorks​paceSubscriber.java
Url: http://svn.collab.ne​t/viewcvs/subclipse/​branches/subclipse-3​/core/src/org/tigris​/subversion/subclips​e/core/sync/SVNWorks​paceSubscriber.java?​view=diff&rev=10​58&p1=branches/s​ubclipse-3/core/src/​org/tigris/subversio​n/subclipse/core/syn​c/SVNWorkspaceSubscr​iber.java&r1=105​7&p2=branches/su​bclipse-3/core/src/o​rg/tigris/subversion​/subclipse/core/sync​/SVNWorkspaceSubscri​ber.java&r2=1058​
====================​====================​====================​==================
--- branches/subclipse-3​/core/src/org/tigris​/subversion/subclips​e/core/sync/SVNWorks​paceSubscriber.java (original)
+++ branches/subclipse-3​/core/src/org/tigris​/subversion/subclips​e/core/sync/SVNWorks​paceSubscriber.java Sun Nov 14 09:36:57 2004
@@ -53,10 +53,10 @@
 import org.tigris.subversio​n.subclipse.core.res​ources.SVNWorkspaceR​oot;
 import org.tigris.subversio​n.svnclientadapter.I​SVNClientAdapter;
 import org.tigris.subversio​n.svnclientadapter.I​SVNStatus;
-import org.tigris.subversio​n.svnclientadapter.S​VNStatusKind;
 import org.tigris.subversio​n.svnclientadapter.S​VNClientException;
 import org.tigris.subversio​n.svnclientadapter.S​VNNodeKind;
 import org.tigris.subversio​n.svnclientadapter.S​VNRevision;
+import org.tigris.subversio​n.svnclientadapter.S​VNStatusKind;
 import org.tigris.subversio​n.svnclientadapter.S​VNRevision.Number;
 
 public class SVNWorkspaceSubscriber extends Subscriber implements IResourceStateChangeListener {
@@ -76,7 +76,6 @@
 
     protected SVNRevisionComparator comparator = new SVNRevisionComparator();
 
- protected ResourceVariantByteStore localSyncStateStore = new SessionResourceVaria​ntByteStore();
     protected ResourceVariantByteStore remoteSyncStateStore = new SessionResourceVaria​ntByteStore();
 
     public SVNWorkspaceSubscriber() {
@@ -161,8 +160,8 @@
             //add remote changed resources (they may not exist locally)
             allMembers.addAll(Ar​rays.asList( remoteSyncStateStore.members( resource ) ) );
 
- //add local changed resources (they may not exist locally)
- allMembers.addAll(Ar​rays.asList( localSyncStateStore.members( resource ) ) );
+ //TODO: add local changed resources (they may not exist locally)
+ //allMembers.addAll(​Arrays.asList( localSyncStateStore.members( resource ) ) );
 
             return (IResource[]) allMembers.toArray(new IResource[allMembers.size()]);
         } catch (CoreException e) {
@@ -174,10 +173,21 @@
      * @see org.eclipse.team.cor​e.subscribers.Subscr​iber#getSyncInfo(org​.eclipse.core.resour​ces.IResource)
      */
     public SyncInfo getSyncInfo(IResource resource) throws TeamException {
- StatusInfo localStatusInfo = StatusInfo.fromBytes​(localSyncStateStore​.getBytes( resource ));
- StatusInfo remoteStatusInfo = StatusInfo.fromBytes​(remoteSyncStateStor​e.getBytes( resource ));
- if( localStatusInfo == null && remoteStatusInfo == null )
+ if( ! isSupervised( resource ) )
             return null;
+ ISVNLocalResource localResource = SVNWorkspaceRoot.get​SVNResourceFor(resou​rce);
+ LocalResourceStatus localStatus = localResource.getStatus();
+
+ StatusInfo localStatusInfo = new StatusInfo(localStat​us.getLastChangedRev​ision(), localStatus.getTextStatus());
+
+ StatusInfo remoteStatusInfo = null;
+ byte[] remoteBytes = remoteSyncStateStore.getBytes( resource );
+ if( remoteBytes != null )
+ remoteStatusInfo = StatusInfo.fromBytes​(remoteBytes);
+ else {
+ if( localStatus.hasRemote() )
+ remoteStatusInfo = new StatusInfo(localStat​us.getLastChangedRev​ision(), SVNStatusKind.NORMAL);
+ }
 
         SyncInfo syncInfo = new SVNStatusSyncInfo(resource, localStatusInfo, remoteStatusInfo, comparator);
         syncInfo.init();
@@ -231,7 +241,6 @@
         IWorkspace workspace = ResourcesPlugin.getWorkspace();
         IWorkspaceRoot workspaceRoot = workspace.getRoot();
         
- localSyncStateStore.​flushBytes(resource,​ depth);
         remoteSyncStateStore​.flushBytes(resource​, depth);
 
         ISVNClientAdapter client = SVNProviderPlugin.ge​tPlugin().createSVNC​lient();
@@ -261,17 +270,8 @@
                 else if ( status.getNodeKind() == SVNNodeKind.UNKNOWN ) {
                     changedResource = workspaceRoot.getCon​tainerForLocation(pa​th);
                     
- if( changedResource.exists() ) {
+ if( changedResource.exists() )
                         containerSet.add( changedResource );
-
- //if the resource is a locally added folder then
- //add it's members
- if( changedResource.exists()
- && status.getRevision() == null
- && status.getTextStatus() != SVNStatusKind.EXTERNAL) {
- addLocalContainerSta​tusInfo((IContainer)​ changedResource, allChanges);
- }
- }
                     else if( !containerSet.contains( changedResource ) )
                         changedResource = workspaceRoot.getFil​eForLocation(path);
                 }
@@ -279,13 +279,10 @@
                 if( changedResource != null ) {
                     containerSet.add(cha​ngedResource.getPare​nt());
                     
- StatusInfo localInfo = new StatusInfo(status.ge​tLastChangedRevision​(), status.getTextStatus() );
- localSyncStateStore.setBytes( changedResource, localInfo.asBytes() );
-
                     StatusInfo remoteInfo = new StatusInfo(cmd.getRevision(), status.getRepository​TextStatus() );
                     remoteSyncStateStore.setBytes( changedResource, remoteInfo.asBytes() );
 
- System.out.println(c​md.getRevision()+" "+changedResource+" R:"+status.getLastCh​angedRevision()+" L:"+status.getTextStatus()+" R:"+status.getReposi​toryTextStatus());
+ //System.out.println​(cmd.getRevision()+"​ "+changedResource+" R:"+status.getLastCh​angedRevision()+" L:"+status.getTextStatus()+" R:"+status.getReposi​toryTextStatus());
                     allChanges.add(chang​edResource);
                 }
             }
@@ -296,36 +293,6 @@
         }
     }
 
- private void addLocalContainerSta​tusInfo(IContainer container, List allChanges) throws TeamException {
- IResource[] members;
- try {
- members = container.members();
- } catch (CoreException e) {
- if (e.getStatus().getCode() == IResourceStatus.RESO​URCE_NOT_FOUND) {
- // The resource is no longer exists so ignore the exception
- members = null;
- } else {
- throw new TeamException("Error getting members of:"+container,e);
- }
- }
-
- for (int j = 0; members!=null && j < members.length; j++) {
- IResource resource = members[j];
-
- StatusInfo localInfo = new StatusInfo(null, SVNStatusKind.UNVERSIONED );
- localSyncStateStore.setBytes( resource, localInfo.asBytes() );
-
- StatusInfo remoteInfo = new StatusInfo(null, SVNStatusKind.NONE );
- remoteSyncStateStore.setBytes( resource, remoteInfo.asBytes() );
-
- allChanges.add(resource);
-
- if( resource.exists() && resource instanceof IContainer ) {
- addLocalContainerStatusInfo( (IContainer) resource, allChanges);
- }
- }
- }
-
     /* (non-Javadoc)
      * @see org.tigris.subversio​n.subclipse.core.IRe​sourceStateChangeLis​tener#resourceSyncIn​foChanged(org.eclips​e.core.resources.IRe​source[])
      */
@@ -350,8 +317,6 @@
                 if( resource.exists() ) {
                     ISVNLocalResource localResource = SVNWorkspaceRoot.get​SVNResourceFor( resource );
                     LocalResourceStatus status = localResource.getStatus();
- StatusInfo localInfo = new StatusInfo(status.ge​tLastChangedRevision​(), status.getTextStatus() );
- localSyncStateStore.setBytes( resource, localInfo.asBytes() );
 
                     if( remoteSyncStateStore.getBytes( resource ) == null ) {
                         StatusInfo remoteInfo;
@@ -364,15 +329,16 @@
                         remoteSyncStateStore.setBytes( resource, remoteInfo.asBytes() );
                     }
                 }
- else {
- if( remoteSyncStateStore.getBytes( resource ) == null ) {
- localSyncStateStore.​deleteBytes( resource );
- }
- else {
- StatusInfo localInfo = new StatusInfo(null, SVNStatusKind.NONE );
- localSyncStateStore.setBytes( resource, localInfo.asBytes() );
- }
- }
+//TODO: catch outgoing deletions
+// else {
+// if( remoteSyncStateStore.getBytes( resource ) == null ) {
+// localSyncStateStore.​deleteBytes( resource );
+// }
+// else {
+// StatusInfo localInfo = new StatusInfo(null, SVNStatusKind.NONE );
+// localSyncStateStore.setBytes( resource, localInfo.asBytes() );
+// }
+// }
             } catch (TeamException e) {
                 e.printStackTrace();
             }
@@ -392,9 +358,7 @@
      * @see org.tigris.subversio​n.subclipse.core.IRe​sourceStateChangeLis​tener#projectDeconfi​gured(org.eclipse.co​re.resources.IProjec​t)
      */
     public void projectDeconfigured(IProject project) {
-/* localSyncStateStore.flushBytes( project, IResource.DEPTH_INFINITE);
- remoteSyncStateStore​.flushBytes( project, IResource.DEPTH_INFINITE);
-*/ SubscriberChangeEvent delta = new SubscriberChangeEvent(this, ISubscriberChangeEve​nt.ROOT_REMOVED, project);
+ SubscriberChangeEvent delta = new SubscriberChangeEvent(this, ISubscriberChangeEve​nt.ROOT_REMOVED, project);
         fireTeamResourceChange(new SubscriberChangeEvent[] {delta});
     }
 }

--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@subc​lipse.tigris.org
For additional commands, e-mail: cvs-help at subclipse dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

subclipse commit: r1058 - branches/subclipse-3/core/src/org/tigris/subversion/subclipse/core/sync pkorros Panagiotis Korros 2004-11-14 07:37:03 PST
Messages per page: