summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bash_completion11
-rw-r--r--quilt.changes10
-rw-r--r--quilt/annotate.in35
-rw-r--r--test/annotate.test23
4 files changed, 74 insertions, 5 deletions
diff --git a/bash_completion b/bash_completion
index 6356d22..a6502f8 100644
--- a/bash_completion
+++ b/bash_completion
@@ -132,8 +132,15 @@ _quilt_completion()
esac
;;
annotate)
- _quilt_comfile
- COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-h" -- $cur ) )
+ case $prev in
+ -p)
+ COMPREPLY=( $( compgen -W "$(quilt applied)" -- $cur ) )
+ ;;
+ *)
+ _quilt_comfile
+ COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-p -h" -- $cur ) )
+ ;;
+ esac
;;
applied)
COMPREPLY=( $( compgen -W "-h $(quilt applied)" -- $cur ) )
diff --git a/quilt.changes b/quilt.changes
index 461421a..fda8865 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,14 @@
-------------------------------------------------------------------
+Tue Sep 13 23:01:04 CEST 2005 - khali@linux-fr.org
+
+- quilt/annotate.in: Rework the annotation algorithm (Andreas
+ Gruenbacher). The new code is shorter and faster.
+- quilt/annotate.in: New option "-p patch" to stop checking for
+ changes at the specified rather than the topmost patch.
+- bash_completion: Support the new -p option.
+- test/annotation.test: Test the new -p option.
+
+-------------------------------------------------------------------
Sun Sep 11 10:32:28 CEST 2005 - khali@linux-fr.org
- quilt/annotate.in: Update help text to mention that only applied
diff --git a/quilt/annotate.in b/quilt/annotate.in
index d0242ec..5510262 100644
--- a/quilt/annotate.in
+++ b/quilt/annotate.in
@@ -19,12 +19,16 @@ fi
usage()
{
- printf $"Usage: quilt annotate {file}\n"
+ printf $"Usage: quilt [-p patch] annotate {file}\n"
if [ x$1 = x-h ]
then
printf $"
Print an annotated listing of the specified file showing which
patches modify which lines. Only applied patches are included.
+
+-p patch
+ Stop checking for changes at the specified rather than the
+ topmost patch.
"
exit 0
else
@@ -81,7 +85,7 @@ merge_files()
exec 4<&-
}
-options=`getopt -o h -- "$@"`
+options=`getopt -o p:h -- "$@"`
if [ $? -ne 0 ]
then
@@ -93,6 +97,13 @@ eval set -- "$options"
while true
do
case "$1" in
+ -p)
+ if ! opt_patch=$(find_patch "$2")
+ then
+ printf $"Patch %s is not in series\n" "$2" >&2
+ exit 1
+ fi
+ shift 2 ;;
-h)
usage -h ;;
--)
@@ -107,6 +118,13 @@ then
fi
opt_file="$SUBDIR$1"
+if [ -n "$opt_patch" ] && ! is_applied "$opt_patch"
+then
+ printf $"Patch %s is not applied\n" \
+ "$(print_patch "$opt_patch")" >&2
+ exit 1
+fi
+
for patch in $(applied_patches); do
old_file="$(backup_file_name "$patch" "$opt_file")"
if [ -f "$old_file" ]
@@ -114,9 +132,20 @@ for patch in $(applied_patches); do
patches[${#patches[@]}]="$patch"
files[${#files[@]}]="$old_file"
fi
+ if [ "$opt_patch" = "$patch" ]
+ then
+ # We also need to know the next patch, if any
+ next_patch="$(next_patch_for_file "$opt_patch" "$opt_file")"
+ break
+ fi
done
-files[${#files[@]}]="$opt_file"
+if [ -z "$next_patch" ]
+then
+ files[${#files[@]}]="$opt_file"
+else
+ files[${#files[@]}]="$(backup_file_name "$next_patch" "$opt_file")"
+fi
if [ ${#patches[@]} = 0 ]
then
diff --git a/test/annotate.test b/test/annotate.test
index 3ca7514..81cb85a 100644
--- a/test/annotate.test
+++ b/test/annotate.test
@@ -62,6 +62,29 @@
> 2 patches/patch2
> 3 patches/patch3
+ $ quilt annotate -p patch3 foo
+ > foo
+ > 2 baz
+ >
+ > 1 patches/patch
+ > 2 patches/patch2
+ > 3 patches/patch3
+
+ $ quilt annotate -p patch2 foo
+ > foo
+ > 1 Bar
+ > 2 baz
+ >
+ > 1 patches/patch
+ > 2 patches/patch2
+
+ $ quilt annotate -p patch foo
+ > foo
+ > 1 Bar
+ > 1 Baz
+ >
+ > 1 patches/patch
+
$ quilt new patch4
> Patch patches/patch4 is now on top