quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [RFC] Conditional diff/refresh opts depending on the source


From: Andreas Krebbel
Subject: [Quilt-dev] [RFC] Conditional diff/refresh opts depending on the source - patch as attachement
Date: Thu, 21 Jan 2010 10:24:55 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090817)

Hi,

it obviously wasn't a good idea to inline the patch into
the mail body since the mail address obfuscation caused
some unfortunate changes.

I'll try it as attachement this time.

Bye,

-Andreas-


Index: quilt/scripts/patchfns.in
===================================================================
--- quilt/scripts/patchfns.in.orig      2009-01-31 03:28:06.000000000 +0100
+++ quilt/scripts/patchfns.in   2010-01-21 10:11:52.000000000 +0100
@@ -37,13 +37,6 @@ then
        source "$QUILTRC"
 fi
 
-# Add default arguments for this command
-if [ -n "$QUILT_COMMAND" ]; then
-       args="QUILT_$(echo $QUILT_COMMAND | tr a-z A-Z)_ARGS"
-       eval set -- ${!args} \"address@hidden"
-       unset args
-fi
-
 # ========================================================
 
 #declare -a exit_handlers
@@ -969,6 +962,34 @@ quilt_command()
        QUILT_COMMAND="" bash $BASH_OPTS -c "${SUBDIR:+cd $SUBDIR;} . 
$QUILT_DIR/$command" "quilt $command" "$@"
 }
 
+expand_conditional_opts()
+{
+    local dir=$1
+    local optstring=$2
+    local outopts=""
+
+    IFS='|' read -ra allopts <<< "$optstring"
+
+    for o in "address@hidden"; do
+       # Strip leading and trailing blanks
+       o=$(echo $o)
+       # If there is no : in the string the options are unconditional
+       if [[ $o != *:* ]]; then
+           outopts+=" "
+           outopts+=$o
+           continue
+       fi
+       local dirpat=${o%%:[^:]*}
+       local opts=${o##[^:]*:}
+
+       if [[ $dir == $dirpat ]]; then
+           outopts+=" "
+           outopts+=$opts
+       fi
+    done
+    echo ${outopts}
+}
+
 #
 # If the working directory does not contain a $QUILT_PATCHES directory,
 # quilt searches for its base directory up the directory tree. If no
@@ -1005,6 +1026,20 @@ then
     unset basedir down
 fi
 
+SRCDIR=$(basename $PWD)
+
+QUILT_DIFF_ARGS=$(expand_conditional_opts "${SRCDIR}" "${QUILT_DIFF_ARGS}")
+QUILT_REFRESH_ARGS=$(expand_conditional_opts "${SRCDIR}" 
"${QUILT_REFRESH_ARGS}")
+
+unset SRCDIR
+
+# Add default arguments for this command
+if [ -n "$QUILT_COMMAND" ]; then
+    args="QUILT_$(echo $QUILT_COMMAND | tr a-z A-Z)_ARGS"
+    eval set -- ${!args} \"address@hidden"
+    unset args
+fi
+
 : ${QUILT_SERIES:=series}
 
 if [ "${QUILT_SERIES:0:1}" = / ]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]