Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare over more node with the same name: #11

Closed
Lexanius opened this issue Mar 25, 2013 · 1 comment
Closed

Compare over more node with the same name: #11

Lexanius opened this issue Mar 25, 2013 · 1 comment

Comments

@Lexanius
Copy link

the following nodes, will be wrong compare:

text_1 = '<?xml version="1.0"?>
<info>
<entry
   kind="dir"
   path="."
   revision="29">
<url>file:///home/user/svnrep/svnserver</url>
<repository>
<root>file:///home/user/svnrep/svnserver</root>
<uuid>23296ed4-733e-4fb8-a59a-8fb1a468b90c</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
   revision="29">
<author>user</author>
<date>2013-03-15T12:20:26.098031Z</date>
</commit>
</entry>


<entry
   kind="dir"
   path="Projekt"
   revision="28">
<url>file:///home/user/svnrep/svnserver/Projekt</url>
<repository>
<root>file:///home/user/svnrep/svnserver</root>
<uuid>423296ed4-733e-4fb8-a59a-8fb1a468b90c</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
   revision="28">
<author>user</author>
<gooo a="4" b="2">
<date>2013-03-08T15:19:56.178552Z</date>
</commit>


</entry>
<entry
   kind="dir"
   path="./"
   revision="29">
<url>file:///home/user/svnrep/svnserver</url>
<repository>
<root>file:///home/user/svnrep/svnserver</root>
<uuid>23296ed4-733e-4fb8-a59a-8fb1a468b90c</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
   revision="29">
<author>user</author>
<date>2013-03-15T12:20:26.098031Z</date>
</commit>
</entry> 


<entry
   kind="dir"
   path="Projekt"
   revision="1">
<url>file:///home/user/svnrep/svnserver/Projekt</url>
<repository>
<root>file:///home/user/svnrep/svnserver</root>
<uuid>423296ed4-733e-4fb8-a59a-8fb1a468b90c</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
   revision="28">
<author>user</author>
<gooo a="4" b="2">
<date>2013-03-08T15:19:56.178552Z</date>
</commit>
</entry>
</info>
'
node_1 = Nokogiri::XML(text_1)
text_2 = '<?xml version="1.0"?>
<info>
<entry
   kind="dir"
   path="./"
   revision="29">
<url>file:///home/user/svnrep/svnserver</url>
<repository>
<root>file:///home/user/svnrep/svnserver</root>
<uuid>23296ed4-733e-4fb8-a59a-8fb1a468b90c</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
   revision="29">
<author>user</author>
<date>2013-03-15T12:20:26.098031Z</date>
</commit>
</entry>

<entry
   kind="dir"
   path="Projekt"
   revision="28">
<url>file:///home/user/svnrep/svnserver/Projekt</url>
<repository>
<root>file:///home/user/svnrep/svnserver</root>
<uuid>423296ed4-733e-4fb8-a59a-8fb1a468b90c</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
   revision="28">
<author>user</author>
<gooo a="4" b="2">
<date>2013-03-08T15:19:56.178552Z</date>
</commit>
</entry>

<entry
   kind="dir"
   path="."
   revision="29">
<url>file:///home/user/svnrep/svnserver</url>
<repository>
<root>file:///home/user/svnrep/svnserver</root>
<uuid>23296ed4-733e-4fb8-a59a-8fb1a468b90c</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
   revision="29">
<author>user</author>
<date>2013-03-15T12:20:26.098031Z</date>
</commit>
</entry> 

<entry
   kind="dir"
   path="Projekt"
   revision="1">
<url>file:///home/user/svnrep/svnserver/Projekt</url>
<repository>
<root>file:///home/user/svnrep/svnserver</root>
<uuid>423296ed4-733e-4fb8-a59a-8fb1a468b90c</uuid>
</repository>
<wc-info>
<schedule>normal</schedule>
<depth>infinity</depth>
</wc-info>
<commit
   revision="28">
<author>user</author>
<gooo a="4" b="2">
<date>2013-03-08T15:19:56.178552Z</date>
</commit>
</entry>
</info>
'

with the options: :element_order => false, :normalize_whitespace => true

but with a diff these are the same:

@@ -3 +3 @@
-<entry kind="dir" path="." revision="29">
+<entry kind="dir" path="./" revision="29">
@@ -19 +18,0 @@
-
@@ -35,2 +33,0 @@
-
-
@@ -38 +35,2 @@
-<entry kind="dir" path="./" revision="29">
+
+<entry kind="dir" path="." revision="29">
@@ -54 +51,0 @@
-

After my search: The algorithm get in the second compare (compare_nodesets) a wrong input:

NODESETS (Infomation shorted for visibility)

 <url>file:///home/user/svnrep/svnserver</url><repository><root>file:///home/user/svnrep/svnserver</root><uuid>23296ed4-733e-4fb8-a59a-8fb1a468b90c</uuid></repository><wc-info><schedule>normal</schedule><
depth>infinity</depth></wc-info><commit revision="29"><author>user</author><date>2013-03-15T12:20:26.098031Z</date></commit>

in nodeset_1 and

 <url>file:///home/user/svnrep/svnserver/Projekt</url><repository><root>file:///home/user/svnrep/svnserver
        <entry kind="dir" path="." revision="29"><url>file:///home/user/svnrep/svnserver</url><repository><root>file:///home/user/svnrep/svnserver
        <entry kind="dir" path="Projekt" revision="1"><url>file:///home/user/svnrep/svnserver/Projekt</url><repository><root>file:///home/user/svnrep/svnserver

in nodeset_2 and so the algorithm return false, because the wrong length

Use: ruby 1.8.7
OS Linux
Version: official ruby gem version and current (date:25.03.13)

@Lexanius
Copy link
Author

i found the problem: me-.- sorry, but after searching a long time, i thinking i have found a bug... but it wasent so. Nice work!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant