diff options
author | Andreas Gruenbacher <agruen@suse.de> | 2004-06-06 18:42:14 +0000 |
---|---|---|
committer | Andreas Gruenbacher <agruen@suse.de> | 2004-06-06 18:42:14 +0000 |
commit | bf2a07ca502272ae28762b3fa9b0dd68db8dc7f0 (patch) | |
tree | c558b836e59a85047d00f8363b6dc54a68529341 /scripts/patchfns.in | |
parent | 258c42fe9367b321b686492441346347390db664 (diff) | |
download | quilt-bf2a07ca502272ae28762b3fa9b0dd68db8dc7f0.tar.gz |
- Preserve the order of files in patches in the diff and refresh
commands. Files added to a patch appear at the end of a patch.
The files command also lists the files in the order in which
they appear in patches.
- Update to version 0.33.
Diffstat (limited to 'scripts/patchfns.in')
-rw-r--r-- | scripts/patchfns.in | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/patchfns.in b/scripts/patchfns.in index 10775ba..154c544 100644 --- a/scripts/patchfns.in +++ b/scripts/patchfns.in @@ -479,6 +479,48 @@ files_in_patch() fi } +filenames_in_patch() +{ + local patch=$1 + local patch_file=$(patch_file_name $patch) + if [ -e "$patch_file" ] + then + local strip=$(patch_strip_level $patch) + @AWK@ ' + ($1 == "+++" || $1 == "---" || $1 == "***") && \ + $3 != "----" && $3 != "****" \ + { sub(/\t.*/, "") + sub(/^... /, "") + for (n=0 ; n<'"$strip"'; n++) + sub(/^([^/]+\/)/, "") + print $0 }' $patch_file + fi +} + +files_in_patch_ordered() +{ + local patch=$1 + + ( files_in_patch $patch + echo "-" + filenames_in_patch $patch + ) | awk ' + $1 == "-" { out=1 ; next } + !out { files[$0]=1 } + out { if ($0 in files && !($0 in printed)) { + print $0 + printed[$0]=1 + } + } + END { + for (file in files) { + if (!(file in printed)) + print file + } + } + ' +} + touched_by_patch() { local strip=$1 patch=$2 |