git-migration: cvs2git_fixes.sh - rename or remove unlabeled branches - typ...

draenog draenog at pld-linux.org
Wed Feb 9 10:15:03 CET 2011


Author: draenog                      Date: Wed Feb  9 09:15:03 2011 GMT
Module: git-migration                 Tag: HEAD
---- Log message:
- rename or remove unlabeled branches
- typo in description

---- Files affected:
git-migration:
   cvs2git_fixes.sh (1.3 -> 1.4) 

---- Diffs:

================================================================
Index: git-migration/cvs2git_fixes.sh
diff -u git-migration/cvs2git_fixes.sh:1.3 git-migration/cvs2git_fixes.sh:1.4
--- git-migration/cvs2git_fixes.sh:1.3	Wed Feb  9 07:25:51 2011
+++ git-migration/cvs2git_fixes.sh	Wed Feb  9 10:14:57 2011
@@ -1,11 +1,21 @@
 #!/bin/sh
+# Script to fix git repo resulting from cvs2git conversion
+# usage: cvs2git_fixes.sh <name>'
+#
+# It fixes following problems
+#
+# Branches which are no longer labelled can exist in CVS. cvs2git names them 
+# unlabeled-<revision>. The script changes "unlabeled" to specified name or
+# deleted them if name is unspecified
+
 # Often in CVS repo only changed file are tagged. In this case cvs2git produces
-# superfluouss commits to delete not tagged file. Here the tag in converted git 
+# superfluous commits to delete not tagged file. Here the tag in converted git 
 # repo is moved to the parent if the tagged commit:
 # 1. was made by cvs2svn
 # 2. the only change in the tree is deletion of files
 # 3. the tag is not on any branch
 
+name=$1
 
 git show-ref --tags | \
 while read rev tagname; do
@@ -15,5 +25,15 @@
                         git update-ref "$tagname" $rev~
         fi
 done
-        
-        
+
+git show-ref --heads | egrep 'unlabeled-[0-9.]+$' | \
+while read rev branchname; do
+        if [ -z "$name" ]; then
+                git update-ref -d "$branchname" $rev
+        else        
+                new_branchname=`echo $branchname | sed -e "s/unlabeled-\([0-9.]\+\)$/${name}-\1/"`
+                if [ "$branchname" != "$new_branchname" ]; then
+                        git update-ref "$new_branchname" $rev "" && git update-ref -d "$branchname" $rev
+                fi
+        fi
+done
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/git-migration/cvs2git_fixes.sh?r1=1.3&r2=1.4&f=u



More information about the pld-cvs-commit mailing list