Compare commits

..
3 Commits
Author SHA1 Message Date
tangent fca4eee077 Update ReadMe.md 2026-09-14 02:47:24 -06:00
tangent 6fc0803095 extracted bundles and sent them 2026-08-17 19:24:39 -06:00
tangent c45a147e84 Update ReadMe.md 2026-08-16 18:56:27 -06:00
2 changed files with 24 additions and 16 deletions

No files matched your search

+2
View File
@@ -1,4 +1,5 @@
# repo-manager # repo-manager
Script to automate mirroring and copying of git repos.
- [x] store repositories keyed by name (tree-style is better for avoiding conflicts while being specific and easy to follow) - [x] store repositories keyed by name (tree-style is better for avoiding conflicts while being specific and easy to follow)
- [x] repositories have a ~~source~~ origin url and optional mirror URLs (just one for now, called `target`) - [x] repositories have a ~~source~~ origin url and optional mirror URLs (just one for now, called `target`)
@@ -37,6 +38,7 @@ The idea is to make a tree based on the *source* of a repo,
with special keys for what to do with that source, with special keys for what to do with that source,
and optional `target` URLs for mirroring. and optional `target` URLs for mirroring.
- `description`: Short description typically displayed in lists on hosting services. - `description`: Short description typically displayed in lists on hosting services.
- `issues`: Like `redundant` below, this is a temporary tag for helping me sort things out.
- `private`: If a repo needs to be created, it will be private only if this is true. - `private`: If a repo needs to be created, it will be private only if this is true.
- `redundant`: This repo really doesn't need to exist, but hasn't been removed yet. (This is essentially for my own notes.) - `redundant`: This repo really doesn't need to exist, but hasn't been removed yet. (This is essentially for my own notes.)
- `target`: A repo URL to force-push to for mirroring. - `target`: A repo URL to force-push to for mirroring.
+22 -16
View File
@@ -2,25 +2,31 @@
package.path = (arg[0]:match("@?(.*/)") or arg[0]:match("@?(.*\\)")) .. "lib" .. package.config:sub(1, 1) .. "?.lua;" .. package.path package.path = (arg[0]:match("@?(.*/)") or arg[0]:match("@?(.*\\)")) .. "lib" .. package.config:sub(1, 1) .. "?.lua;" .. package.path
local utility = require "utility" local utility = require "utility"
-- TEMP import repos from export, add target information to mirrors local extract_bundles = function(path)
local export = utility.load_data("export.json") utility.list(path, function(file_name)
local data = utility.load_data("respositories.json") local _, name, extension = utility.split_path_components(file_name)
data.respositories["https://gitea.tangentfox.com/"] = {} if not extension or not (extension == "bundle") then return end -- only work on bundles
local old_site = data.respositories["https://gitea.tangentfox.com/"]
for name, repo in pairs(export.repositories) do local output_path, repo_name
local org = repo.organization if extension then
if not old_site[org] then old_site[org] = {} end repo_name = name:sub(1, -(#extension + 2) - #("-main"))
old_site[org][name] = { description = repo.description, website = repo.website, } output_path = path .. "/" .. repo_name
end
if utility.path_exists(output_path) then
return
end
os.execute("git clone " .. name:enquote() .. " " .. output_path:enquote())
-- TEMP since I happen to be moving Minecraft organization items right now..
-- os.execute("git clone " .. name:enquote() .. " " .. output_path:enquote()
-- .. " && cd " .. output_path:enquote()
-- .. " && git remote set-url origin https://tangent@gitea2.tangentfox.com/Minecraft/" .. repo_name
-- .. " && git push origin")
end)
end end
for url, org in pairs(data.mirrors["https://github.com/"]) do extract_bundles(".")
for name, repo in pairs(org) do
repo.target = "https://gitea2.tangentfox.com/mirrors/" .. name
end
end
utility.save_data(data)
os.exit() os.exit()
-- TODO add support for private repos by making it warn the user -- TODO add support for private repos by making it warn the user