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

Commit 932868e

Browse files
committed
Initial code commit
1 parent 63b2501 commit 932868e

File tree

6 files changed

+451
-0
lines changed

6 files changed

+451
-0
lines changed

.env.sample

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# BitBucket username
2+
USERNAME=
3+
# BitBucket password
4+
PASSWORD=
5+
# User/team ID to assign repos to
6+
OWNER_ID=
7+
# File to load repo information from (./repos.csv)
8+
CSV_FILE=
9+
# The base part of the URL existing repos are on (http://example.com)
10+
ORIGIN_BASE=

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
vendor/
2+
.env
3+
*.csv

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# BitBucket bulk importer
2+
3+
Just a quick script to leverage BitBucket's repository import feature and import
4+
a lot of repositories in one go. They currently do not have an API endpoint for
5+
this functionality.
6+
7+
# Usage
8+
9+
Origin repositories must be world accessible, or you must update the code to
10+
handle specifying authentication information to the BitBucket importer.
11+
12+
First you must create a .env file with the correct information See .env.sample
13+
for what is required.
14+
15+
Second you must have a CSV file with the following column types, in order:
16+
17+
`"Repo path","Project name","Project path","Namespace Path","Project ID","wiki_enabled","New name","description"`
18+
19+
The column names do not matter. Alternatively you can modify the `$get_repos`
20+
function to suit your data format (recommended).
21+
22+
The final step is to run `php -f migrate-repos.php` and allow it to process your
23+
repository list. You should get e-mails from BitBucket as the repositories
24+
complete.
25+
26+
# Note! Important!
27+
28+
The script as-is is customized for my specific setup. Some of it has been
29+
abstracted out into a .env file, but key areas to work with are changing
30+
`$default_data` to suit your needs, the `$get_repos` to change how the CSV info
31+
gets mapped, and `$repo_data` if you don't have a `new_name` key in your repo
32+
information.

composer.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"require": {
3+
"vlucas/phpdotenv": "^2.0",
4+
"guzzlehttp/guzzle": "^6.0"
5+
}
6+
}

composer.lock

+284
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)