-
Notifications
You must be signed in to change notification settings - Fork 1
/
hubdrop-create-mirror.php
executable file
·76 lines (76 loc) · 1.99 KB
/
hubdrop-create-mirror.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/php
<?php
//
//// Get Project from $argv
//if (empty($argv[1])){
// exit("You need to specify a Drupal.org project.\n");
//} else {
// $project = $argv[1];
//}
//
//// Get Path
//if (!empty($argv[2])){
// if (!file_exists($argv[2])){
// exit("You must specify a path that exists.\n");
// } else {
// $path = $argv[2];
// }
//}
//// Default path
//else {
// $path = '.';
//}
//
//$hubdrop_github_org = 'drupalprojects';
//
//$drupal_git_repo = "http://git.drupal.org/project/$project.git";
//$github_git_repo = "[email protected]:$hubdrop_github_org/$project.git";
//
//// Hello World
//print "Welcome to hubdrop.\n";
//print "==================\n";
//print "Cloning $drupal_git_repo...\n";
//print "------------------\n";
//
//// Clone the Drupal.org repo.
//// See https://help.github.com/articles/duplicating-a-repository
//
//if ($path){
// $repo_path = "$path/$project.git";
//} else {
// $repo_path = "$project.git";
//}
//$clone_cmd = "git clone $drupal_git_repo $repo_path --mirror";
//
//print "Running $clone_cmd \n";
//print "------------------\n";
//if (!exec($clone_cmd)){
// exit("Unable to clone repo.\n");
//}
//
//// @TODO: Invoke GitHub API to create the repo, if it doesn't exist yet.
//
//// Change to path directory
//chdir($repo_path);
//
//// Set fetch configs to ignore pull requests
//// See http://christoph.ruegg.name/blog/git-howto-mirror-a-github-repository-without-pull-refs.html
//exec('git config --local --unset-all remote.origin.fetch');
//exec('git config --local remote.origin.fetch "+refs/tags/*:refs/tags/*"');
//exec('git config --local remote.origin.fetch "+refs/heads/*:refs/heads/*" --add');
//
//print hexec("git remote set-url --push origin $github_git_repo");
//print hexec("git fetch -p origin");
//print hexec("git push --mirror");
//print hexec("chmod g+w . -R");
//
///**
// * HubDrop Exec
// */
//function hexec($cmd){
// $output = '';
// $output .= "Running $cmd \n";
// $output .="------------------\n";
// $output .= shell_exec($cmd);
// return $output;
//}