Support using Git revisions as branch names

[?]
Jul 6, 2015, 1:55 PM
Y55DIQQUP3QCMCG4H2TBO7IEFB4XSBJPQVYXOHKMLHM35LMIY2EAC

Dependencies

  • [2] 3BTJRSU3 GitInput.pm: Don't do a chdir to the Git clone
  • [3] NB2VOKIR Include names of committers in HipChat notifications
  • [4] JAH3UPWA Support revision control systems via plugins

Change contents

  • edit in src/lib/Hydra/Plugin/GitInput.pm at line 14
    [3.5144]
    [3.5144]
    }
    sub _isHash {
    my ($rev) = @_;
    return length($rev) == 40 && $rev =~ /^[0-9a-f]+$/;
  • replacement in src/lib/Hydra/Plugin/GitInput.pm at line 32
    [3.5669][3.5669:5775](),[3.5775][2.1025:1208]()
    # TODO: Optimize the first clone by using "git init $clonePath" and "git remote add origin $uri".
    $res = run(cmd => ["git", "clone", "--branch", $branch, $uri, $clonePath], timeout => 600);
    die "error cloning git repo at `$uri':\n$res->{stderr}" if $res->{status};
    [3.5669]
    [3.5957]
    $res = run(cmd => ["git", "init", $clonePath]);
    $res = run(cmd => ["git", "remote", "add", "origin", "--", $uri], dir => $clonePath) unless $res->{status};
    die "error creating git repo in `$clonePath':\n$res->{stderr}" if $res->{status};
  • replacement in src/lib/Hydra/Plugin/GitInput.pm at line 40
    [3.6238][2.1209:1322]()
    $res = run(cmd => ["git", "fetch", "-fu", "origin", "+$branch:$branch"], dir => $clonePath, timeout => 600);
    [3.6238]
    [2.1322]
    my $localBranch = _isHash($branch) ? "_hydra_tmp" : $branch;
    $res = run(cmd => ["git", "fetch", "-fu", "origin", "+$branch:$localBranch"], dir => $clonePath, timeout => 600);
  • replacement in src/lib/Hydra/Plugin/GitInput.pm at line 87
    [3.998][2.1930:2026]()
    my $revision = grab(cmd => ["git", "rev-parse", "$branch"], dir => $clonePath, chomp => 1);
    [3.998]
    [2.2026]
    my $revision = _isHash($branch) ? $branch
    : grab(cmd => ["git", "rev-parse", "$branch"], dir => $clonePath, chomp => 1);
  • replacement in src/lib/Hydra/Plugin/GitInput.pm at line 114
    [3.8762][3.8762:8896]()
    # script. Thus, we leave `.git' in there. Same for
    # Subversion (e.g., libgcrypt's build system uses that.)
    [3.8762]
    [3.8896]
    # script. Thus, we leave `.git' in there.
  • edit in src/lib/Hydra/Plugin/GitInput.pm at line 124
    [3.9235]
    [2.2137]
    # FIXME: Don't use nix-prefetch-git.