Index: quilt/applied.in =================================================================== RCS file: /cvsroot/quilt/quilt/quilt/applied.in,v retrieving revision 1.7 diff -u -r1.7 applied.in --- quilt/applied.in 14 Feb 2003 13:18:11 -0000 1.7 +++ quilt/applied.in 23 Jul 2003 22:53:52 -0000 @@ -19,15 +19,16 @@ usage() { - echo $"Usage: quilt applied [patch]" + echo $"Usage: quilt applied [-n] [patch]" if [ x$1 = x-h ] then echo $" -Print a list of applied patches, or all patches up to and including the -specified patch in the file series. +Print a list of applied patches. --n Print patch file names instead of patch names." +-n Print patch file names instead of patch names. + +" exit 0 else @@ -64,21 +65,21 @@ elif [ $# -eq 1 ] then patch=$(stripit $1) + if ! is_applied "$patch" + then + echo $"Patch $patch is not applied" >&2 + exit 1 + fi else patch=$(top_patch) fi -if [ -n "$patch" ] -then - for patch in $( - patches_before $patch - echo $patch - ) - do - [ -n "$opt_filenames" ] && patch=$(patch_file_name $patch) - echo $patch - done -fi +for patch in $(applied_before "$patch") $patch +do + [ -n "$opt_filenames" ] && patch=$(patch_file_name $patch) + echo $patch +done + ### Local Variables: ### mode: shell-script ### End: Index: quilt/diff.in =================================================================== RCS file: /cvsroot/quilt/quilt/quilt/diff.in,v retrieving revision 1.21 diff -u -r1.21 diff.in --- quilt/diff.in 5 Apr 2003 20:19:39 -0000 1.21 +++ quilt/diff.in 23 Jul 2003 22:53:52 -0000 @@ -42,7 +42,8 @@ -c patch Create a combined diff for all patches between this patch and - the patch specified with -P. + the patch specified with -P. A patch name of \"-\" is equivalent + to specifying the first applied patch. -R Create a reverse diff. Index: quilt/pop.in =================================================================== RCS file: /cvsroot/quilt/quilt/quilt/pop.in,v retrieving revision 1.14 diff -u -r1.14 pop.in --- quilt/pop.in 16 Feb 2003 20:32:43 -0000 1.14 +++ quilt/pop.in 23 Jul 2003 22:53:52 -0000 @@ -50,13 +50,8 @@ list_patches() { - local top=$(top_patch) n=0 patch - if [ -z "$top" ] - then - return 0 - fi - ( patches_before $top - echo $top ) \ + local n=0 patch + applied_patches \ | tac \ | if [ -n "$opt_all" ] then @@ -78,11 +73,6 @@ fi echo $patch done - if [ -n "$stop_at_patch" -a "$patch" != "$stop_at_patch" ] - then - echo $"Patch $stop_at_patch not found in file series" >&2 - return 1 - fi fi } Index: quilt/previous.in =================================================================== RCS file: /cvsroot/quilt/quilt/quilt/previous.in,v retrieving revision 1.8 diff -u -r1.8 previous.in --- quilt/previous.in 7 Apr 2003 14:04:19 -0000 1.8 +++ quilt/previous.in 23 Jul 2003 22:53:52 -0000 @@ -19,7 +19,7 @@ usage() { - echo $"Usage: quilt previous [patch]" + echo $"Usage: quilt previous [-n] [patch]" if [ x$1 = x-h ] then echo $" @@ -69,12 +69,13 @@ patch=$(top_patch) fi -if [ -n "$patch" ] +previous=$(applied_before "$patch" | tail -n 1) +if [ -n "$previous" ] then - previous=$(patches_before $patch | tail -n 1) [ -n "$opt_filenames" ] && previous=$(patch_file_name $previous) echo "$previous" fi + ### Local Variables: ### mode: shell-script ### End: Index: scripts/patchfns.in =================================================================== RCS file: /cvsroot/quilt/quilt/scripts/patchfns.in,v retrieving revision 1.18 diff -u -r1.18 patchfns.in --- scripts/patchfns.in 16 May 2003 18:46:31 -0000 1.18 +++ scripts/patchfns.in 23 Jul 2003 22:53:52 -0000 @@ -272,6 +272,25 @@ grep -q -E "^$(quote_re $patch)\$" $DB } +applied_patches() +{ + [ -e $DB ] || return 1 + cat $DB +} + +applied_before() +{ + local patch=$1 + + if [ -n "$patch" ] + then + @AWK@ ' + $0 == "'"$patch"'" { exit } + { print } + ' $DB + fi +} + patches_before() { local patch=$1