Title: [280457] trunk/Tools
Revision
280457
Author
jbed...@apple.com
Date
2021-07-29 17:10:03 -0700 (Thu, 29 Jul 2021)

Log Message

[git-webkit] Handle relative paths in filtered commands
https://bugs.webkit.org/show_bug.cgi?id=228606
<rdar://problem/81289748>

Reviewed by Aakash Jain.

* Scripts/libraries/webkitscmpy/setup.py: Bump version.
* Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
* Scripts/libraries/webkitscmpy/webkitscmpy/program/command.py:
(FilteredCommand.pager): Child process should use the same current working directory.
(FilteredCommand.main): Convert any file names to their absolute paths.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (280456 => 280457)


--- trunk/Tools/ChangeLog	2021-07-29 23:54:44 UTC (rev 280456)
+++ trunk/Tools/ChangeLog	2021-07-30 00:10:03 UTC (rev 280457)
@@ -1,3 +1,17 @@
+2021-07-29  Jonathan Bedard  <jbed...@apple.com>
+
+        [git-webkit] Handle relative paths in filtered commands
+        https://bugs.webkit.org/show_bug.cgi?id=228606
+        <rdar://problem/81289748>
+
+        Reviewed by Aakash Jain.
+
+        * Scripts/libraries/webkitscmpy/setup.py: Bump version.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py: Ditto.
+        * Scripts/libraries/webkitscmpy/webkitscmpy/program/command.py:
+        (FilteredCommand.pager): Child process should use the same current working directory.
+        (FilteredCommand.main): Convert any file names to their absolute paths.
+
 2021-07-29  Tim Horton  <timothy_hor...@apple.com>
 
         Simplify ImageDiff SDK logic

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/setup.py (280456 => 280457)


--- trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2021-07-29 23:54:44 UTC (rev 280456)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/setup.py	2021-07-30 00:10:03 UTC (rev 280457)
@@ -29,7 +29,7 @@
 
 setup(
     name='webkitscmpy',
-    version='1.0.1',
+    version='1.0.2',
     description='Library designed to interact with git and svn repositories.',
     long_description=readme(),
     classifiers=[

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py (280456 => 280457)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2021-07-29 23:54:44 UTC (rev 280456)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/__init__.py	2021-07-30 00:10:03 UTC (rev 280457)
@@ -46,7 +46,7 @@
         "Please install webkitcorepy with `pip install webkitcorepy --extra-index-url <package index URL>`"
     )
 
-version = Version(1, 0, 1)
+version = Version(1, 0, 2)
 
 AutoInstall.register(Package('fasteners', Version(0, 15, 0)))
 AutoInstall.register(Package('monotonic', Version(1, 5)))

Modified: trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/command.py (280456 => 280457)


--- trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/command.py	2021-07-29 23:54:44 UTC (rev 280456)
+++ trunk/Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/command.py	2021-07-30 00:10:03 UTC (rev 280457)
@@ -116,6 +116,7 @@
             child = subprocess.Popen(
                 [sys.executable, file, repository.root_path, args.representation] + args.args,
                 env=environ,
+                cwd=os.getcwd(),
                 stdout=subprocess.PIPE,
                 stderr=subprocess.PIPE,
             )
@@ -158,16 +159,26 @@
 
         for index in range(len(args)):
             parsed = Commit.parse(args[index], do_assert=False)
-            if not parsed:
+            if parsed:
+                replacement = None
+                if repository.is_svn:
+                    replacement = repository.cache.to_revision(hash=parsed.hash, identifier=str(parsed) if parsed.identifier else None)
+                if repository.is_git:
+                    replacement = repository.cache.to_hash(revision=parsed.revision, identifier=str(parsed) if parsed.identifier else None)
+                if replacement:
+                    args[index] = replacement
                 continue
-            replacement = None
-            if repository.is_svn:
-                replacement = repository.cache.to_revision(hash=parsed.hash, identifier=str(parsed) if parsed.identifier else None)
-            if repository.is_git:
-                replacement = repository.cache.to_hash(revision=parsed.revision, identifier=str(parsed) if parsed.identifier else None)
-            if replacement:
-                args[index] = replacement
 
+            for candidate in [
+                os.path.abspath(os.path.join(os.getcwd(), args[index])),
+                os.path.abspath(os.path.join(repository.root_path, args[index])),
+            ]:
+                if not candidate.startswith(repository.root_path):
+                    continue
+                if os.path.exists(candidate):
+                    args[index] = candidate
+                    break
+
         log_output = subprocess.Popen(
             [repository.executable(), command] + args,
             cwd=repository.root_path,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to