diff options
-rw-r--r-- | quilt.changes | 7 | ||||
-rw-r--r-- | quilt/patches.in | 66 | ||||
-rw-r--r-- | scripts/patchfns.in | 100 |
3 files changed, 48 insertions, 125 deletions
diff --git a/quilt.changes b/quilt.changes index ea27f30..650bca2 100644 --- a/quilt.changes +++ b/quilt.changes @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Sun Oct 26 17:53:53 CET 2003 - agruen@suse.de + +- Get rid of patches_per cache_in `quilt patches'. Remove + patches_per_file and associated functions. `quilt patches' + now is a bit slow for unapplied patches. + +------------------------------------------------------------------- Sun Oct 26 14:45:08 CET 2003 - agruen@suse.de - Rename snapshot directory from ".snap0" to ".snap". diff --git a/quilt/patches.in b/quilt/patches.in index fd1b1fa..ad05cc4 100644 --- a/quilt/patches.in +++ b/quilt/patches.in @@ -24,7 +24,9 @@ usage() then echo $" -Print the list of patches that modify the specified file. +Print the list of patches that modify the specified file. (Uses a +heuristic to determine which files are modified by unapplied patches. +Note that this heuristic is much slower than scanning applied patches.) -n Print the patch file names instead of the patch names. @@ -37,18 +39,38 @@ Print the list of patches that modify the specified file. fi } -scan_patches() +scan_applied() { local prefix=$1 file=$2 shift 2 local patch - for patch in $(modified_files $file -- "$@" \ - | cut -d $'\t' -f2) + for patch in "$@" do - [ -n "$opt_filenames" ] && patch=$(patch_file_name $patch) - - echo "$prefix$patch" + if [ -f ".pc/$patch/$file" ] + then + [ -n "$opt_filenames" ] && \ + patch=$(patch_file_name $patch) + echo "$prefix$patch" + fi + done +} + +scan_unapplied() +{ + local prefix=$1 file=$2 + shift 2 + local file_bre="$(quote_bre $file)" patch + + for patch in "$@" + do + if touched_by_patch $(patch_strip_level $patch) $patch \ + | grep -q "^$file_bre\$" + then + [ -n "$opt_filenames" ] && \ + patch=$(patch_file_name $patch) + echo "$prefix$patch" + fi done } @@ -84,29 +106,23 @@ then fi opt_file=$1 -if ! refresh_patches_per_file -then - exit 1 -fi +top=$(top_patch) if [ -n "$opt_verbose" ] then - top=$(top_patch) - if [ -n "$top" ] - then - patches_before="$(patches_before $top)" - [ -n "$patches_before" ] && - scan_patches "+ " $opt_file $patches_before - scan_patches "= " $opt_file $top - patches_after="$(patches_after $top)" - [ -n "$patches_after" ] && - scan_patches " " $opt_file $(patches_after $top) - else - scan_patches " " $opt_file - fi + applied="+ " + current="= " + unapplied=" " else - scan_patches "" $opt_file + applied="" + current="" + unapplied="" fi + +scan_applied "$applied" $opt_file $(patches_before $top) +[ -n "$top" ] && \ + scan_applied "$current" $opt_file $top +scan_unapplied "$unapplied" $opt_file $(patches_after $top) ### Local Variables: ### mode: shell-script ### End: diff --git a/scripts/patchfns.in b/scripts/patchfns.in index 361087c..2b40830 100644 --- a/scripts/patchfns.in +++ b/scripts/patchfns.in @@ -367,106 +367,6 @@ next_patch_for_file() | head -n 1 \ | @SED@ -e 's:^\.pc/::' -e 's:/\.pc$::' fi - - #modified_files $file -- $patches_on_top \ - #| cut -d $'\t' -f2 \ - #| cut -d ' ' -f1 -} - -# Create a list of files and the patches that modify them. -refresh_patches_per_file() -{ - local pc_files=$(pc_file_name $(cat_series)) - local ex_pc_files pc_file - - if [ -e .pc/patches-per-file ] - then - local needs_refresh - for pc_file in pc_files - do - if [ .pc/patches-per-file -ot $pc_file ] - then - needs_refresh=1 - break - fi - done - if [ -z "$needs_refresh" ] - then - return 0 - fi - fi - - for pc_file in $pc_files - do - if [ -e $pc_file ] - then - ex_pc_files[${#ex_pc_files[@]}]=$pc_file - fi - done - - if [ ${#ex_pc_files[@]} -eq 0 ] - then - rm -f .pc/patches-per-file - return 0 - fi - - @AWK@ ' - ARGIND!=saved { sub(/^.pc\//, "", FILENAME) - sub(/\/\.pc/, "", FILENAME) - saved=ARGIND - } - { if (files[$0]) - files[$0]=files[$0] " " FILENAME - else - files[$0]=FILENAME - } - END { for (file in files) - printf "%s\t%s\n", file, files[file] - } - ' "${ex_pc_files[@]}" > .pc/patches-per-file -} - -# For a lists of patches and a list of files, compute which patches -# modify which files. Invoked as -# modified_files file ... [-- patch ...] -# -modified_files() -{ - if ! refresh_patches_per_file - then - return 1 - fi - - @AWK@ ' - BEGIN { no_files=1 - no_patches=1 - for (i=1; i<ARGC; i++) { - if (ARGV[i]=="--") - break - files[ARGV[i]]=1 - no_files=0 - } - for (i++; i<ARGC; i++) { - patches[ARGV[i]]=1 - no_patches=0 - } - split("", ARGV) # read from standard input - } - no_files || files[$1] { - if (no_patches) { - print - next - } - for (i=2; i<=NF; i++) - if ($i in patches) { - printf "%s\t%s", $1, $i - for (i++; i<=NF; i++) - if ($i in patches) - printf " %s", $i - printf "\n" - } - } - ' "$@" < .pc/patches-per-file } add_to_db() |