Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3919184
D2542.id6418.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D2542.id6418.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 21, 10:05 (17 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2309337
Default Alt Text
D2542.id6418.diff (1 KB)
Attached To
Mode
D2542: Allow to manage monorepo and manyrepo
Attached
Detach File
Event Timeline
Log In to Comment