Skip to content

sometimes incorrect results for getInfoFromWorkingCopy under subversion 1.4.5 [Tigris #1264] #15

@markphip

Description

@markphip

Description

Using the command-line adapter, I sometimes get incorrect results when requesting 
getInfoFromWorkingCopy for a directory that contains both managed and unmanaged 
entries. 

In the implementation, the code first gets status information for the path, which 
returns status information of all directory entries. The implementation then 
incorrectly assumes the first entry is the directory itself. This is not true for 
subversion v1.4.5.

Metadata Imported from Tigris (Issue 1264)

  • Creation Date: 2011-04-27 04:21:51
  • Reporter: bartvh
  • Subcomponent: svnClientAdapter
  • Version: 1.1.x
  • Milestone: not determined
  • Keywords:
  • Cc:

Comments

2011-04-27 04:23:09 by bartvh

Created an attachment (id=342)
proposed patch that will check all results instead of only the first one

Attachments

client-1.4-info.patch - proposed patch that will check all results instead of only the first one

Posted 2011-04-27 04:23:09 by bartvh

Index: src/commandline/org/tigris/subversion/svnclientadapter/commandline/CmdLineClientAdapter.java
===================================================================
--- src/commandline/org/tigris/subversion/svnclientadapter/commandline/CmdLineClientAdapter.java    (revision 4859)
+++ src/commandline/org/tigris/subversion/svnclientadapter/commandline/CmdLineClientAdapter.java    (working copy)
@@ -1286,12 +1286,17 @@
            // first we get the status of the files to find out whether it is versioned
             CmdLineStatusPart[] cmdLineStatusParts = getCmdStatuses(new File[] {path}, false, true, false, false);
             // if the file is managed, it is safe to call info
-            if ((cmdLineStatusParts.length > 0) && (cmdLineStatusParts[0].isManaged())) {
-               String cmdLineInfoStrings = _cmd.info(new String[] { toString(path) }, null, null);
-               return new CmdLineInfoPart(cmdLineInfoStrings);
-            } else {
-               return CmdLineInfoPart.createUnversioned(path.getPath());
+            for (int i = 0; i < cmdLineStatusParts.length; i++) {
+               if (cmdLineStatusParts[i].getPath().equals(path.getPath())) {
+                   if (cmdLineStatusParts[i].isManaged()) {
+                       String cmdLineInfoStrings = _cmd.info(new String[] { toString(path) }, null, null);
+                       return new CmdLineInfoPart(cmdLineInfoStrings);
+                   } else {
+                        return CmdLineInfoPart.createUnversioned(path.getPath());
+                   }
+               }
             }
+            return CmdLineInfoPart.createUnversioned(path.getPath());
         } catch (CmdLineException e) {
             throw SVNClientException.wrapException(e);
         }        

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions