https://defect.opensolaris.org/bz/show_bug.cgi?id=16761



--- Comment #2 from Yuriy Vasylchenko <[email protected]> 2010-08-13 19:21:17 
UTC ---
Thanks Lubos,
I think I understand your concern.
The changed implementation should take care of most situations I can think of.
The issue with previous one was when the isInP4Depot() argument was a
directory, $CWD for p4 commands' execution was set to the parent directory.
This did not allow perforce to read client configuration file under the client
root. Moreover, the directory itself may have no direct repository mapping
(this often happens for client root directories).
Presence of children nodes is more reliable strategy to detect if directory is
in repository. Since empty directories can not exist in perforce (even if they
could, what value would it have for the code navigation tool?) so I can't see
the problem here.
The one problematic situation I can imagine is when the client is
overconfigured in the way that there are two levels of directories that do not
have repository mapping:
client_root/
           +some_repo_file
           +1/
             +2/
               +repository_file
Mapping looks like "//depot/project/repository_file
//client/1/2/repository_file"
In this case, for directory "1" results will be like:
> p4 dirs '*'
Date 2010/08/13 11:12:49:
Operation: user-dirs
Operation 'user-dirs' failed.
Client map too twisted for directory list.
> p4 files '*'
* - no such file(s).

But this situation is pretty synthetic. Being a paranoid :), the problem can be
fixed by adding third layer of detection using "p4 files ..." (if used at the
first layer - performance impact for big projects is huge):

--- src/org/opensolaris/opengrok/history/PerforceRepository.java    2010-08-09
12:55:46.342231000 -0700
+++ src.paranoid/org/opensolaris/opengrok/history/PerforceRepository.java      
 2010-08-13 11:38:43.979718416 -0700
@@ -176,6 +176,15 @@
              */
                 status = (executor.getOutputString().indexOf("//") != -1);
             }
+            if (!status && file.isDirectory()) {
+                cmd.clear();
+                cmd.add(getCommand());
+                cmd.add("files");
+                cmd.add("...");
+                Executor executor = new Executor(cmd, dir);
+                executor.exec();
+                status = (executor.getOutputString().indexOf("//") != -1);
+            }
         }
         return status;
     }

-- 
Configure bugmail: https://defect.opensolaris.org/bz/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
opengrok-dev mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opengrok-dev

Reply via email to