summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2003-10-21 18:45:03 +0000
committerAndreas Gruenbacher <agruen@suse.de>2003-10-21 18:45:03 +0000
commit8da5f17fc3eb9fc621bea4a5482bc3995b56c9da (patch)
tree74754369a2b7ebd79eb6d1b968a45b4036751e7a
parent12b6a06eecd7a7602614f64d149c1a2840719ae3 (diff)
downloadquilt-8da5f17fc3eb9fc621bea4a5482bc3995b56c9da.tar.gz
- Add `quilt fork' command.v0.26
- Add `quilt snapshot' command and `quilt diff --snapshot' option. - Bump the version number to 0.26.
-rw-r--r--Makefile.in2
-rw-r--r--configure.ac4
-rw-r--r--quilt.changes7
-rw-r--r--quilt/diff.in49
-rw-r--r--quilt/snapshot.in98
5 files changed, 147 insertions, 13 deletions
diff --git a/Makefile.in b/Makefile.in
index 2545112..360792e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -57,7 +57,7 @@ DIRT += $(BIN_IN:%=bin/%)
QUILT_IN := add applied delete diff files import new next patches \
pop previous push refresh remove series setup top unapplied \
- fork
+ fork snapshot
QUILT_SRC := $(QUILT_IN:%=%.in)
QUILT := $(QUILT_IN)
diff --git a/configure.ac b/configure.ac
index ded8b3e..34de0ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,8 +1,8 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([quilt],[0.25],[quilt-dev@nongnu.org])
+AC_INIT([quilt],[0.26],[quilt-dev@nongnu.org])
AC_CONFIG_AUX_DIR(config)
AC_PREREQ(2.53)
-AC_REVISION ($Revision: 1.17 $)
+AC_REVISION ($Revision: 1.18 $)
PACKAGE_RELEASE=1
AC_SUBST(PACKAGE_RELEASE)
diff --git a/quilt.changes b/quilt.changes
index 5eb0a38..2cc8a90 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Tue Oct 21 20:44:00 CEST 2003 - agruen@suse.de
+
+- Add `quilt fork' command.
+- Add `quilt snapshot' command and `quilt diff --snapshot' option.
+- Bump the version number to 0.26.
+
+-------------------------------------------------------------------
Tue Sep 9 08:44:12 CEST 2003 - martin.quinson@tuxfamily.org
- fix LC_ALL to C during building the reference so that the
diff --git a/quilt/diff.in b/quilt/diff.in
index 8d721ec..3e74b9d 100644
--- a/quilt/diff.in
+++ b/quilt/diff.in
@@ -87,7 +87,7 @@ die ()
exit $status
}
-options=`getopt -o p:P:c:Rzh --long diff: -- "$@"`
+options=`getopt -o p:P:c:Rzh --long diff:,snapshot -- "$@"`
if [ $? -ne 0 ]
then
@@ -116,8 +116,12 @@ do
shift ;;
-h)
usage -h ;;
+ --snapshot)
+ opt_snapshot=1
+ snap_dir=.pc/.snap0
+ shift ;;
--diff)
- opt_diff=$2
+ opt_diff="$2"
shift 2 ;;
--)
shift
@@ -159,6 +163,25 @@ then
die 1
fi
+if [ -n "$opt_snapshot" -a ${#opt_files[@]} -eq 0 ]
+then
+ # Add all files in the snapshot into the file list (they may all
+ # have changed).
+ while read file
+ do
+ patches[${#patches[@]}]="-"
+ file="${file#$snap_dir/}"
+ files[${#files[@]}]="$file"
+ done \
+ < <(find $snap_dir -type f)
+ # Also look at all patches that are currently applied.
+ opt_combine="$(applied_patches | head -n 1)"
+
+ # The patches-per-file cache is buggy -- it should best go away
+ # completely.
+ rm -f .pc/patches-per-file
+fi
+
if [ -n "$opt_combine" ]
then
if ! refresh_patches_per_file
@@ -188,6 +211,7 @@ then
then
continue
fi
+ in_array "$file" "${files[@]}" && continue
patches[${#patches[@]}]="$first"
files[${#files[@]}]="$file"
done \
@@ -200,11 +224,12 @@ else
then
continue
fi
+ in_array "$file" "${files[@]}" && continue
files[${#files[@]}]="$file"
done
fi
-if [ ${#opt_files[@]} -gt 0 ]
+if [ ${#opt_files[@]} -gt 0 -a -z "$opt_snapshot" ]
then
for file in "${opt_files[@]}"
do
@@ -271,6 +296,16 @@ do
file="${files[$i]}"
first_patch=${patches[$i]:-$last_patch}
+ if [ -n "$opt_snapshot" -a -e "$snap_dir/$file" ]
+ then
+ old_file="$snap_dir/$file"
+ elif [ -z "$opt_relative" ]
+ then
+ old_file="$(backup_file_name $first_patch $file)"
+ else
+ old_file="$workdir/$file"
+ fi
+
next_patch=$(next_patch_for_file $last_patch $file)
if [ -z "$next_patch" ]
then
@@ -280,13 +315,7 @@ do
files_were_shadowed=1
fi
- if [ -z "$opt_relative" ]
- then
- old_file=$(backup_file_name $first_patch $file)
- do_diff $file $old_file $new_file
- else
- do_diff $file "$workdir/$file" $new_file
- fi
+ do_diff "$file" "$old_file" "$new_file"
if [ $? -ne 0 ]
then
diff --git a/quilt/snapshot.in b/quilt/snapshot.in
new file mode 100644
index 0000000..079c81b
--- /dev/null
+++ b/quilt/snapshot.in
@@ -0,0 +1,98 @@
+#! @BASH@
+
+# This script is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# See the COPYING and AUTHORS files for more details.
+
+# Read in library functions
+if [ "$(type -t patch_file_name)" != function ]
+then
+ if ! [ -r @SCRIPTS@/patchfns ]
+ then
+ echo "Cannot read library @SCRIPTS@/patchfns" >&2
+ exit 1
+ fi
+ . @SCRIPTS@/patchfns
+fi
+
+usage()
+{
+ echo $"Usage: quilt snapshot [-d]"
+ if [ x$1 = x-h ]
+ then
+ echo $"
+
+Take a snapshot of the current working state.
+
+-d Remove current snapshot.
+
+"
+ exit 0
+ else
+ exit 1
+ fi
+}
+
+options=`getopt -o dh -- "$@"`
+
+if [ $? -ne 0 ]
+then
+ usage
+fi
+
+eval set -- "$options"
+
+while true
+do
+ case "$1" in
+ -d)
+ opt_remove=1
+ shift ;;
+ -h)
+ usage -h ;;
+ --)
+ shift
+ break ;;
+ esac
+done
+
+if [ $# -ne 0 ]
+then
+ usage
+fi
+
+snap_dir=.pc/.snap0
+
+# Clean up from previous snapshot
+rm -rf $snap_dir
+mkdir -p $snap_dir
+
+if [ -n "$opt_remove" ]
+then
+ exit 0
+fi
+
+# Save current working state
+for patch in $(applied_patches | tac)
+do
+ for file in $(files_in_patch $patch)
+ do
+ if ! [ -e "$snap_dir/$file" ]
+ then
+ mkdir -p "$snap_dir/$(dirname $file)"
+ if [ -e "$file" ]
+ then
+ ln "$file" "$snap_dir/$file"
+ else
+ touch "$snap_dir/$file"
+ fi
+ fi
+ done
+done
+
+### Local Variables:
+### mode: shell-script
+### End:
+# vim:filetype=sh