Hello community,

here is the log from the commit of package rubygem-cfa for openSUSE:Factory 
checked in at 2019-07-23 22:27:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-cfa (Old)
 and      /work/SRC/openSUSE:Factory/.rubygem-cfa.new.4126 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "rubygem-cfa"

Tue Jul 23 22:27:41 2019 rev:12 rq:716079 version:1.0.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/rubygem-cfa/rubygem-cfa.changes  2019-06-25 
22:17:38.752738287 +0200
+++ /work/SRC/openSUSE:Factory/.rubygem-cfa.new.4126/rubygem-cfa.changes        
2019-07-23 22:27:42.499075588 +0200
@@ -1,0 +2,7 @@
+Wed Jul 17 06:25:41 UTC 2019 - Josef Reidinger <[email protected]>
+
+- fix writting subtree when element change to collection and vice
+  versa (bsc#1132362)
+- 1.0.1
+
+-------------------------------------------------------------------

Old:
----
  cfa-1.0.0.gem

New:
----
  cfa-1.0.1.gem

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ rubygem-cfa.spec ++++++
--- /var/tmp/diff_new_pack.r0lgdU/_old  2019-07-23 22:27:43.219075484 +0200
+++ /var/tmp/diff_new_pack.r0lgdU/_new  2019-07-23 22:27:43.219075484 +0200
@@ -12,12 +12,12 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           rubygem-cfa
-Version:        1.0.0
+Version:        1.0.1
 Release:        0
 %define mod_name cfa
 %define mod_full_name %{mod_name}-%{version}

++++++ cfa-1.0.0.gem -> cfa-1.0.1.gem ++++++
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/lib/cfa/augeas_parser/writer.rb 
new/lib/cfa/augeas_parser/writer.rb
--- old/lib/cfa/augeas_parser/writer.rb 2019-06-21 10:23:49.000000000 +0200
+++ new/lib/cfa/augeas_parser/writer.rb 2019-07-17 09:25:50.000000000 +0200
@@ -301,12 +301,35 @@
       # @param preceding [LocatedEntry]
       def path_after(preceding)
         paths = aug.match(preceding.prefix + "/*")
-        preceding_index = paths.index(preceding.path)
-        # it can happen, that insertion change previous entry from
-        # e.g. #comment to #comment[1]. Can happen only if it switch from
-        # single entry to collection
-        preceding_index ||= paths.index(preceding.path + "[1]")
-        paths[preceding_index + 1]
+        paths[find_preceding_index(paths, preceding) + 1]
+      end
+
+      def find_preceding_index(paths, preceding)
+        path = preceding.path
+        # common case, just included
+        return paths.index(path) if paths.include?(path)
+
+        # not found, so it means that some collection or single entry switch
+        new_path = +"/"
+        path.split("/").each do |element|
+          new_path << "/" unless new_path.end_with?("/")
+          new_path << pick_candidate(paths, new_path, element)
+        end
+
+        paths.index(new_path) ||
+          raise("Cannot find path #{preceding.path} in #{paths.inspect}")
+      end
+
+      # it returns variant of element that exists in path
+      def pick_candidate(paths, new_path, element)
+        # NOTE: order here is important due to early matching
+        candidates = [element + "/", element + "[1]",
+                      element.sub(/\[\d+\]/, ""), element]
+        paths.each do |p|
+          candidates.each do |c|
+            return c if p.start_with?(new_path + c)
+          end
+        end
       end
     end
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata        2019-06-21 10:27:02.000000000 +0200
+++ new/metadata        2019-07-17 09:26:11.000000000 +0200
@@ -1,14 +1,14 @@
 --- !ruby/object:Gem::Specification
 name: cfa
 version: !ruby/object:Gem::Version
-  version: 1.0.0
+  version: 1.0.1
 platform: ruby
 authors:
 - Josef Reidinger
 autorequire: 
 bindir: bin
 cert_chain: []
-date: 2019-06-21 00:00:00.000000000 Z
+date: 2019-07-17 00:00:00.000000000 Z
 dependencies:
 - !ruby/object:Gem::Dependency
   name: ruby-augeas


Reply via email to