[SM-Commit] GIT changes to master quill by Jaka Kranjc (508d25ad1349cb3cc70a60f61afcac935bf7577d)

Jaka Kranjc scm at mail.sourcemage.org
Sun Feb 18 09:05:11 EST 2007


GIT changes to master quill by Jaka Kranjc <lynxlynxlynx at sourcemage.org>:

 usr/bin/quill                    |   19 +++++++++++++++++--
 var/lib/quill/ChangeLog          |    4 +++-
 var/lib/quill/modules/libhistory |    1 +
 var/lib/quill/modules/libupdate  |   10 ++++++++--
 var/lib/quill/version            |    2 +-
 5 files changed, 30 insertions(+), 6 deletions(-)

New commits:
commit 508d25ad1349cb3cc70a60f61afcac935bf7577d
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

           * quill, libcore, libhistory, libupdate: fix #13536 by using a dirty flag
           * libupdate: further optimise the find in copy_git_sub by not checking .git
    0.2.2

diff --git a/usr/bin/quill b/usr/bin/quill
index f6d2600..ef785e0 100755
--- a/usr/bin/quill
+++ b/usr/bin/quill
@@ -108,6 +108,7 @@ PROMPT_DELAY="31557807"
 BUILD_API=2
 load_build_api
 mkdir -p $QUILL_TMP_DIR
+SPELL_UPDATED=n
 
 # devel sorcery function
 if ! declare -f codex_get_spell_paths &> /dev/null; then
@@ -193,6 +194,7 @@ then
 
             #save the chosen version
             sed -i "s/\sVERSION=['\"]*${version}['\"]*\s*$/ VERSION=$SPELL_VERSION/" DETAILS
+            SPELL_UPDATED=y
 
             #check for multiversion spells
             multiversion_check
@@ -385,6 +387,7 @@ then
             update_patchlevel PATCHLEVEL
             update_patchlevel SECURITY_PATCH
             message "Done."
+            SPELL_UPDATED=y
           fi
         done
       ;;
@@ -422,12 +425,24 @@ then
           continue
         fi
 
-        if diff -q $QUILL_SPELL_DIR/$SPELL_NAME $GRIMOIRE/$SECTION/$SPELL_NAME -x DETAILS.orig > /dev/null
+        # three possible states:
+        # 1. the files are the same, no update was made
+        # 2. the files are the same, an update was made and copied over
+        # 3. the files differ
+        # in the case of 1 and 3 we want to confirm
+        if [[ $SPELL_UPDATED == n ]]
         then
-          # there is no difference
+          # 1. there is no difference; there is no change
           query "Are you sure you want to cast the unchanged spell from the grimoire?" y ||
           continue
         fi
+        if ! diff -q $QUILL_SPELL_DIR/$SPELL_NAME $GRIMOIRE/$SECTION/$SPELL_NAME -x DETAILS.orig > /dev/null
+        then
+          # 3. the spell was changed, but not copied over yet
+          query "Are you sure you want to cast the unchanged spell from the grimoire?" y ||
+          continue
+        fi
+
         if query "Do you want to cast -r? (possibly needed for multiversion spells)" n; then
           cast -r $SPELL_NAME
         else
diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index a0556ec..5f2327f 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,7 +1,9 @@
 2007-02-18 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* quill, libcore, libhistory, libupdate: fix #13536 by using a dirty flag
+	* libupdate: further optimise the find in copy_git_sub by not checking .git
 	* libcore, libupdate: use cp -p to preserve timestamps #13537
 	* libcore: don't list bad secret keys when asking for GURU_GPGKEY
-	* version: ++
+	* version: 0.2.2
 
 2007-02-17 Andraž "ruskie" Levstik <ruskie at mages.ath.cx>
 	* libcore: added GURU_GPGKEY to quillrc, minor fix
diff --git a/var/lib/quill/modules/libhistory b/var/lib/quill/modules/libhistory
index a2a1adb..413503d 100644
--- a/var/lib/quill/modules/libhistory
+++ b/var/lib/quill/modules/libhistory
@@ -76,6 +76,7 @@ function add_user_history_entries()
     query "Do you want to review the HISTORY changes?" n &&
     quill_edit HISTORY
     echo
+    SPELL_UPDATED=y
   fi
 }
 
diff --git a/var/lib/quill/modules/libupdate b/var/lib/quill/modules/libupdate
index a32ce67..ae98ab9 100644
--- a/var/lib/quill/modules/libupdate
+++ b/var/lib/quill/modules/libupdate
@@ -107,7 +107,7 @@ function copy_git_sub()
   # find where under $QUILL_GIT_DIR the spell actually is
   # perhaps the section path is /home/navaden/sorcery/git/gnome1-libs
   # + is the only regex char that is problematic here AND is used in names
-  SECTION2=$(find "$QUILL_GIT_DIR" -regex "${QUILL_GIT_DIR%/}/[^/]*/[^/]*/${SPELL_NAME//+/\+}$" -type d -printf "%h\n" -quit)
+  SECTION2=$(find "$QUILL_GIT_DIR" -regex "${QUILL_GIT_DIR%/}/[^.][^/]*/[^/]*/${SPELL_NAME//+/\+}$" -type d -printf "%h\n" -quit)
   if [[ -z $SECTION2 ]]
   then
     error_msg "Couldn't find the spell, \$QUILL_GIT_DIR is probably bad!"
@@ -153,6 +153,11 @@ function copy_from_git()
   else
     ${QUILL_SUDO:-su} -c "cp -pr '$GRIMOIRE2/$SECTION2/$SPELL_NAME' '$QUILL_SPELL_DIR'"
   fi
+
+  # update SPELL_UPDATED
+  codex_get_spell_paths $(codex_find_spell_by_name $SPELL_NAME)
+  diff -q $QUILL_SPELL_DIR/$SPELL_NAME "$GRIMOIRE/$SECTION/$SPELL_NAME" -x DETAILS.orig > /dev/null || SPELL_UPDATED=y
+
   unset GRIMOIRE2 SECTION2
   cd $QUILL_SPELL_DIR/$SPELL_NAME
 }
@@ -242,7 +247,8 @@ function ask_and_copy_over()
     cd $QUILL_SPELL_DIR &&
     rm -fr $QUILL_SPELL_DIR/$SPELL_NAME &&
     cp -pr $SECTION_DIRECTORY/$SPELL_NAME $QUILL_SPELL_DIR &&
-    message "Done."
+    message "Done." &&
+    SPELL_UPDATED=n
   elif [[ $reply == "QUILL_GIT_DIR" ]]
   then
     copy_from_git &&
diff --git a/var/lib/quill/version b/var/lib/quill/version
index 625895c..ee1372d 100644
--- a/var/lib/quill/version
+++ b/var/lib/quill/version
@@ -1 +1 @@
-0.2.2-2007-02-18
+0.2.2



More information about the SM-Commit mailing list