public void beforeFileMovement()

in src/com/intellij/vssSupport/VFSListener.java [167:205]


  public void beforeFileMovement(@NotNull VirtualFileMoveEvent event )
  {
    if( isIgnoredEvent( event ) )
        return;

    VirtualFile file = event.getFile();
    if( !file.isDirectory() )
    {
      String oldName = file.getPath();
      String newName = event.getNewParent().getPath() + "/" + file.getName();

      //  If the file is moved into Vss-versioned module, then it is a simple
      //  movement. Otherwise (move into non-versioned module), mark it
      //  "for removal" in the current, versioned module.
      if( VcsUtil.isFileForVcs( newName, project, host ) )
      {
        //  Newer name must refer to the oldest one in the chain of movements
        String prevName = host.renamedFiles.get( oldName );
        if( prevName == null )
          prevName = oldName;

        //  Check whether we are trying to rename the file back -
        //  if so, just delete the old key-value pair
        if( !prevName.equals( newName ) )
          host.renamedFiles.put( newName, prevName );

        host.renamedFiles.remove( oldName );

        //  Clear the cache of the content revisions for this file.
        //  This will make possible to reread the correct version content
        //  after the referred FilePath/VirtualFile is changed
        ContentRevisionFactory.clearCacheForFile( file.getPath() );
      }
      else
      {
        performDeleteFile( file );
      }
    }
  }