Page MenuHomeDevCentral

D2542.id6419.diff
No OneTemporary

D2542.id6419.diff

diff --git a/_utils/repo/export-commits-to-manyrepo.sh b/_utils/repo/export-commits-to-manyrepo.sh
new file mode 100755
--- /dev/null
+++ b/_utils/repo/export-commits-to-manyrepo.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -e
+
+# Parses arguments
+if [ $# -lt 1 ]; then
+ echo "Usage: $0 <TARGET REPOSITORY>" 1>&2
+ exit 1
+fi
+REPO=$1
+
+set -x
+
+# Prepares new main branch for $REPO
+git subtree split -P "$REPO" -b "$REPO"
+
+# Merge new subtree split branch into main
+git rebase --strategy-option=ours "$REPO" "$REPO"/main
+
+# Push new main
+git push "$REPO" "$REPO"/main:main
+
+# Cleans up
+git checkout main
+git branch -D "$REPO"
diff --git a/_utils/repo/export-commits-to-manyrepos.sh b/_utils/repo/export-commits-to-manyrepos.sh
new file mode 100755
--- /dev/null
+++ b/_utils/repo/export-commits-to-manyrepos.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+_utils/get-repos-modified-by-last-commit.sh | xargs -n 1 _utils/export-commits-to-manyrepo.sh
diff --git a/_utils/repo/get-repos-modified-by-last-commit.sh b/_utils/repo/get-repos-modified-by-last-commit.sh
new file mode 100755
--- /dev/null
+++ b/_utils/repo/get-repos-modified-by-last-commit.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+git diff-tree --no-commit-id --name-only -r HEAD | grep -v -e '_.*' | cut -f1 -d"/" | sort | uniq
diff --git a/_utils/repo/import-commits-from-polyrepos.sh b/_utils/repo/import-commits-from-polyrepos.sh
new file mode 100755
--- /dev/null
+++ b/_utils/repo/import-commits-from-polyrepos.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+_utils/list-repos.sh | xargs -I '{}' -n 1 git merge --strategy recursive --strategy-option subtree={}/ {}/main
diff --git a/_utils/repo/list-repos.sh b/_utils/repo/list-repos.sh
new file mode 100755
--- /dev/null
+++ b/_utils/repo/list-repos.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+git remote -v | awk '{print $1}' | grep -v origin | sort | uniq

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 05:52 (7 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2248780
Default Alt Text
D2542.id6419.diff (1 KB)

Event Timeline