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

           Summary: Perforce history reader would not use per-project
                    clients (defined by P4CONFIG files)
    Classification: Development
           Product: opengrok
           Version: unspecified
          Platform: ANY/Generic
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P3
         Component: scm
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


--- Comment #0 from Yuriy Vasylchenko <[email protected]> 2010-08-09 22:36:26 
UTC ---
Full fix:



--- src.ori/org/opensolaris/opengrok/history/PerforceRepository.java   
2010-05-11 02:12:43.000000000 -0700
+++ src/org/opensolaris/opengrok/history/PerforceRepository.java       
2010-08-09 12:55:46.342231663 -0700
@@ -144,26 +144,40 @@
      * @return true if the given file is in the depot, false otherwise
      */
     public static boolean isInP4Depot(File file) {
+        boolean status = false;
         if (p4Binary.available) {
             ArrayList<String> cmd = new ArrayList<String>();
-            cmd.add(getCommand());
+            String name = file.getName();
+            File   dir  = file.getParentFile();
             if (file.isDirectory()) {
+                dir = file;
+                name = "*";
+                cmd.add(getCommand());
                 cmd.add("dirs");
-            } else {
-                cmd.add("files");
+                cmd.add(name);
+                Executor executor = new Executor(cmd, dir);
+                executor.exec();
+            /* OUTPUT:
+            stdout: //depot_path/name
+            stderr: name - no such file(s). 
+             */
+                status = (executor.getOutputString().indexOf("//") != -1);
             }
-            cmd.add(file.getName());
-            Executor executor = new Executor(cmd, file.getParentFile());
-            executor.exec();
-
+            if (!status) {
+                cmd.clear();
+                cmd.add(getCommand());
+                cmd.add("files");
+                cmd.add(name);
+                Executor executor = new Executor(cmd, dir);
+                executor.exec();
             /* OUTPUT:
             stdout: //depot_path/name
             stderr: name - no such file(s). 
              */
-            return (executor.getOutputString().indexOf("//") != -1);
-        } else {
-            return false;
+                status = (executor.getOutputString().indexOf("//") != -1);
+            }
         }
+        return status;
     }

     @Override

-- 
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