summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2013-06-12 09:25:31 +0100
committerColin Guthrie <colin@mageia.org>2013-06-12 09:25:31 +0100
commitb2fac4bcb881f1ed96e634a265ff0ee3528925f7 (patch)
tree532e87ca8c22c2aada088bc0c0a09332324ac6c1 /scripts
parent7d02bfadfe76d6701201531ffcaa867ea1c869eb (diff)
downloadsvn-git-migration-b2fac4bcb881f1ed96e634a265ff0ee3528925f7.tar
svn-git-migration-b2fac4bcb881f1ed96e634a265ff0ee3528925f7.tar.gz
svn-git-migration-b2fac4bcb881f1ed96e634a265ff0ee3528925f7.tar.bz2
svn-git-migration-b2fac4bcb881f1ed96e634a265ff0ee3528925f7.tar.xz
svn-git-migration-b2fac4bcb881f1ed96e634a265ff0ee3528925f7.zip
Delete any branches/tags which are newer than our reset commit.
This prevents newer Mandriva tags and branches leaking into Mageia GIT repos
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mageia-reset-and-import.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/mageia-reset-and-import.sh b/scripts/mageia-reset-and-import.sh
index b24abe5..da290ec 100755
--- a/scripts/mageia-reset-and-import.sh
+++ b/scripts/mageia-reset-and-import.sh
@@ -99,6 +99,30 @@ else
git update-ref -m "Rewind SVN Git to pre-Magiea import" refs/remotes/trunk $resetsha1
git checkout master
git reset --hard trunk
+
+ # Remove any heads that are newer than this (except trunk)
+ resetreldate=$(git show -s --pretty='format:%ar' $resetsha1)
+ resettimestamp=$(git show -s --pretty='format:%at' $resetsha1)
+ echo "Removing any branches/tags newer than '$resetsha1' ($resetreldate)..."
+ git for-each-ref --format='%(refname)' refs/remotes/tags/* refs/remotes/branches/* | \
+ while read ref; do
+ # As svn tags show as new commits, we mustn't parse $ref directly, but
+ # traverse back up the tag tree to find the first commit that *do not*
+ # result in any changes (i.e. not an svn cp) and use that as our reference
+ # comparison point.
+ refsha1=$(git rev-parse "$ref":)
+ parentref=$ref
+ while [ $(git rev-parse --quiet --verify "$parentref"^: ) = "$refsha1" ]; do
+ parentref="$parentref"^
+ done
+
+ reftimestamp=$(git show -s --pretty='format:%at' $parentref)
+ if [ $reftimestamp -gt $resettimestamp ]; then
+ echo " Removing '$ref'"
+ git update-ref -d $ref
+ fi
+ done
+ echo "... done"
fi