Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ghc-Diff for openSUSE:Factory 
checked in at 2022-02-11 23:08:46
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-Diff (Old)
 and      /work/SRC/openSUSE:Factory/.ghc-Diff.new.1956 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc-Diff"

Fri Feb 11 23:08:46 2022 rev:8 rq:953452 version:0.4.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-Diff/ghc-Diff.changes        2020-12-22 
11:33:36.413146370 +0100
+++ /work/SRC/openSUSE:Factory/.ghc-Diff.new.1956/ghc-Diff.changes      
2022-02-11 23:10:42.875172450 +0100
@@ -1,0 +2,6 @@
+Thu Dec 30 01:13:34 UTC 2021 - Peter Simons <[email protected]>
+
+- Update Diff to version 0.4.1.
+  Upstream does not provide a change log file.
+
+-------------------------------------------------------------------

Old:
----
  Diff-0.4.0.tar.gz

New:
----
  Diff-0.4.1.tar.gz

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

Other differences:
------------------
++++++ ghc-Diff.spec ++++++
--- /var/tmp/diff_new_pack.3faoAn/_old  2022-02-11 23:10:43.355173838 +0100
+++ /var/tmp/diff_new_pack.3faoAn/_new  2022-02-11 23:10:43.359173849 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package ghc-Diff
 #
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %global pkg_name Diff
 %bcond_with tests
 Name:           ghc-%{pkg_name}
-Version:        0.4.0
+Version:        0.4.1
 Release:        0
 Summary:        O(ND) diff algorithm in haskell
 License:        BSD-3-Clause

++++++ Diff-0.4.0.tar.gz -> Diff-0.4.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Diff-0.4.0/Diff.cabal new/Diff-0.4.1/Diff.cabal
--- old/Diff-0.4.0/Diff.cabal   2019-09-22 05:39:13.000000000 +0200
+++ new/Diff-0.4.1/Diff.cabal   2001-09-09 03:46:40.000000000 +0200
@@ -1,5 +1,5 @@
 name:                Diff
-version:             0.4.0
+version:             0.4.1
 synopsis:            O(ND) diff algorithm in haskell.
 description:         Implementation of the standard diff algorithm, and 
utilities for pretty printing.
 category:            Algorithms
@@ -9,9 +9,10 @@
 maintainer:          [email protected]
 Tested-With:         GHC == 7.8.4
 Build-Type:          Simple
-Cabal-Version:       >= 1.8
+Cabal-Version:       >= 1.10
 
 library
+  default-language: Haskell2010
   build-depends:   base >= 3 && <= 6, array, pretty >= 1.1
   hs-source-dirs:  src
   exposed-modules:
@@ -21,10 +22,11 @@
   ghc-options:     -O2 -Wall -funbox-strict-fields
 
 source-repository head
-  type:      darcs
-  location:  http://hub.darcs.net/sterlingclover/Diff
+  type:      git
+  location:  http://github.com/seereason/Diff
 
 test-suite diff-tests
+  default-language: Haskell2010
   type: exitcode-stdio-1.0
   hs-source-dirs: test, src
   main-is: Test.hs
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Diff-0.4.0/Setup.hs new/Diff-0.4.1/Setup.hs
--- old/Diff-0.4.0/Setup.hs     2019-09-22 05:39:13.000000000 +0200
+++ new/Diff-0.4.1/Setup.hs     1970-01-01 01:00:00.000000000 +0100
@@ -1,3 +0,0 @@
-#!/usr/bin/env runhaskell
-import Distribution.Simple
-main = defaultMain
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Diff-0.4.0/Setup.lhs new/Diff-0.4.1/Setup.lhs
--- old/Diff-0.4.0/Setup.lhs    1970-01-01 01:00:00.000000000 +0100
+++ new/Diff-0.4.1/Setup.lhs    2001-09-09 03:46:40.000000000 +0200
@@ -0,0 +1,3 @@
+#!/usr/bin/env runhaskell
+> import Distribution.Simple
+> main = defaultMain
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Diff-0.4.0/src/Data/Algorithm/DiffContext.hs 
new/Diff-0.4.1/src/Data/Algorithm/DiffContext.hs
--- old/Diff-0.4.0/src/Data/Algorithm/DiffContext.hs    2019-09-22 
05:39:13.000000000 +0200
+++ new/Diff-0.4.1/src/Data/Algorithm/DiffContext.hs    2001-09-09 
03:46:40.000000000 +0200
@@ -12,6 +12,7 @@
 -----------------------------------------------------------------------------
 module Data.Algorithm.DiffContext
     ( getContextDiff
+    , getContextDiffOld
     , prettyContextDiff
     ) where
 
@@ -22,12 +23,79 @@
 
 type ContextDiff c = [[Diff [c]]]
 
