Revision: 78313
          http://sourceforge.net/p/brlcad/code/78313
Author:   starseeker
Date:     2021-02-23 19:11:34 +0000 (Tue, 23 Feb 2021)
Log Message:
-----------
Rename - test updates using script succeeded.

To test the efficacy of this script, one of the updating
files to the conversion was altered to remove one of the
earliest correction lines, and that line was applied in
isolation to create a new repository with most of the
SHA1 ids altered.  The original repository and the
altered repository were then used to update the full input
files (minus the already applied line) by mapping the
original SHA1 keys to the corresponding new keys.  After
application of the altered files, the final git log --all
log from the resulting repository was compared to the
equivalent log generated from the repository created by
applying the original files to the original input. The logs
were identical, which means all the mapping were successfully
made and the equivalent changes successfully applied.

Modified Paths:
--------------
    brlcad/trunk/misc/CMakeLists.txt

Added Paths:
-----------
    brlcad/trunk/misc/repoconv/sha1_update.sh

Removed Paths:
-------------
    brlcad/trunk/misc/repoconv/sha1_to_uniqkey.sh

Modified: brlcad/trunk/misc/CMakeLists.txt
===================================================================
--- brlcad/trunk/misc/CMakeLists.txt    2021-02-23 18:15:34 UTC (rev 78312)
+++ brlcad/trunk/misc/CMakeLists.txt    2021-02-23 19:11:34 UTC (rev 78313)
@@ -215,7 +215,7 @@
   repoconv/manual_merge_info.tar.gz
   repoconv/md5.hpp
   repoconv/sha1.hpp
-  repoconv/sha1_to_uniqkey.sh
+  repoconv/sha1_update.sh
   repoconv/svn2git/README
   repoconv/svn2git/archive_branches.sh
   repoconv/svn2git/rules

Deleted: brlcad/trunk/misc/repoconv/sha1_to_uniqkey.sh
===================================================================
--- brlcad/trunk/misc/repoconv/sha1_to_uniqkey.sh       2021-02-23 18:15:34 UTC 
(rev 78312)
+++ brlcad/trunk/misc/repoconv/sha1_to_uniqkey.sh       2021-02-23 19:11:34 UTC 
(rev 78313)
@@ -1,115 +0,0 @@
-#!/bin/bash
-
-set -e
-
-CWD=$(pwd)
-
-if [ "$#" -ne "4" ]
-then
-       echo "sha1_update old_repo new_repo input_file output_file"
-       exit 1
-fi
-old_repo=$1
-new_repo=$2
-input_file=$CWD/$3
-output_file=$4
-
-if [ ! -d $old_repo ]
-then
-       echo "$old_repo does not exist"
-       exit 1
-fi
-if [ ! -d $new_repo ]
-then
-       echo "$new_repo does not exist"
-       exit 1
-fi
-if [ ! -f $input_file ]
-then
-       input_file=$3
-       if [ ! -f $input_file ]
-       then
-               echo "$input_file does not exist"
-               exit 1
-       fi
-fi
-if [ -f $output_file ]
-then
-       echo "$output_file already exists"
-       exit 1
-fi
-
-
-cd $old_repo
-
-rm -f sha1s_orig ukeys nkeys mapped_keys map.sed
-while read p; do
-  SHA1=$(echo "$p" | awk -F';' '{print $1}')
-  if [ "$SHA1" != "" ]
-  then
-         echo $SHA1 >> $CWD/sha1s_orig
-
-         TSMP=$(git log -1 --pretty=format:"%ct%n" $SHA1)
-
-         # https://stackoverflow.com/a/7132381
-         git branch -a --contains $SHA1 | grep -v remote | sort | uniq |sed -e 
's/\*//'|sed -e 's/ //g' > $CWD/branchtmp
-         BMD5=$(md5sum $CWD/branchtmp |awk '{print $1}')
-         rm $CWD/branchtmp
-
-         git diff --raw $SHA1^ $SHA1 > $CWD/keytmp
-         DIFFKEY=$(md5sum $CWD/keytmp |awk '{print $1}')
-         rm $CWD/keytmp
-
-         echo "SHA1: $SHA1"
-         echo "Timestamp: $TSMP"
-         echo "Branches MD5: $BMD5"
-         echo "Diff MD5: $DIFFKEY"
-         echo "$SHA1;$TSMP;$BMD5;$DIFFKEY" >> $CWD/ukeys
-  fi
-done < $input_file
-echo "" >> $CWD/ukeys
-
-cd $new_repo
-
-echo ""
-echo "Mapping from $old_repo SHA1 keys to $new_repo SHA1 keys:"
-echo ""
-
-while read p; do
-  OSHA1=$(echo "$p" | awk -F';' '{print $1}')
-  TSMP=$(echo "$p" | awk -F';' '{print $2}')
-  BMD5=$(echo "$p" | awk -F';' '{print $3}')
-  DIFFKEY=$(echo "$p" | awk -F';' '{print $4}')
-  pwd
-  echo "Searching for: $TSMP   $BMD5   $DIFFKEY"
-  git log --all --since $TSMP --until $TSMP --pretty=format:"%H" > $CWD/nkeys
-  echo "" >> $CWD/nkeys
-  while read d; do
-         CSHA1=$d
-         echo "        CSHA1: $CSHA1"
-
-         git branch -a --contains $CSHA1 | grep -v remote | sort | uniq |sed 
-e 's/\*//'|sed -e 's/ //g' > $CWD/branchtmp
-         NBMD5=$(md5sum $CWD/branchtmp |awk '{print $1}')
-         echo "        NBMD5: $NBMD5"
-         rm $CWD/branchtmp
-
-         if [ "$BMD5" == "$NBMD5" ]
-         then
-                 git diff --raw $CSHA1^ $CSHA1 > $CWD/keytmp
-                 NDIFFKEY=$(md5sum $CWD/keytmp |awk '{print $1}')
-                 echo "        NDIFFKEY: $NDIFFKEY"
-                 if [ "$NDIFFKEY" == "$DIFFKEY" ]
-                 then
-                         echo "        MATCH"
-                         echo "s/$OSHA1/$d/g" >> $CWD/map.sed
-                 fi
-                 rm $CWD/keytmp
-         fi
-  done < $CWD/nkeys
-  rm $CWD/nkeys
-done < $CWD/ukeys
-
-cd $CWD
-cp $input_file $output_file
-sed -i -f map.sed $output_file
-

