Changeset 185710 in webkit


Ignore:
Timestamp:
Jun 18, 2015 11:00:11 AM (9 years ago)
Author:
dbates@webkit.org
Message:

Make webkitdirs::runGitUpdate() work when invoked in more than one Git checkout
https://bugs.webkit.org/show_bug.cgi?id=146082

Reviewed by Darin Adler.

The function webkitdirs::runGitUpdate may not update the Git checkout in the current
working directory after being invoked in a different Git checkout. In particular,
calling runGitUpdate() inside a Git SVN checkout and subsequently calling it inside
a pure Git checkout g will fail to update g.

Currently webkitdirs::runGitUpdate() calls VCSUtils::isGitSVN() to determine whether
the current working directory is a Git SVN checkout. And isGitSVN() caches its result
to speed up subsequent queries. This prevents runGitUpdate() from being used to update
an arbitrary Git checkout (since isGitSVN() may return a cached result for a directory
different than the current working directory). Instead runGitUpdate() should check
whether the current working directory is a Git SVN checkout on each invocation.

  • Scripts/VCSUtils.pm: Export function isGitSVNDirectory so that it can be used from webkitdirs::runGitUpdate().

(isGitSVNDirectory): Extracted logic to determine whether a directory is a Git
SVN directory from isGitSVN().
(isGitSVN): Implemented in terms of isGitSVNDirectory().

  • Scripts/webkitdirs.pm:

(runGitUpdate): Modified to use isGitSVNDirectory().

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r185708 r185710  
     12015-06-18  Daniel Bates  <dabates@apple.com>
     2
     3        Make webkitdirs::runGitUpdate() work when invoked in more than one Git checkout
     4        https://bugs.webkit.org/show_bug.cgi?id=146082
     5
     6        Reviewed by Darin Adler.
     7
     8        The function webkitdirs::runGitUpdate may not update the Git checkout in the current
     9        working directory after being invoked in a different Git checkout. In particular,
     10        calling runGitUpdate() inside a Git SVN checkout and subsequently calling it inside
     11        a pure Git checkout g will fail to update g.
     12
     13        Currently webkitdirs::runGitUpdate() calls VCSUtils::isGitSVN() to determine whether
     14        the current working directory is a Git SVN checkout. And isGitSVN() caches its result
     15        to speed up subsequent queries. This prevents runGitUpdate() from being used to update
     16        an arbitrary Git checkout (since isGitSVN() may return a cached result for a directory
     17        different than the current working directory). Instead runGitUpdate() should check
     18        whether the current working directory is a Git SVN checkout on each invocation.
     19
     20        * Scripts/VCSUtils.pm: Export function isGitSVNDirectory so that it can be used from webkitdirs::runGitUpdate().
     21        (isGitSVNDirectory): Extracted logic to determine whether a directory is a Git
     22        SVN directory from isGitSVN().
     23        (isGitSVN): Implemented in terms of isGitSVNDirectory().
     24        * Scripts/webkitdirs.pm:
     25        (runGitUpdate): Modified to use isGitSVNDirectory().
     26
    1272015-06-18  Mark Lam  <mark.lam@apple.com>
    228
  • trunk/Tools/Scripts/VCSUtils.pm

    r185664 r185710  
    6767        &isGitBranchBuild
    6868        &isGitDirectory
     69        &isGitSVNDirectory
    6970        &isSVN
    7071        &isSVNDirectory
     
    225226}
    226227
    227 sub isGitSVN()
    228 {
    229     return $isGitSVN if defined $isGitSVN;
     228sub isGitSVNDirectory($)
     229{
     230    my ($directory) = @_;
     231
     232    my $savedWorkingDirectory = Cwd::getcwd();
     233    chdir($directory);
    230234
    231235    # There doesn't seem to be an officially documented way to determine
     
    234238    my $output = `git config --get svn-remote.svn.fetch 2>& 1`;
    235239    $isGitSVN = $output ne '';
     240    chdir($savedWorkingDirectory);
     241    return $isGitSVN;
     242}
     243
     244sub isGitSVN()
     245{
     246    return $isGitSVN if defined $isGitSVN;
     247
     248    $isGitSVN = isGitSVNDirectory(".");
    236249    return $isGitSVN;
    237250}
  • trunk/Tools/Scripts/webkitdirs.pm

    r184202 r185710  
    24952495    # to perform the rebase much much faster.
    24962496    system("git", "fetch");
    2497     if (isGitSVN()) {
     2497    if (isGitSVNDirectory(".")) {
    24982498        system("git", "svn", "rebase") == 0 or die;
    24992499    } else {
Note: See TracChangeset for help on using the changeset viewer.