Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-whatthepatch for 
openSUSE:Factory checked in at 2023-08-31 13:46:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-whatthepatch (Old)
 and      /work/SRC/openSUSE:Factory/.python-whatthepatch.new.1766 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-whatthepatch"

Thu Aug 31 13:46:19 2023 rev:4 rq:1108221 version:1.0.5

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-whatthepatch/python-whatthepatch.changes  
2022-11-16 15:44:05.888011585 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-whatthepatch.new.1766/python-whatthepatch.changes
        2023-08-31 13:52:28.146701352 +0200
@@ -1,0 +2,11 @@
+Wed Aug 30 03:47:25 UTC 2023 - Tony Jones <[email protected]>
+
+- Update to v1.0.5
+  * bugfix:min line in binary diff (#57)
+- from v1.0.4
+  * git binary patch explore (#53)
+  * nixify (#54)
+  * Rename default branch on build yaml (#52)
+  * Remove redundant wheel dep from pyproject.toml (#51)
+
+-------------------------------------------------------------------

Old:
----
  whatthepatch-1.0.3.tar.gz

New:
----
  whatthepatch-1.0.5.tar.gz

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

Other differences:
------------------
++++++ python-whatthepatch.spec ++++++
--- /var/tmp/diff_new_pack.RYGtCg/_old  2023-08-31 13:52:29.742758399 +0200
+++ /var/tmp/diff_new_pack.RYGtCg/_new  2023-08-31 13:52:29.786759972 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package python-whatthepatch
 #
-# Copyright (c) 2022 SUSE LLC
+# Copyright (c) 2023 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %define skip_python2 1
 Name:           python-whatthepatch
-Version:        1.0.3
+Version:        1.0.5
 Release:        0
 Summary:        A patch parsing and application library
 License:        MIT
@@ -29,8 +29,8 @@
 BuildRequires:  %{python_module pytest}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  %{python_module wheel}
-BuildRequires:  ed
 BuildRequires:  dos2unix
+BuildRequires:  ed
 BuildRequires:  fdupes
 BuildRequires:  patch
 BuildRequires:  python-rpm-macros

++++++ whatthepatch-1.0.3.tar.gz -> whatthepatch-1.0.5.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whatthepatch-1.0.3/PKG-INFO 
new/whatthepatch-1.0.5/PKG-INFO
--- old/whatthepatch-1.0.3/PKG-INFO     2022-11-13 19:03:31.936101000 +0100
+++ new/whatthepatch-1.0.5/PKG-INFO     2023-05-06 16:59:53.663455200 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: whatthepatch
-Version: 1.0.3
+Version: 1.0.5
 Summary: A patch parsing and application library.
 Maintainer-email: "Christopher S. Corley" <[email protected]>
 Project-URL: Homepage, https://github.com/cscorley/whatthepatch
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whatthepatch-1.0.3/pyproject.toml 
new/whatthepatch-1.0.5/pyproject.toml
--- old/whatthepatch-1.0.3/pyproject.toml       2022-11-13 19:03:17.000000000 
+0100
+++ new/whatthepatch-1.0.5/pyproject.toml       2023-05-06 16:59:42.000000000 
+0200
@@ -1,6 +1,6 @@
 [project]
 name = "whatthepatch"
-version = "1.0.3"
+version = "1.0.5"
 maintainers = [{ name = "Christopher S. Corley", email = "[email protected]" 
}]
 requires-python = ">=3.7"
 readme = "README.rst"
@@ -31,5 +31,5 @@
 "Bug Tracker" = "https://github.com/cscorley/whatthepatch/issues";
 
 [build-system]
-requires = ["setuptools>=65.0.0", "wheel"]
+requires = ["setuptools>=65.0.0"]
 build-backend = "setuptools.build_meta"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whatthepatch-1.0.3/src/whatthepatch/patch.py 
new/whatthepatch-1.0.5/src/whatthepatch/patch.py
--- old/whatthepatch-1.0.3/src/whatthepatch/patch.py    2022-11-13 
19:03:17.000000000 +0100
+++ new/whatthepatch-1.0.5/src/whatthepatch/patch.py    2023-05-06 
16:59:42.000000000 +0200
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
-
+import base64
 import re
+import zlib
 from collections import namedtuple
 
 from . import exceptions
@@ -50,6 +51,10 @@
 git_header_new_line = re.compile(r"^\+\+\+ (.+)$")
 git_header_file_mode = re.compile(r"^(new|deleted) file mode \d{6}$")
 git_header_binary_file = re.compile("^Binary files (.+) and (.+) differ")
+git_binary_patch_start = re.compile(r"^GIT binary patch$")
+git_binary_literal_start = re.compile(r"^literal (\d+)$")
+git_binary_delta_start = re.compile(r"^delta (\d+)$")
+base85string = re.compile(r"^[0-9A-Za-z!#$%&()*+;<=>?@^_`{|}~-]+$")
 
 bzr_header_index = re.compile("=== (.+)")
 bzr_header_old_line = unified_header_old_line
@@ -85,6 +90,7 @@
         unified_header_old_line,
     ]
 
+    diffs = []
     for c in check:
         diffs = split_by_regex(lines, c)
         if len(diffs) > 1:
@@ -184,12 +190,14 @@
         (default_hunk_start, parse_default_diff),
         (ed_hunk_start, parse_ed_diff),
         (rcs_ed_hunk_start, parse_rcs_ed_diff),
+        (git_binary_patch_start, parse_git_binary_diff),
     ]
 
     for hunk, parser in check:
         diffs = findall_regex(lines, hunk)
         if len(diffs) > 0:
             return parser(lines)
+    return None
 
 
 def parse_git_header(text):
@@ -248,7 +256,6 @@
     # if we go through all of the text without finding our normal info,
     # use the cmd if available
     if cmd_old_path and cmd_new_path and old_version and new_version:
-        print("returning from dumb path")
         if cmd_old_path.startswith("a/"):
             cmd_old_path = cmd_old_path[2:]
 
@@ -914,3 +921,87 @@
         return changes
 
     return None
+
+
+def parse_git_binary_diff(text):
+    try:
+        lines = text.splitlines()
+    except AttributeError:
+        lines = text
+
+    changes = list()
+
+    old_version = None
+    new_version = None
+    cmd_old_path = None
+    cmd_new_path = None
+    # the sizes are used as latch-up
+    old_size = None
+    new_size = None
+    old_encoded = ""
+    new_encoded = ""
+    for line in lines:
+        if cmd_old_path is None and cmd_new_path is None:
+            hm = git_diffcmd_header.match(line)
+            if hm:
+                cmd_old_path = hm.group(1)
+                cmd_new_path = hm.group(2)
+                continue
+
+        if old_version is None and new_version is None:
+            g = git_header_index.match(line)
+            if g:
+                old_version = g.group(1)
+                new_version = g.group(2)
+                continue
+
+        # the first is added file
+        if new_size is None:
+            literal = git_binary_literal_start.match(line)
+            if literal:
+                new_size = int(literal.group(1))
+                continue
+            delta = git_binary_delta_start.match(line)
+            if delta:
+                # not supported
+                new_size = 0
+                continue
+        elif new_size > 0:
+            if base85string.match(line):
+                assert len(line) >= 6 and ((len(line) - 1) % 5) == 0
+                new_encoded += line[1:]
+            elif 0 == len(line):
+                decoded = base64.b85decode(new_encoded)
+                added_data = zlib.decompress(decoded)
+                assert new_size == len(added_data)
+                change = Change(None, 0, added_data, None)
+                changes.append(change)
+                new_size = 0
+            else:
+                break
+
+        # the second is removed file
+        if old_size is None:
+            literal = git_binary_literal_start.match(line)
+            if literal:
+                old_size = int(literal.group(1))
+            delta = git_binary_delta_start.match(line)
+            if delta:
+                # not supported
+                old_size = 0
+                continue
+        elif old_size > 0:
+            if base85string.match(line):
+                assert len(line) >= 6 and ((len(line) - 1) % 5) == 0
+                old_encoded += line[1:]
+            elif 0 == len(line):
+                decoded = base64.b85decode(old_encoded)
+                removed_data = zlib.decompress(decoded)
+                assert old_size == len(removed_data)
+                change = Change(0, None, None, removed_data)
+                changes.append(change)
+                old_size = 0
+            else:
+                break
+
+    return changes
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/whatthepatch-1.0.3/src/whatthepatch.egg-info/PKG-INFO 
new/whatthepatch-1.0.5/src/whatthepatch.egg-info/PKG-INFO
--- old/whatthepatch-1.0.3/src/whatthepatch.egg-info/PKG-INFO   2022-11-13 
19:03:31.000000000 +0100
+++ new/whatthepatch-1.0.5/src/whatthepatch.egg-info/PKG-INFO   2023-05-06 
16:59:53.000000000 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: whatthepatch
-Version: 1.0.3
+Version: 1.0.5
 Summary: A patch parsing and application library.
 Maintainer-email: "Christopher S. Corley" <[email protected]>
 Project-URL: Homepage, https://github.com/cscorley/whatthepatch
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/whatthepatch-1.0.3/src/whatthepatch.egg-info/SOURCES.txt 
new/whatthepatch-1.0.5/src/whatthepatch.egg-info/SOURCES.txt
--- old/whatthepatch-1.0.3/src/whatthepatch.egg-info/SOURCES.txt        
2022-11-13 19:03:31.000000000 +0100
+++ new/whatthepatch-1.0.5/src/whatthepatch.egg-info/SOURCES.txt        
2023-05-06 16:59:53.000000000 +0200
@@ -33,6 +33,7 @@
 tests/casefiles/eclipse-attachment-126343.header
 tests/casefiles/efg
 tests/casefiles/embedded-diff.comment
+tests/casefiles/git-bin.patch
 tests/casefiles/git-binary-files.diff
 tests/casefiles/git-header-long.diff
 tests/casefiles/git-header.diff
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whatthepatch-1.0.3/tests/casefiles/git-bin.patch 
new/whatthepatch-1.0.5/tests/casefiles/git-bin.patch
--- old/whatthepatch-1.0.3/tests/casefiles/git-bin.patch        1970-01-01 
01:00:00.000000000 +0100
+++ new/whatthepatch-1.0.5/tests/casefiles/git-bin.patch        2023-05-06 
16:59:42.000000000 +0200
@@ -0,0 +1,63 @@
+---
+ fox.bin   | Bin 0 -> 44 bytes
+ fox.txt   |   2 +-
+ lorem.bin | Bin 0 -> 446 bytes
+ lorem.zip | Bin 431 -> 432 bytes
+ 4 files changed, 1 insertion(+), 1 deletion(-)
+ create mode 100644 fox.bin
+ create mode 100644 lorem.bin
+
+diff --git a/fox.bin b/fox.bin
+new file mode 100644
+index 
0000000000000000000000000000000000000000..e7683ad05fd121a9ca86cab5a827d471d29b4d4f
+GIT binary patch
+literal 44
+ycmWH^NL45-%}mZ#NGi%N&r?XtuTaP;%`GTa$S+GRQYZmR=Ok8DDx~D6GXMZ<wh!6>
+
+literal 0
+HcmV?d00001
+
+diff --git a/fox.txt b/fox.txt
+index ff3bb63..8fe2a4b 100644
+--- a/fox.txt
++++ b/fox.txt
+@@ -1 +1 @@
+-The quick brown fox jumps over the lazy dog
+\ No newline at end of file
++The quick brown fox jumps over the lazy dog.
+\ No newline at end of file
+diff --git a/lorem.bin b/lorem.bin
+new file mode 100644
+index 
0000000000000000000000000000000000000000..aef2724fd9ff72caf4eb1ac8333f0b5b322d82fb
+GIT binary patch
+literal 446
+zcmXw#&2d992!vD07T|eRB)42s0Fkh>Gy1ax9+w~Fm)wMaW%v8+Q!6-@SL9y$#G*l}
+z+6Ae%rODKMLNW(eV!J^Lqq#K40+haL&oHecme~?Bvp0hqihPGW)J|zdm0J@?;oarH
+zmq8nAXrppJ9#KlY;O<;#ecAL3ed<g!G4=*8MQZA&@*d*izVwphh+(LN@fx1`86ZyC
+zf%h#bZVFBhPiIy(OdV5yv}K(UJU$-1_=s~Fb|NWsEk$A}|AZot<LWnxp>0DLGNbT$
+z;NzKem<F)LV9-+%O)-~zFiWULtcEc=v$joflZvCs%aENL{d#4hAnVe(yS0~XLpC4=
+Lj`hdY>+$vrMRcVJ
+
+literal 0
+HcmV?d00001
+
+diff --git a/lorem.zip b/lorem.zip
+index 
0f6beb70488e2b29fcaadf724b6f48ef0ab5bc4e..3c8a65bf1a97bb4180c83a0e31352b4edb4c245e
 100644
+GIT binary patch
+delta 275
+zcmZ3_yn#6)z?+#xgn@y9gP}7+C2a4}O*1$c85s5gF(-ozLr#8CYOY>MMM-D~Cj+xl
+z?ABymATF)oW?*D_!OXw_CQK(BEOa*HaEZRjWV65P$+T=Pg^u?VBeY_ymt>hupAyrM
+zu_ldGFZao&vTKV}cPYzE-4`VHX!@1~7xxOUc%}T}z;fqZ+pf4>{#%je`L@mdh12$@
+z##~QSCtp2z)oM{#R?hTKa+j9=zO;TxpG;eTRQ}78>li9e@lU*`!E<hhw&gFg7Dwam
+z8SImV7?t(so$}Jyl=3cb^RC<rY)d+m{}%R^{b303W@M6M#^TAz$&AWOMzNDS7!}#P
+Jfj(wn0067{YH|Po
+
+delta 274
+zcmdnMyq-BCz?+#xgn@y9gW*b=N|;w+e?B`S1H&F5=46mz$jL8C&DATZC<zVWWMKXf
+zwKe%I5SLbPGcdBeU}j(d6Q&am7CIYpxJ2J%vRS9J^XV)mjz|9|Mrg$d2bs?H_R@1O
+z3ERvx-K;3mI{Tu~UBN!DcuoF~-cc7`ykS}Oi(}X0%ZjnlS&LuR*=$}?c38P&;q6b7
+zte+;GeDx$tHc;Din|CGu%S*K{!-L%UoHcs4e@O{%uz6ZO@ty`xpT$&}TIoXzX1boS
+zo-D+utS58IOJh^YyS&Z2axbtg=}i7x*!zt+z?+dtjv0#|C#NtfGku7f+{viO<^}XH
+G0|Nj=Vq`=B
+
+--
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/whatthepatch-1.0.3/tests/test_patch.py 
new/whatthepatch-1.0.5/tests/test_patch.py
--- old/whatthepatch-1.0.3/tests/test_patch.py  2022-11-13 19:03:17.000000000 
+0100
+++ new/whatthepatch-1.0.5/tests/test_patch.py  2023-05-06 16:59:42.000000000 
+0200
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-
+import hashlib
 import os
 import time
 import unittest
@@ -1449,6 +1449,65 @@
         # Really all we care about is that this parses faster than it used to 
(200s+)
         self.assertGreater(20, time.time() - start_time)
 
+    def test_git_bin_patch(self):
+        with open("tests/casefiles/git-bin.patch") as f:
+            text = f.read()
+
+        result = list(wtp.patch.parse_patch(text))
+        assert result
+        assert len(result) == 4
+        assert (
+            result[0].changes[0].line
+            == b"The quick brown fox jumps over the lazy dog\x00"
+        )
+        assert (
+            result[1].changes[0].line == "The quick brown fox jumps over the 
lazy dog"
+        )
+        assert (
+            result[1].changes[1].line == "The quick brown fox jumps over the 
lazy dog."
+        )
+        assert (
+            result[2].changes[0].line
+            == b"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed 
do eiusmod tempor incididunt"
+            b" ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis 
nostrud exercitation ullamco"
+            b" laboris nisi ut aliquip ex ea commodo consequat. Duis aute 
irure dolor in reprehenderit"
+            b" in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
Excepteur sint occaecat"
+            b" cupidatat non proident, sunt in culpa qui officia deserunt 
mollit anim id est laborum.\x00"
+        )
+        assert len(result[3].changes) == 0
+
+    def test_git_bin_patch_minline(self):
+        # test path with minimal line in binary diff
+        text = """---
+ 95  | Bin 94 -> 95 bytes
+ 1 files changed, 0 insertions(+), 0 deletions(-)
+
+diff --git a/95 b/95
+index 
cf104291536b187e299023ae37523f4649ca0600..edf50979da25419fbb399ffa6b93142e50dbbba7
 100644
+GIT binary patch
+literal 95
+zcmV-l0HFT>FaHM=!1loEo7=$@IDCW@J2o!_PR6;*Rs73Fmit;^XEfl3aOa~j;?1+w
+z`|Sh7<pH~|jb8KHD!MpYia}Lyu+Ot@)&HI>XeZ(}tCx^}pPZlER5Jer^*}gX^QK-R
+BGb8{2
+
+literal 94
+zcmV-k0HObM)Jh!P2BexYI{K1M2*Xhjg<rBg95P)btB3SD62E>3TEDprVXYw<r9s|q
+z3<q^r!wu=+9KVuWwwGi0e7gXw>S|c&%Px9;9nEE3cL}-^F2dKtTQun3NbDG}SFOY=
+AaR2}S
+
+--"""
+        result = list(wtp.patch.parse_patch(text))
+        assert result
+        assert len(result) == 1
+        assert (
+            hashlib.sha1(result[0].changes[0].line).hexdigest()
+            == "732e7e005ff8b71ab4b72398db0320f2fa012b81"
+        )
+        assert (
+            hashlib.sha1(result[0].changes[1].hunk).hexdigest()
+            == "b07b94142cfce2094b5be04e9d30b653a7c63917"
+        )
+
 
 if __name__ == "__main__":
     unittest.main()

Reply via email to