[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[Subclipse-users] svnClientAdapter incorrect statuses returned for relative path to parent dir

From: Alexander Dolgin <dolgin_at_gmail.com>
Date: 2007-05-05 17:39:33 CEST

Hi,

I encountered a problem with command line ISVNClientAdapter implementation (
org.tigris.subversion.svnclientadapter.commandline.CmdLineClientAdapter).
When called for parent dir -- only statuses of unversioned files are
returned.
E.g. clientAdapter#getStatus("..", true, false);

The reason of problem is pretty simple
CmdLineStatuses#getCorrespondingInfoPart()
compares files instead of canonical files or paths.
For example if program is started from directory testsvn and we have file
test1.txt in it's modified in working copy then files <some
path>/testsvn/../testsvn/test1.txt and <some path>/testsvn/test1.txt will be
compared. Though it's the same file equals will return false.

I'd fix it with

Index:
main/org/tigris/subversion/svnclientadapter/commandline/CmdLineStatusFromXml.java
===================================================================

---
main/org/tigris/subversion/svnclientadapter/commandline/CmdLineStatusFromXml.java
(revision 3031)
+++
main/org/tigris/subversion/svnclientadapter/commandline/CmdLineStatusFromXml.java
(working copy)
@@ -363,9 +363,10 @@
             for(int i = 0; i < nodes.getLength(); i++) {
                 Node statusEntry = nodes.item(i);
-                String entryPath = statusEntry.getAttributes
().getNamedItem("path").getNodeValue();
-
-                CmdLineStatusFromXml status = new
CmdLineStatusFromXml(entryPath);
+                String entryPath =  statusEntry.getAttributes
().getNamedItem("path").getNodeValue();
+                String canonicalPath = new
File(entryPath).getCanonicalPath();
+
+                CmdLineStatusFromXml status = new
CmdLineStatusFromXml(canonicalPath);
                 Element wcStatusNode = getFirstNamedElement(statusEntry,
"wc-status");
                 if (wcStatusNode == null) throw new Exception("'wc-status'
tag expected under 'entry'");
-- 
Thanks,
Alexander Dolgin.
Received on Sat May 5 17:41:07 2007

This is an archived mail posted to the Subclipse Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.