This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 268772
Collapse All | Expand All

(-)a/dlight.remote.impl/src/org/netbeans/modules/remote/impl/fileoperations/spi/RemoteVcsSupportUtil.java (+22 lines)
Lines 433-436 Link Here
433
            }
433
            }
434
        }
434
        }
435
    }
435
    }
436
    
437
    public static boolean isForbiddenFolder(FileSystem fs, String path) {
438
        if (fs instanceof RemoteFileSystem) {
439
            RemoteFileSystem rfs = (RemoteFileSystem) fs;
440
            if (path.isEmpty()) {
441
                return true;
442
            }
443
            if (rfs.isAutoMount(path) || rfs.isProhibitedToEnter(path)) {
444
                return true;
445
            }
446
            int pos = path.lastIndexOf('/');
447
            if (pos > 0) {
448
                String parent = path.substring(0, pos);
449
                if (rfs.isAutoMount(parent) || rfs.isProhibitedToEnter(parent)) {
450
                    return true;
451
                }
452
            }
453
            return false;
454
            //return rfs.isAutoMount(path);
455
        }
456
        return false;
457
    }
436
}
458
}
(-)a/git.remote/src/org/netbeans/modules/git/remote/Git.java (-1 / +1 lines)
Lines 371-377 Link Here
371
                break;
371
                break;
372
            }
372
            }
373
            // is the folder a special one where metadata should not be looked for?
373
            // is the folder a special one where metadata should not be looked for?
374
            boolean forbiddenFolder = Utils.isForbiddenFolder(file.getPath());
374
            boolean forbiddenFolder = org.netbeans.modules.versioning.core.util.Utils.isForbiddenFolder(file);
375
            if (!forbiddenFolder && GitUtils.repositoryExistsFor(file)) {
375
            if (!forbiddenFolder && GitUtils.repositoryExistsFor(file)) {
376
                if (LOG.isLoggable(Level.FINE)) {
376
                if (LOG.isLoggable(Level.FINE)) {
377
                    LOG.log(Level.FINE, " found managed parent {0}", new Object[] { file });
377
                    LOG.log(Level.FINE, " found managed parent {0}", new Object[] { file });
(-)a/mercurial.remote/src/org/netbeans/modules/mercurial/remote/Mercurial.java (-1 / +1 lines)
Lines 599-605 Link Here
599
                break;
599
                break;
600
            }
600
            }
601
            // is the folder a special one where metadata should not be looked for?
601
            // is the folder a special one where metadata should not be looked for?
602
            boolean forbiddenFolder = Utils.isForbiddenFolder(file.getPath());
602
            boolean forbiddenFolder = org.netbeans.modules.versioning.core.util.Utils.isForbiddenFolder(file);
603
            if (!forbiddenFolder && HgUtils.hgExistsFor(file)){
603
            if (!forbiddenFolder && HgUtils.hgExistsFor(file)){
604
                if (Mercurial.LOG.isLoggable(Level.FINE)) {
604
                if (Mercurial.LOG.isLoggable(Level.FINE)) {
605
                    Mercurial.LOG.log(Level.FINE, " found managed parent {0}", new Object[] { file });
605
                    Mercurial.LOG.log(Level.FINE, " found managed parent {0}", new Object[] { file });
(-)404ffed5292e (+60 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 */
40
package org.netbeans.modules.remotefs.versioning.impl;
41
42
import org.netbeans.modules.remote.impl.fileoperations.spi.RemoteVcsSupportUtil;
43
import org.netbeans.modules.remotefs.versioning.api.RemoteVcsSupport;
44
import org.netbeans.modules.versioning.core.api.VCSFileProxy;
45
import org.netbeans.modules.versioning.core.spi.VCSForbiddenFolderProvider;
46
import org.openide.filesystems.FileSystem;
47
import org.openide.util.lookup.ServiceProvider;
48
49
/**
50
 *
51
 * @author vkvashin
52
 */
53
@ServiceProvider(service = VCSForbiddenFolderProvider.class)
54
public class VCSForbiddenFolderProviderImpl implements VCSForbiddenFolderProvider {
55
    @Override
56
    public boolean isForbiddenFolder(VCSFileProxy folder) {
57
        FileSystem fs = RemoteVcsSupport.getFileSystem(folder);
58
        return RemoteVcsSupportUtil.isForbiddenFolder(fs, folder.getPath());
59
    }
60
}
(-)a/versioning.core/src/org/netbeans/modules/versioning/core/Utils.java (+7 lines)
Lines 65-70 Link Here
65
import java.util.prefs.Preferences;
65
import java.util.prefs.Preferences;
66
import org.netbeans.modules.versioning.core.api.VCSFileProxy;
66
import org.netbeans.modules.versioning.core.api.VCSFileProxy;
67
import org.netbeans.modules.versioning.core.api.VersioningSupport;
67
import org.netbeans.modules.versioning.core.api.VersioningSupport;
68
import org.netbeans.modules.versioning.core.spi.VCSForbiddenFolderProvider;
68
import org.openide.filesystems.FileSystem;
69
import org.openide.filesystems.FileSystem;
69
import org.openide.filesystems.URLMapper;
70
import org.openide.filesystems.URLMapper;
70
import org.openide.modules.Places;
71
import org.openide.modules.Places;
Lines 345-350 Link Here
345
    }
346
    }
346
347
347
    public static boolean isForbiddenFolder (VCSFileProxy folder) {
348
    public static boolean isForbiddenFolder (VCSFileProxy folder) {
349
        Collection<? extends VCSForbiddenFolderProvider> forbiddenFolderProviders = Lookup.getDefault().lookupAll(VCSForbiddenFolderProvider.class);
350
        for (VCSForbiddenFolderProvider provider : forbiddenFolderProviders) {
351
            if (provider.isForbiddenFolder(folder)) {
352
                return true;
353
            }
354
        }
348
        return forbiddenFolders.contains(folder.getPath());
355
        return forbiddenFolders.contains(folder.getPath());
349
    }
356
    }
350
357
(-)404ffed5292e (+62 lines)
Added Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 */
40
package org.netbeans.modules.versioning.core.spi;
41
42
import org.netbeans.modules.versioning.core.api.VCSFileProxy;
43
44
45
public interface VCSForbiddenFolderProvider {
46
    /**
47
     * Some folders are special and versioning should not look for metadata in
48
     * them. Folders like /net with automount enabled may take a long time to
49
     * answer I/O on their children, so
50
     * <code>VCSFileProxy.exists("/net/.git")</code> will freeze until it timeouts.
51
     * This method is called from org.netbeans.modules.versioning.core.util.Utils.isForbiddenFolder()
52
     * This does not mean however that whole subtree should be excluded from version control, 
53
     * only that you should not look for the metadata directly in this folder.
54
     * Returns <code>true</code> if the given folder is among such folders.
55
     * @author vkvashin
56
     * @param folder a folder to query
57
     * @return <code>true</code> if the given folder should be skipped when
58
     * searching for metadata.
59
     * @since 1.19
60
     */
61
    boolean isForbiddenFolder (VCSFileProxy folder);
62
}

Return to bug 268772