Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-unidiff for openSUSE:Factory 
checked in at 2022-06-28 15:22:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-unidiff (Old)
 and      /work/SRC/openSUSE:Factory/.python-unidiff.new.1548 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-unidiff"

Tue Jun 28 15:22:49 2022 rev:10 rq:985511 version:0.7.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-unidiff/python-unidiff.changes    
2022-02-09 20:41:06.802650567 +0100
+++ /work/SRC/openSUSE:Factory/.python-unidiff.new.1548/python-unidiff.changes  
2022-06-28 15:23:10.858014815 +0200
@@ -1,0 +2,7 @@
+Mon Jun 27 07:35:14 UTC 2022 - Martin Li??ka <mli...@suse.cz>
+
+- Update to version 0.7.4
+  * Fixed git diff parsing issues (filename with spaces,
+    only one added/deleted file).
+
+-------------------------------------------------------------------

Old:
----
  v0.7.3.tar.gz

New:
----
  v0.7.4.tar.gz

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

Other differences:
------------------
++++++ python-unidiff.spec ++++++
--- /var/tmp/diff_new_pack.Tihjcu/_old  2022-06-28 15:23:11.346015543 +0200
+++ /var/tmp/diff_new_pack.Tihjcu/_new  2022-06-28 15:23:11.350015549 +0200
@@ -18,7 +18,7 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-unidiff
-Version:        0.7.3
+Version:        0.7.4
 Release:        0
 Summary:        Unified diff parsing/metadata extraction library
 License:        MIT

++++++ v0.7.3.tar.gz -> v0.7.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-unidiff-0.7.3/AUTHORS 
new/python-unidiff-0.7.4/AUTHORS
--- old/python-unidiff-0.7.3/AUTHORS    2022-02-06 20:02:48.000000000 +0100
+++ new/python-unidiff-0.7.4/AUTHORS    2022-06-26 22:11:08.000000000 +0200
@@ -30,3 +30,5 @@
   * (`@huichen-cs`)
   * Mikhail f. Shiryaev (`@Felixoid`)
   * Ronuk Raval (`@rraval`)
+  * anthony sottile (`@asottile-sentry`)
+  * (`@cpackham-atlnz`)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-unidiff-0.7.3/HISTORY 
new/python-unidiff-0.7.4/HISTORY
--- old/python-unidiff-0.7.3/HISTORY    2022-02-06 20:02:48.000000000 +0100
+++ new/python-unidiff-0.7.4/HISTORY    2022-06-26 22:11:08.000000000 +0200
@@ -1,6 +1,11 @@
 History
 -------
 
