https://git.reactos.org/?p=reactos.git;a=commitdiff;h=53cc92613fbfc315409c7d93cc8f5fab83e47a34

commit 53cc92613fbfc315409c7d93cc8f5fab83e47a34
Author:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
AuthorDate: Fri Sep 15 16:15:26 2023 +0200
Commit:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
CommitDate: Mon Dec 18 22:21:41 2023 +0100

    [WINESYNC] Support improvements for staging patches (#5898)
    
    - Simplify patch directory usage;
    - Fix the path shown in the warning message.
    
    The staging patch path in the warning message didn't show the correct
    sub-directory where the patch resides.
---
 sdk/tools/winesync/winesync.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/sdk/tools/winesync/winesync.py b/sdk/tools/winesync/winesync.py
index 72860f98ce1..36646086217 100644
--- a/sdk/tools/winesync/winesync.py
+++ b/sdk/tools/winesync/winesync.py
@@ -137,7 +137,8 @@ class wine_sync:
         if in_staging:
             # see if we already applied this patch
             patch_file_name = 
f'{staging_patch_index:04}-{string_to_valid_file_name(wine_commit.message.splitlines()[0])}.diff'
-            patch_path = os.path.join(self.reactos_src, self.staged_patch_dir, 
patch_file_name)
+            patch_dir = os.path.join(self.reactos_src, self.staged_patch_dir)
+            patch_path = os.path.join(patch_dir, patch_file_name)
             if os.path.isfile(patch_path):
                 print(f'Skipping patch as {patch_path} already exists')
                 return True, ''
@@ -234,8 +235,8 @@ class wine_sync:
         else:
             # Add the staging patch
             # do not save the wine commit ID in <module>.cfg, as it's a local 
one for staging patches
-            if not os.path.isdir(os.path.join(self.reactos_src, 
self.staged_patch_dir)):
-                os.mkdir(os.path.join(self.reactos_src, self.staged_patch_dir))
+            if not os.path.isdir(patch_dir):
+                os.mkdir(patch_dir)
             with open(patch_path, 'w') as file_output:
                 file_output.write(complete_patch)
             self.reactos_index.add(posixpath.join(self.staged_patch_dir, 
patch_file_name))
@@ -264,11 +265,12 @@ class wine_sync:
                     f'You can see the details of the wine commit here:\n' \
                     f'    
https://source.winehq.org/git/wine.git/commit/{str(wine_commit.id)}\n'
             else:
+                patch_file_path = posixpath.join(self.staged_patch_dir, 
patch_file_name)
                 warning_message += f'\n' \
                     f'Do not forget to run\n' \
-                    f'    git diff HEAD^ 
\':(exclude)sdk/tools/winesync/{patch_file_name}\' > 
sdk/tools/winesync/{patch_file_name}\n' \
+                    f'    git diff HEAD^ \':(exclude){patch_file_path}\' > 
{patch_file_path}\n' \
                     f'after your correction and then\n' \
-                    f'    git add sdk/tools/winesync/{patch_file_name}\n' \
+                    f'    git add {patch_file_path}\n' \
                     f'before running "git commit --amend"'
 
         return True, warning_message

Reply via email to