+2017-09-06 Daniel Bates <dabates@apple.com>
+
+ Copy WebKit Permalink may generate wrong URL with SVN checkout
+ https://bugs.webkit.org/show_bug.cgi?id=176427
+
+ Reviewed by Darin Adler.
+
+ Fixes an issue where Copy WebKit Permalink would generate an incorrect URL for
+ any file not in the top-level directory of the repository when using an SVN
+ checkout of WebKit.
+
+ Copy WebKit Permalink changes directories to the containing directory D of the
+ active Xcode document F before running "svn info <path to F>". Currently we use
+ the value of "Path" from the output of "svn info" when generating the permalink.
+ This path is relative to D. But we want the path to F relative to the top-level
+ checkout directory. We need to explicitly compute this.
+
+ * CopyPermalink/Copy WebKit Permalink.workflow/Contents/document.wflow:
+
2017-09-06 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Bump freetype version to 2.8.0
function pathRelativeToRepositoryRootForPath(path)
{
- var checkoutDirectory = isDirectory(path) ? path : dirname(path);
+ var directoryInCheckout = isDirectory(path) ? path : dirname(path);
if (g_isSVN)
- return svnPathRelativeToRepositoryRootForPath(path, checkoutDirectory);
+ return svnPathRelativeToRepositoryRootForPath(path, directoryInCheckout);
if (g_isGit)
- return gitPathRelativeToRepositoryRootForPath(path, checkoutDirectory);
+ return gitPathRelativeToRepositoryRootForPath(path, directoryInCheckout);
return "";
}
-function gitPathRelativeToRepositoryRootForPath(path, checkoutDirectory)
+function gitPathRelativeToRepositoryRootForPath(path, directoryInCheckout)
{
- return App.doShellScript(`git -C '${checkoutDirectory}' ls-tree --full-name --name-only HEAD '${path}'`);
+ return App.doShellScript(`git -C '${directoryInCheckout}' ls-tree --full-name --name-only HEAD '${path}'`);
}
-function svnPathRelativeToRepositoryRootForPath(path, checkoutDirectory)
+function svnPathRelativeToRepositoryRootForPath(path, directoryInCheckout)
{
- return svnInfoForPath(path, checkoutDirectory).path;
+ return svnInfoForPath(path, directoryInCheckout).path;
}
function revisionInfoForPath(path)
{
- var checkoutDirectory = isDirectory(path) ? path : dirname(path);
+ var directoryInCheckout = isDirectory(path) ? path : dirname(path);
if (g_isSVN || g_isGitSVN)
- return svnRevisionInfoForPath(path, checkoutDirectory);
+ return svnRevisionInfoForPath(path, directoryInCheckout);
if (g_isGit)
- return gitRevisionInfoForPath(path, checkoutDirectory);
+ return gitRevisionInfoForPath(path, directoryInCheckout);
return "";
}
-function svnRevisionInfoForPath(path, checkoutDirectory)
+function svnRevisionInfoForPath(path, directoryInCheckout)
{
- var svnInfo = svnInfoForPath(path, checkoutDirectory);
+ var svnInfo = svnInfoForPath(path, directoryInCheckout);
return { "branch": svnInfo.branch, "revision": svnInfo.revision, "repositoryURL": svnInfo.repositoryRoot };
}
-function gitRevisionInfoForPath(path, checkoutDirectory)
+function gitRevisionInfoForPath(path, directoryInCheckout)
{
- var repositoryURL = App.doShellScript(`git -C '${checkoutDirectory}' remote get-url origin`);
- var revision = App.doShellScript(`git -C '${checkoutDirectory}' log -1 --format='%H' '${path}'`);
- var branch = App.doShellScript(`git -C '${checkoutDirectory}' symbolic-ref -q HEAD`);
+ var repositoryURL = App.doShellScript(`git -C '${directoryInCheckout}' remote get-url origin`);
+ var revision = App.doShellScript(`git -C '${directoryInCheckout}' log -1 --format='%H' '${path}'`);
+ var branch = App.doShellScript(`git -C '${directoryInCheckout}' symbolic-ref -q HEAD`);
branch = branch.replace(/^refs\/heads\//, "") || "master";
return { branch, revision, repositoryURL };
}
-function svnInfoForPath(path, checkoutDirectory)
+function svnInfoForPath(path, directoryInCheckout)
{
if (g_lastSVNInfo && g_lastSVNInfo.path === path) {
// FIXME: We should also ensure that the checkout directory for the cached SVN info is
var svnInfoCommand = "svn info";
if (g_isGitSVN)
svnInfoCommand = "git " + svnInfoCommand;
- var output = App.doShellScript(`cd '${checkoutDirectory}' && ${svnInfoCommand} '${path}'`, {"alteringLineEndings": false});
+ var output = App.doShellScript(`cd '${directoryInCheckout}' && ${svnInfoCommand} '${path}'`, {"alteringLineEndings": false});
if (!output)
return { };
temp[key] = value;
}
var svnInfo = {
- "path": temp["Path"],
"pathAsURL": temp["URL"],
"repositoryRoot": temp["Repository Root"],
"revision": temp["Revision"],
branch = branch.substr(0, branch.indexOf("/"));
svnInfo.branch = branch;
+ // Although tempting to use temp["Path"] we cannot because it is relative to directoryInCheckout.
+ // And directoryInCheckout may not be the top-level checkout directory. We need to compute the
+ // relative path with respect to the top-level checkout directory.
+ svnInfo.path = svnInfo.pathAsURL.replace(`${svnInfo.repositoryRoot}/${branch}/`, "");
+
g_lastSVNInfo = svnInfo;
return svnInfo;