Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] Another grimoire pruning script

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Juuso Alasuutari <iuso AT sourcemage.org>
  • To: SM-Discuss <sm-discuss AT lists.ibiblio.org>
  • Subject: Re: [SM-Discuss] Another grimoire pruning script
  • Date: Tue, 3 Oct 2006 10:08:00 +0300

On Monday 02 October 2006 20:40, Arwed von Merkatz wrote:
> On Sat, Sep 30, 2006 at 08:19:13PM -0700, Eric Sandall wrote:
> > Juuso Alasuutari wrote:
> > > I have here a script that removes UPDATED from spells where ENTERED is
> > > exactly the same. According to my reasoning this shouldn't hurt
> > > anybody, no matter how ancient their systems are. Am I correct?
> > >
> > > ~1900 commits await!
> >
> > That is, technically, correct. In practice, though, it may not be. ;)
> > I'd still say go for it, but Arwed might have different plans.
>
> Sounds good to me.

Ok, done. :)

Modified 1849 spells in main grimoire and 70 in z-rejected. Here's how:

--------------------

#!/bin/bash

NAME="Name Here"
EMAIL="email AT he.re"
COMMIT_MSG="[automated] Removed UPDATED."


echo -n "Counting spells to process... "
spellCount=0
for file in `grep -lr "^ *UPDATED=[0-9][0-9]*" ./ | grep DETAILS`; do
updatedDate=`grep "^ *UPDATED=[0-9][0-9]*" "$file"`
updatedDate=${updatedDate## *UPDATED=}
if grep -q "ENTERED=$updatedDate\ *$" "$file"; then
((spellCount+=1))
fi
done
echo Done.


n=0
for file in `grep -lr "^ *UPDATED=[0-9][0-9]*" ./ | grep DETAILS`; do
updatedDate=`grep "^ *UPDATED=[0-9][0-9]*" "$file"`
updatedDate=${updatedDate## *UPDATED=}
if grep -q "ENTERED=$updatedDate\ *$" "$file"; then
sed -i "/^\ *UPDATED=[0-9][0-9]*.*$/d" "$file"
sed -i "1i$(date +%Y-%m-%d) $NAME <$EMAIL>\n\t* DETAILS: $COMMIT_MSG\n" \
"${file/\/DETAILS//HISTORY}"
spellName="${file%%/DETAILS}"
spellName="${spellName##*/}"
git commit -m "$spellName: $COMMIT_MSG" -a
((n+=1))
echo $n/$spellCount: $spellName
fi
done

--------------------

--
Juuso Alasuutari
[[ Source Mage GNU/Linux ]]

Attachment: pgpCNTufWeIKB.pgp
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page