+-- | See https://github.com/haskell/containers/issues/424
+groupBy' :: (a -> a -> Bool) -> [a] -> [[a]]
+groupBy' _ [] = []
+groupBy' eq (x : xs) = go [x] xs
+    where
+      go (x : xs) (y : zs) | eq x y = go (y : x : xs) zs
+      go g (y : zs) = reverse g : go [y] zs
+      go g [] = [reverse g]
+
+-- | See 
https://github.com/seereason/Diff/commit/35596ca45fdd6ee2559cf610bef7a86b4617988a.
+-- The original 'getContextDiff' omitted trailing context in diff hunks.
+-- This new one corrects the issue.  Here is the example from the test
+-- suite:
+--
+--     > prettyContextDiff (text "file1") (text "file2") text 
(getContextDiffOld 2 (lines textA) (lines textB))
+--     --- file1
+--     +++ file2
+--     @@
+--      a
+--      b
+--     -c
+--     @@
+--      d
+--      e
+--     @@
+--      i
+--      j
+--     -k
+--
+--     > prettyContextDiff (text "file1") (text "file2") text (getContextDiff 
2 (lines textA) (lines textB))
+--     --- file1
+--     +++ file2
+--     @@
+--      a
+--      b
+--     -c
+--      d
+--      e
+--     @@
+--      i
+--      j
+--     -k
+getContextDiff :: Eq a => Int -> [a] -> [a] -> ContextDiff a
+getContextDiff context a b =
+    groupBy' (\a b -> not (isBoth a && isBoth b)) $ doPrefix $ getGroupedDiff 
a b
+    where
+      isBoth (Both {}) = True
+      isBoth _ = False
+      -- Handle the common text leading up to a diff.
+      doPrefix [] = []
+      doPrefix [Both _ _] = []
+      doPrefix (Both xs ys : more) =
+          Both (drop (max 0 (length xs - context)) xs)
+               (drop (max 0 (length ys - context)) ys) : doSuffix more
+      -- Prefix finished, do the diff then the following suffix
+      doPrefix (d : ds) = doSuffix (d : ds)
+      -- Handle the common text following a diff.
+      doSuffix [] = []
+      doSuffix [Both xs ys] = [Both (take context xs) (take context ys)]
+      doSuffix (Both xs ys : more)
+          | length xs <= context * 2 =
+              Both xs ys : doPrefix more
+      doSuffix (Both xs ys : more) =
+          Both (take context xs) (take context ys)
+                   : doPrefix (Both (drop context xs) (drop context ys) : more)
+      doSuffix (d : ds) = d : doSuffix ds
+
 -- | Do a grouped diff and then split up the chunks into runs that
 -- contain differences surrounded by N lines of unchanged text.  If
 -- there is less then 2N+1 lines of unchanged text between two
 -- changes, the runs are left merged.
-getContextDiff :: Eq a => Int -> [a] -> [a] -> ContextDiff a
-getContextDiff context a b =
+getContextDiffOld :: Eq a => Int -> [a] -> [a] -> ContextDiff a
+getContextDiffOld context a b =
     group $ swap $ trimTail $ trimHead $ concatMap split $ getGroupedDiff a b
     where
       -- Drop the middle elements of a run of Both if there are more
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Diff-0.4.0/test/Test.hs new/Diff-0.4.1/test/Test.hs
--- old/Diff-0.4.0/test/Test.hs 2019-09-22 05:39:13.000000000 +0200
+++ new/Diff-0.4.1/test/Test.hs 2001-09-09 03:46:40.000000000 +0200
@@ -4,6 +4,7 @@
 import Test.Framework.Providers.QuickCheck2 (testProperty)
 import Test.QuickCheck
 import Data.Algorithm.Diff
+import Data.Algorithm.DiffContext
 import Data.Algorithm.DiffOutput
 import Text.PrettyPrint
 
@@ -37,7 +38,8 @@
                         testProperty "self generates empty" $ forAll 
shortLists  prop_ppDiffEqual,
                         --testProperty "compare our lists with diff" $ forAll2 
shortLists  prop_ppDiffShort,
                         testProperty "compare random with diff" prop_ppDiffR,
-                        testProperty "test parse" prop_parse
+                        testProperty "test parse" prop_parse,
+                        testProperty "test context" prop_context_diff
                      ]
                    ]
 
@@ -190,3 +192,16 @@
                          , (3, return (prefix ++ ["XXX" ++ str]))
                          , (2, return prefix)
                          , (2, return [str])]
+
+-- | FIXME - make a real quickcheck property
+prop_context_diff :: Bool
+prop_context_diff =
+    expected == actual
+    where
+      expected = [[Both ["a","b"] ["a","b"],
+                   First ["c"],
+                   Both ["d","e"] ["d","e"]],
+                  [Both ["i","j"] ["i","j"],First ["k"]]]
+      actual = getContextDiff 2 (lines textA) (lines textB)
+      textA = "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\n"
+      textB = "a\nb\nd\ne\nf\ng\nh\ni\nj\n"

Reply via email to