+0.7.4 - 2022-06-26
+------------------
+
+* Fixed git diff parsing issues (filename with spaces, only one added/deleted 
file).
+
 0.7.3 - 2022-02-06
 ------------------
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-unidiff-0.7.3/tests/samples/git_delete.diff 
new/python-unidiff-0.7.4/tests/samples/git_delete.diff
--- old/python-unidiff-0.7.3/tests/samples/git_delete.diff      1970-01-01 
01:00:00.000000000 +0100
+++ new/python-unidiff-0.7.4/tests/samples/git_delete.diff      2022-06-26 
22:11:08.000000000 +0200
@@ -0,0 +1,16 @@
+diff --git a/somefile.c b/somefile.c
+deleted file mode 100644
+index abcdefbbb8..0000000000
+--- a/somefile.c
++++ /dev/null
+@@ -1,10 +0,0 @@
+-/**
+- *  @file somefile.c
+- */
+-#include <stdio.h>
+-
+-int main(int argc, cahr *argv[])
+-{
+-      printf("Hello World\n");
+-      return 0;
+-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/python-unidiff-0.7.3/tests/samples/git_filenames_with_spaces.diff 
new/python-unidiff-0.7.4/tests/samples/git_filenames_with_spaces.diff
--- old/python-unidiff-0.7.3/tests/samples/git_filenames_with_spaces.diff       
1970-01-01 01:00:00.000000000 +0100
+++ new/python-unidiff-0.7.4/tests/samples/git_filenames_with_spaces.diff       
2022-06-26 22:11:08.000000000 +0200
@@ -0,0 +1,7 @@
+diff --git a/has spaces/t.sql b/has spaces/t.sql
+new file mode 100644
+index 0000000..8a9b485
+--- /dev/null
++++ b/has spaces/t.sql
+@@ -0,0 +1 @@
++select * FROM t;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-unidiff-0.7.3/tests/test_parser.py 
new/python-unidiff-0.7.4/tests/test_parser.py
--- old/python-unidiff-0.7.3/tests/test_parser.py       2022-02-06 
20:02:48.000000000 +0100
+++ new/python-unidiff-0.7.4/tests/test_parser.py       2022-06-26 
22:11:08.000000000 +0200
@@ -313,6 +313,28 @@
         self.assertTrue(res[2].is_added_file)
         self.assertEqual(res[2].path, 'file3')
 
+    def test_parse_filename_with_spaces(self):
+        filename = os.path.join(self.samples_dir, 
'samples/git_filenames_with_spaces.diff')
+        with open(filename) as f:
+            res = PatchSet(f)
+
+        self.assertEqual(len(res), 1)
+
+        self.assertEqual(res[0].source_file, '/dev/null')
+        self.assertEqual(res[0].target_file, 'b/has spaces/t.sql')
+        self.assertTrue(res[0].is_added_file)
+        self.assertEqual(res[0].path, 'has spaces/t.sql')
+
+    def test_deleted_file(self):
+        filename = os.path.join(self.samples_dir, 'samples/git_delete.diff')
+        with open(filename) as f:
+            res = PatchSet(f)
+
+        self.assertEqual(len(res), 1)
+        self.assertEqual(res[0].source_file, 'a/somefile.c')
+        self.assertEqual(res[0].target_file, '/dev/null')
+        self.assertTrue(res[0].is_removed_file)
+
     def test_diff_lines_linenos(self):
         with open(self.sample_file, 'rb') as diff_file:
             res = PatchSet(diff_file, encoding='utf-8')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-unidiff-0.7.3/unidiff/__version__.py 
new/python-unidiff-0.7.4/unidiff/__version__.py
--- old/python-unidiff-0.7.3/unidiff/__version__.py     2022-02-06 
20:02:48.000000000 +0100
+++ new/python-unidiff-0.7.4/unidiff/__version__.py     2022-06-26 
22:11:08.000000000 +0200
@@ -21,4 +21,4 @@
 # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
 # OR OTHER DEALINGS IN THE SOFTWARE.
 
-__version__ = '0.7.3'
+__version__ = '0.7.4'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-unidiff-0.7.3/unidiff/constants.py 
new/python-unidiff-0.7.4/unidiff/constants.py
--- old/python-unidiff-0.7.3/unidiff/constants.py       2022-02-06 
20:02:48.000000000 +0100
+++ new/python-unidiff-0.7.4/unidiff/constants.py       2022-06-26 
22:11:08.000000000 +0200
@@ -37,13 +37,15 @@
 
 # check diff git line for git renamed files support
 RE_DIFF_GIT_HEADER = re.compile(
-    r'^diff --git (?P<source>(a/)?[^\t\n]+) (?P<target>(b/)?[^\t\n]+)')
+    r'^diff --git (?P<source>a/[^\t\n]+) (?P<target>b/[^\t\n]+)')
+RE_DIFF_GIT_HEADER_NO_PREFIX = re.compile(
+    r'^diff --git (?P<source>[^\t\n]+) (?P<target>[^\t\n]+)')
 
 # check diff git new file marker `deleted file mode 100644`
-RE_DIFF_GIT_DELETED_FILE = re.compile(r'^deleted file mode \d+\n$')
+RE_DIFF_GIT_DELETED_FILE = re.compile(r'^deleted file mode \d+$')
 
 # check diff git new file marker `new file mode 100644`
-RE_DIFF_GIT_NEW_FILE = re.compile(r'^new file mode \d+\n$')
+RE_DIFF_GIT_NEW_FILE = re.compile(r'^new file mode \d+$')
 
 
 # @@ (source offset, length) (target offset, length) @@ (section header)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/python-unidiff-0.7.3/unidiff/patch.py 
new/python-unidiff-0.7.4/unidiff/patch.py
--- old/python-unidiff-0.7.3/unidiff/patch.py   2022-02-06 20:02:48.000000000 
+0100
+++ new/python-unidiff-0.7.4/unidiff/patch.py   2022-06-26 22:11:08.000000000 
+0200
@@ -40,6 +40,7 @@
     LINE_VALUE_NO_NEWLINE,
     RE_DIFF_GIT_DELETED_FILE,
     RE_DIFF_GIT_HEADER,
+    RE_DIFF_GIT_HEADER_NO_PREFIX,
     RE_DIFF_GIT_NEW_FILE,
     RE_HUNK_BODY_LINE,
     RE_HUNK_EMPTY_BODY_LINE,
@@ -478,7 +479,7 @@
                 line = line.decode(encoding)
 
             # check for a git file rename
-            is_diff_git_header = RE_DIFF_GIT_HEADER.match(line)
+            is_diff_git_header = RE_DIFF_GIT_HEADER.match(line) or 
RE_DIFF_GIT_HEADER_NO_PREFIX.match(line)
             if is_diff_git_header:
                 patch_info = PatchInfo()
                 source_file = is_diff_git_header.group('source')

Reply via email to