Copied: brlcad/trunk/misc/repoconv/sha1_update.sh (from rev 78312, 
brlcad/trunk/misc/repoconv/sha1_to_uniqkey.sh)
===================================================================
--- brlcad/trunk/misc/repoconv/sha1_update.sh                           (rev 0)
+++ brlcad/trunk/misc/repoconv/sha1_update.sh   2021-02-23 19:11:34 UTC (rev 
78313)
@@ -0,0 +1,115 @@
+#!/bin/bash
+
+set -e
+
+CWD=$(pwd)
+
+if [ "$#" -ne "4" ]
+then
+       echo "sha1_update old_repo new_repo input_file output_file"
+       exit 1
+fi
+old_repo=$1
+new_repo=$2
+input_file=$CWD/$3
+output_file=$4
+
+if [ ! -d $old_repo ]
+then
+       echo "$old_repo does not exist"
+       exit 1
+fi
+if [ ! -d $new_repo ]
+then
+       echo "$new_repo does not exist"
+       exit 1
+fi
+if [ ! -f $input_file ]
+then
+       input_file=$3
+       if [ ! -f $input_file ]
+       then
+               echo "$input_file does not exist"
+               exit 1
+       fi
+fi
+if [ -f $output_file ]
+then
+       echo "$output_file already exists"
+       exit 1
+fi
+
+
+cd $old_repo
+
+rm -f sha1s_orig ukeys nkeys mapped_keys map.sed
+while read p; do
+  SHA1=$(echo "$p" | awk -F';' '{print $1}')
+  if [ "$SHA1" != "" ]
+  then
+         echo $SHA1 >> $CWD/sha1s_orig
+
+         TSMP=$(git log -1 --pretty=format:"%ct%n" $SHA1)
+
+         # https://stackoverflow.com/a/7132381
+         git branch -a --contains $SHA1 | grep -v remote | sort | uniq |sed -e 
's/\*//'|sed -e 's/ //g' > $CWD/branchtmp
+         BMD5=$(md5sum $CWD/branchtmp |awk '{print $1}')
+         rm $CWD/branchtmp
+
+         git diff --raw $SHA1^ $SHA1 > $CWD/keytmp
+         DIFFKEY=$(md5sum $CWD/keytmp |awk '{print $1}')
+         rm $CWD/keytmp
+
+         echo "SHA1: $SHA1"
+         echo "Timestamp: $TSMP"
+         echo "Branches MD5: $BMD5"
+         echo "Diff MD5: $DIFFKEY"
+         echo "$SHA1;$TSMP;$BMD5;$DIFFKEY" >> $CWD/ukeys
+  fi
+done < $input_file
+echo "" >> $CWD/ukeys
+
+cd $new_repo
+
+echo ""
+echo "Mapping from $old_repo SHA1 keys to $new_repo SHA1 keys:"
+echo ""
+
+while read p; do
+  OSHA1=$(echo "$p" | awk -F';' '{print $1}')
+  TSMP=$(echo "$p" | awk -F';' '{print $2}')
+  BMD5=$(echo "$p" | awk -F';' '{print $3}')
+  DIFFKEY=$(echo "$p" | awk -F';' '{print $4}')
+  pwd
+  echo "Searching for: $TSMP   $BMD5   $DIFFKEY"
+  git log --all --since $TSMP --until $TSMP --pretty=format:"%H" > $CWD/nkeys
+  echo "" >> $CWD/nkeys
+  while read d; do
+         CSHA1=$d
+         echo "        CSHA1: $CSHA1"
+
+         git branch -a --contains $CSHA1 | grep -v remote | sort | uniq |sed 
-e 's/\*//'|sed -e 's/ //g' > $CWD/branchtmp
+         NBMD5=$(md5sum $CWD/branchtmp |awk '{print $1}')
+         echo "        NBMD5: $NBMD5"
+         rm $CWD/branchtmp
+
+         if [ "$BMD5" == "$NBMD5" ]
+         then
+                 git diff --raw $CSHA1^ $CSHA1 > $CWD/keytmp
+                 NDIFFKEY=$(md5sum $CWD/keytmp |awk '{print $1}')
+                 echo "        NDIFFKEY: $NDIFFKEY"
+                 if [ "$NDIFFKEY" == "$DIFFKEY" ]
+                 then
+                         echo "        MATCH"
+                         echo "s/$OSHA1/$d/g" >> $CWD/map.sed
+                 fi
+                 rm $CWD/keytmp
+         fi
+  done < $CWD/nkeys
+  rm $CWD/nkeys
+done < $CWD/ukeys
+
+cd $CWD
+cp $input_file $output_file
+sed -i -f map.sed $output_file
+

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



_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to