Revision: 76558
          http://sourceforge.net/p/brlcad/code/76558
Author:   starseeker
Date:     2020-07-28 14:58:48 +0000 (Tue, 28 Jul 2020)
Log Message:
-----------
For commits on multiple non-master git branches, assign them to the branch they 
are on with the oldest final commit.  This may mis-assign some older commits 
that were actually made on another branch and then merged, but we seem to be 
hitting the limit of what Git can tell us.  A few of these might show up as 
failed CVS checkouts in a validation attempt, but I'm not sure how else we 
would spot them.

Modified Paths:
--------------
    brlcad/trunk/misc/repoconv/cvs_info.sh

Modified: brlcad/trunk/misc/repoconv/cvs_info.sh
===================================================================
--- brlcad/trunk/misc/repoconv/cvs_info.sh      2020-07-28 13:29:14 UTC (rev 
76557)
+++ brlcad/trunk/misc/repoconv/cvs_info.sh      2020-07-28 14:58:48 UTC (rev 
76558)
@@ -11,24 +11,27 @@
 if [ ! -e "brlcad_cvs.tar.gz" ]; then
         curl -o brlcad_cvs.tar.gz https://brlcad.org/brlcad_cvs.tar.gz
 fi
-rm -rf brlcad_cvs
-tar -xf brlcad_cvs.tar.gz
-cd brlcad_cvs/brlcad
 
-# Create Git repository without author map (to preserve original CVS names)
-echo "Running cvs-fast-export $PWD"
-find . | ../../cvs-fast-export/cvs-fast-export > ../../brlcad_cvs_git.fi
-cd ../..
-rm -rf brlcad_cvs_git
-mkdir brlcad_cvs_git
-cd brlcad_cvs_git
-git init
-cat ../brlcad_cvs_git.fi | git fast-import
-git checkout master
 
-# Find branches
-git branch|sed -e 's/*//'|sed -e 's/ *//' > ../branches.txt
-cd ..
+if [ ! -e "brlcad_cvs" ];
+then
+       rm -rf brlcad_cvs
+       tar -xf brlcad_cvs.tar.gz
+       cd brlcad_cvs/brlcad
+       # Create Git repository without author map (to preserve original CVS 
names)
+       echo "Running cvs-fast-export $PWD"
+       find . | ../../cvs-fast-export/cvs-fast-export > ../../brlcad_cvs_git.fi
+       cd ../..
+       rm -rf brlcad_cvs_git
+       mkdir brlcad_cvs_git
+       cd brlcad_cvs_git
+       git init
+       cat ../brlcad_cvs_git.fi | git fast-import
+       git checkout master
+       # Find branches
+       git branch|sed -e 's/*//'|sed -e 's/ *//' > ../branches.txt
+       cd ..
+fi
 
 # Find commits on branches
 rm -rf branches
@@ -51,19 +54,104 @@
 cd branches
 for f in *;
 do
+       echo "Uniq: $f"
        grep -Fvx -f ../master $f > uniq.txt
        mv uniq.txt ../branches_uniq/$f
 done
 cd ..
-mv master branches_uniq/
 
+# For each branch, walk the non-master commits looking for the
+# newest commit timestamp on the branch.  Store that date
+cd brlcad_cvs_git
 
+declare -A datemap
+
+for f in ../branches_uniq/*;
+do
+       branch="$(basename $f)"
+       skip="master"
+       if [ $branch != $skip ];
+       then
+               echo "Date check: $branch"
+               newcommit=0
+               while IFS="" read -r p || [ -n "$p" ]
+               do
+                       CDATE=$(git log -n1 --pretty=format:"%ct" $p)
+                       if [ "$CDATE" -gt "$newcommit" ];
+                       then
+                               newcommit=$CDATE;
+                       fi;
+               done < $f
+               echo "$branch $newcommit"
+               datemap[$branch]=$newcommit
+       fi;
+done
+
+cd ..
+
+# For all branches, if a branch has a newest commit date older
+# than the current branch, remove that branches commits from the
+# current branch
+cd branches_uniq
+for f in *;
+do
+       FDATE=${datemap[$f]}
+       for g in *;
+       do
+               if [ $g != $f ];
+               then
+                       GDATE=${datemap[$g]}
+                       if [ "$GDATE" -lt "$FDATE" ];
+                       then
+                               echo "Scrub $FDATE:$GDATE : $f/$g"
+                               grep -Fvx -f $g $f > uniq.txt
+                               mv uniq.txt $f
+                       fi;
+               fi;
+       done
+done
+
+# Couple special cases I can't seem to detect otherwise:
+grep -Fvx -f bobWinPort bobWinPort-20051223-freeze > uniq.txt
+mv uniq.txt bobWinPort-20051223-freeze
+grep -Fvx -f brlcad_5_1_alpha_patch rel-5-1 > uniq.txt
+mv uniq.txt rel-5-1
+
+cd ../brlcad_cvs_git
+for f in ../branches_uniq/*;
+do
+       branch="$(basename $f)"
+       echo "Date check: $branch"
+       oldcommit=9223372036854775807
+       newcommit=0
+       while IFS="" read -r p || [ -n "$p" ]
+       do
+               CDATE=$(git log -n1 --pretty=format:"%ct" $p)
+               if [ "$CDATE" -lt "$oldcommit" ];
+               then
+                       oldcommit=$CDATE;
+               fi;
+               if [ "$CDATE" -gt "$newcommit" ];
+               then
+                       newcommit=$CDATE;
+               fi;
+       done < $f
+       echo "$branch $newcommit:$oldcommit"
+done
+
+cd ..
+
+
 # Write out information to map files, using as a key msg sha1 + date in seconds
+
+# mv master branches_uniq/ - Note: shouldn't need master explicitly, it's 
assumed
+
 rm -f branchmap authormap
 cd brlcad_cvs_git
 for f in ../branches_uniq/*;
 do
        branch="$(basename $f)"
+       echo "Map write: $branch"
        while IFS="" read -r p || [ -n "$p" ]
        do
                MSGSHA1=$(git log -n1 --pretty=format:"%B" $p | sha1sum | head 
-c 40)

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to