Skip to content
This repository was archived by the owner on Feb 12, 2020. It is now read-only.

Commit ff54b87

Browse files
committed
Allow the default language to be specified.
1 parent 932868e commit ff54b87

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.env.sample

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ OWNER_ID=
88
CSV_FILE=
99
# The base part of the URL existing repos are on (http://example.com)
1010
ORIGIN_BASE=
11+
# The default language to import with
12+
DEFAULT_LANG=

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ for what is required.
1414

1515
Second you must have a CSV file with the following column types, in order:
1616

17-
`"Repo path","Project name","Project path","Namespace Path","Project ID","wiki_enabled","New name","description"`
17+
`"Repo path","Project name","Project path","Namespace Path","Project ID","Wiki","New name","Language","Description"`
1818

1919
The column names do not matter. Alternatively you can modify the `$get_repos`
2020
function to suit your data format (recommended).

migrate-repos.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
'ORIGIN_BASE',
1616
])->notEmpty();
1717

18+
$env->required(['DEFAULT_LANG']);
19+
1820
define('CSV_FILE', getenv('CSV_FILE'));
1921
define('USERNAME', getenv('USERNAME'));
2022
define('PASSWORD', getenv('PASSWORD'));
2123
define('OWNER_ID', getenv('OWNER_ID'));
2224
define('ORIGIN_BASE', getenv('ORIGIN_BASE'));
25+
define('DEFAULT_LANG', getenv('DEFAULT_LANG'));
2326
define('BITBUCKET_BASE', 'https://bitbucket.org');
2427
define('BITBUCKET_IMPORT', 'https://bitbucket.org/repo/import');
2528

@@ -43,7 +46,7 @@
4346
'no_forks' => FALSE,
4447
'no_public_forks' => TRUE,
4548
'has_wiki' => FALSE,
46-
'language' => 'php',
49+
'language' => DEFAULT_LANG,
4750
];
4851

4952
// Pull repository information out of a CSV file.
@@ -59,7 +62,8 @@
5962
'name' => $line[1],
6063
'wiki' => $line[5],
6164
'new_name' => $line[6],
62-
'description' => $line[7],
65+
'language' => $line[7],
66+
'description' => $line[8],
6367
];
6468
}
6569

@@ -99,6 +103,7 @@
99103
'name' => empty($info['new_name']) ? $info['name'] : $info['new_name'],
100104
'description' => $info['description'],
101105
'has_wiki' => !empty($info['wiki']),
106+
'language' => !empty($info['language']) ? $info['language'] : DEFAULT_LANG,
102107
];
103108
$data = array_merge($default_data, $repo_data);
104109

0 commit comments

Comments
 (0)