[rtems-lwip commit] lwip-to-rtems.py: Add support for reverse changes

Joel Sherrill joel at rtems.org
Fri Aug 26 13:56:17 UTC 2022


Module:    rtems-lwip
Branch:    main
Commit:    20dd29f6422226d0918e138ab10232a1f777bad7
Changeset: http://git.rtems.org/rtems-lwip/commit/?id=20dd29f6422226d0918e138ab10232a1f777bad7

Author:    Kinsey Moore <kinsey.moore at oarcorp.com>
Date:      Wed Aug 24 13:22:12 2022 -0500

lwip-to-rtems.py: Add support for reverse changes

This adds the necessary support for moving changes back and forth to the
upstream repository.

---

 lwip-to-rtems.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/lwip-to-rtems.py b/lwip-to-rtems.py
index acd6922..1be2628 100755
--- a/lwip-to-rtems.py
+++ b/lwip-to-rtems.py
@@ -86,8 +86,8 @@ print("Direction:                   %s" % (("reverse", "forward")[isForward]))
 
 
 def copyFiles(isforward):
+    files = json.load(open('file-import.json', 'r'))
     if (isforward):
-        files = json.load(open('file-import.json', 'r'))
         src_dir = os.path.abspath(LWIP_UPSTREAM_DIR)
         print("Files Imported:")
         for f in files['files-to-import']:
@@ -95,10 +95,14 @@ def copyFiles(isforward):
             dst_file = os.path.join(dst_dir, f.split('/')[-1])
             if not os.path.exists(dst_dir):
                 os.makedirs(dst_dir)
-            if not os.path.exists(dst_file):
-                Path(dst_file).touch()
-                print(dst_file)
-                copyfile(str(os.path.join(src_dir, f)),
-                         str(dst_file))
+            Path(dst_file).touch()
+            print(dst_file)
+            copyfile(str(os.path.join(src_dir, f)),
+                     str(dst_file))
+    else:
+        for f in files['files-to-import']:
+            src_file = os.path.join(os.path.abspath(LWIP_DIR), f)
+            dst_file = os.path.join(os.path.abspath(LWIP_UPSTREAM_DIR), f)
+            copyfile(str(src_file), str(dst_file))
 
 copyFiles(isForward)



More information about the vc mailing list