summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwangdi <wangdi>2003-11-03 11:58:17 +0000
committerwangdi <wangdi>2003-11-03 11:58:17 +0000
commit1d1b43c9077ae04a464bd448a15426bed1677a58 (patch)
tree1d69f53505645763bebda8c6b0f19670ffa2cbd2
parentf5765c495303678f13499a9734cacc606c29aa3f (diff)
downloadquilt-1d1b43c9077ae04a464bd448a15426bed1677a58.tar.gz
update quilt from branch HEAD and fix some bugs
-rw-r--r--Makefile.in4
-rw-r--r--TODO59
-rw-r--r--configure.ac4
-rw-r--r--doc/sample.quiltrc3
-rw-r--r--lib/backup-files.c37
-rw-r--r--po/de.po128
-rw-r--r--po/fr.po128
-rw-r--r--po/quilt.pot110
-rw-r--r--quilt.changes38
-rw-r--r--quilt.spec.in2
-rw-r--r--quilt/add.in3
-rw-r--r--quilt/diff.in11
-rw-r--r--quilt/fork.in63
-rw-r--r--quilt/import.in6
-rw-r--r--quilt/new.in6
-rw-r--r--quilt/refresh.in9
-rw-r--r--quilt/remove.in6
-rw-r--r--quilt/snapshot.in20
-rwxr-xr-xscripts/apatch.in87
-rw-r--r--scripts/patchfns.in99
-rwxr-xr-xscripts/rpatch.in234
-rw-r--r--test/conflicts.test139
-rw-r--r--test/merge.test87
-rw-r--r--test/one.test39
24 files changed, 727 insertions, 595 deletions
diff --git a/Makefile.in b/Makefile.in
index 72242a3..54b6e0f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -109,7 +109,7 @@ dist : clean $(PACKAGE)-$(VERSION).tar.gz
snapshot : $(PACKAGE)-$(ISODATE).tar.bz2
rpm rpmbuild : $(PACKAGE)-$(VERSION).tar.gz
- $(RPMBUILD) -tb $<
+ $(RPMBUILD) -ta $<
doc/README : doc/README.in
@echo README.in -> README
@@ -132,7 +132,7 @@ reference : $(QUILT:%=quilt/%)
echo; \
(bash -c ". scripts/patchfns ;LC_ALL=C . $$i -h"); \
done | \
- sed -e '/^Usage: \?/ {s/^Usage: \?// ; p ; d}' \
+ sed -e 's/^Usage: \?// ; p ; d' \
-e 's/^/ /'
bin/guards.1 : bin/guards
diff --git a/TODO b/TODO
index 20c4be0..e038b87 100644
--- a/TODO
+++ b/TODO
@@ -16,14 +16,6 @@ General:
optionally something like rcs can be used instead of
lib/backup-files?
- - Add regression test suite; the scripts were broken often enough
- already...
-
- - Add a ~/.quiltrc that contains default options for individual
- commands, similar to ~/.cvsrc. Also requires some more
- negative options so that the effects of ~/.quiltrc can be
- reversed.
-
- Add something similar to cvs diff, which scans all files for
changes that have not been folded back into their patches,
similar to:
@@ -32,8 +24,6 @@ General:
- Allow to add a directory? Then we could detect also new files
in the directory, without having to add them individually.
- - Add option for creating hard links.
-
- Instead of passing around and storing in applied-patches the
short patch name (=patch file name with .dif .diff .patch .gz
.bz2 stripped), translate from short names to real file names
@@ -45,32 +35,18 @@ General:
Documentation:
- - How to rediff with pushpatch -f / poppatch -f?
+ - How to rediff with push -f / pop -f?
- How to import a new version of a patch?
- How to import a complete directory, before doing
- wild changes? (This will also cause new files to end up in the
- patch.)
+ wild changes?
quilt refresh:
- Add an -m option similar to `cvs commit -m "..."' to simplify
keeping a change log in the patch documentation?
-parse-patch:
-
- - Handle SIGINT in parse-patch -u (in the part that moves the
- temp file to the patch)?
-
-backup-files:
-
- - Extend so that it can also copy files instead of hard linking,
- and when hard links are not possible. Also add option to
- disallow hard links on the original file (for patchadd).
-
- - SIGINT handling?
-
quilt import:
- Add option to replace the currently applied patch with a new
@@ -80,11 +56,6 @@ quilt import:
of them is empty. Let the user decide whether to keep the left
or the right documentation, or to merge them both. (-d{ona}?)
-quilt add:
-
- - Add option for creating (or rather, leaving) hard links.
-
-
quilt setup:
- spec2series also prints -p1; omit.
@@ -101,28 +72,20 @@ rpatch:
hidden by later patches. If so, refuse to remove patch! (Note
that poppatch takes care of that currently.)
+ - Instead of reverse-applying a patch to make sure it contains all
+ changes, forward-apply it to a copy of the .pc/$patch directory,
+ and check if the resulting files are identical. This also works
+ with patches that don't reverse-apply.
+
apatch:
- Allow to add a patch in the middle of the applied series, and
inject the patch in its proper position in applied-patches.
Needs to check if any of the files in the patch are touched by
later patches.
-
-touched_by_patch:
-
- - Implement more of patch's filename heuristic: The following
- file is not recognized, for example...
-
- *** linux/drivers/parport/parport_cs.c.orig Sun Jun 23 09:20:21 2002
- --- linux/drivers/parport/parport_cs.c Sun Jun 23 09:21:02 2002
- ***************
- *** 48,53 ****
- --- 48,54 ----
-
- #include <linux/parport.h>
- #include <linux/parport_pc.h>
- + #include <linux/major.h>
- #include <pcmcia/version.h>
- #include <pcmcia/cs_types.h>
+quilt diff:
+ - The number of contetx lines cannot be overridden in QUILT_DIFF_OPTS:
+ GNU diff uses three context lines as soon as -u or -U3 is on the
+ command line, no matter which order of arguments.
diff --git a/configure.ac b/configure.ac
index 50fb343..9903352 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.26_CFS6],[quilt-dev@nongnu.org])
+AC_INIT([quilt],[0.28_CFS6],[quilt-dev@nongnu.org])
AC_CONFIG_AUX_DIR(config)
AC_PREREQ(2.53)
-AC_REVISION ($Revision: 1.17.2.4 $)
+AC_REVISION ($Revision: 1.17.2.5 $)
PACKAGE_RELEASE=1
AC_SUBST(PACKAGE_RELEASE)
diff --git a/doc/sample.quiltrc b/doc/sample.quiltrc
index 8c9502e..3f81d73 100644
--- a/doc/sample.quiltrc
+++ b/doc/sample.quiltrc
@@ -1,2 +1,5 @@
# -p : Show which C function each change is in.
QUILT_DIFF_OPTS="-p${QUILT_DIFF_OPTS:+ $QUILT_DIFF_OPTS}"
+
+# The directory in which patches are found (defaults to "patches").
+#QUILT_PATCHES=patches
diff --git a/lib/backup-files.c b/lib/backup-files.c
index e4cd45a..43449e5 100644
--- a/lib/backup-files.c
+++ b/lib/backup-files.c
@@ -38,7 +38,7 @@ const char *progname;
enum { what_backup, what_restore, what_remove };
const char *opt_prefix="", *opt_suffix="", *opt_file=NULL;
-int opt_silent=0, opt_what=what_backup;
+int opt_silent=0, opt_what=what_backup, opt_ignore_missing=0;
#define LINE_LENGTH 1024
@@ -99,7 +99,7 @@ remove_parents(char *filename)
}
static int
-link_or_copy(const char *from, const char *to)
+link_or_copy(const char *from, struct stat *st, const char *to)
{
char buffer[4096];
int from_fd, to_fd, error = 1;
@@ -117,7 +117,8 @@ link_or_copy(const char *from, const char *to)
perror(from);
return 1;
}
- if ((to_fd = open(to, O_WRONLY|O_TRUNC))) {
+ unlink(to); /* make sure we don't inherit this file's mode. */
+ if ((to_fd = creat(to, st->st_mode))) {
perror(to);
close(from_fd);
return 1;
@@ -168,7 +169,8 @@ process_file(char *file)
if (!opt_silent)
printf("New file %s\n", file);
- if ((fd = creat(backup, 0666)) == -1) {
+ /* GNU patch creates new files with mode==0. */
+ if ((fd = creat(backup, 0)) == -1) {
perror(backup);
return 1;
}
@@ -176,7 +178,7 @@ process_file(char *file)
} else {
if (!opt_silent)
printf("Copying %s\n", file);
- if (link_or_copy(file, backup) != 0)
+ if (link_or_copy(file, &st, backup) != 0)
return 1;
}
return 0;
@@ -185,6 +187,8 @@ process_file(char *file)
create_parents(file);
if (stat(backup, &st) != 0) {
+ if (opt_ignore_missing && errno == ENOENT)
+ return 0;
perror(backup);
return 1;
}
@@ -192,8 +196,6 @@ process_file(char *file)
if (unlink(file) == 0 || errno == ENOENT) {
if (!opt_silent)
printf("Removing %s\n", file);
- unlink(backup);
- remove_parents(backup);
} else {
perror(file);
return 1;
@@ -202,13 +204,20 @@ process_file(char *file)
if (!opt_silent)
printf("Restoring %s\n", file);
unlink(file);
- if (link_or_copy(backup, file) != 0)
+ if (link_or_copy(backup, &st, file) != 0)
return 1;
- unlink(backup);
- remove_parents(backup);
}
+ if (!(st.st_mode & S_IWUSR)) {
+ /* Change mode of backup file so that we
+ can later remove it. */
+ chmod(backup, st.st_mode | S_IWUSR);
+ }
+ unlink(backup);
+ remove_parents(backup);
return 0;
} else if (opt_what == what_remove) {
+ /* Change mode of backup file so that we can remove it. */
+ chmod(backup, S_IWUSR);
unlink(backup);
remove_parents(backup);
return 0;
@@ -216,14 +225,14 @@ process_file(char *file)
return 1;
}
-int
+ int
main(int argc, char *argv[])
{
int opt, status=0;
progname = argv[0];
- while ((opt = getopt(argc, argv, "rxB:z:f:sh")) != -1) {
+ while ((opt = getopt(argc, argv, "rxB:z:f:shF")) != -1) {
switch(opt) {
case 'r':
opt_what = what_restore;
@@ -241,6 +250,10 @@ main(int argc, char *argv[])
opt_file = optarg;
break;
+ case 'F': /* ignore missing input files */
+ opt_ignore_missing = 1;
+ break;
+
case 'z':
opt_suffix = optarg;
break;
diff --git a/po/de.po b/po/de.po
index 31be957..7cd720d 100644
--- a/po/de.po
+++ b/po/de.po
@@ -49,7 +49,7 @@ msgstr ""
msgid "No patch applied"
msgstr "Kein Patch angewandt"
-#: ../quilt/add.in:80 ../quilt/applied.in:71 ../quilt/refresh.in:182
+#: ../quilt/add.in:80 ../quilt/applied.in:71 ../quilt/refresh.in:187
#: ../quilt/remove.in:80
msgid "Patch $patch is not applied"
msgstr "Patch $patch ist nicht angewandt"
@@ -62,11 +62,11 @@ msgstr "Datei $file ist bereits in Patch $patch enthalten"
msgid "File $file modified by patch $next_patch"
msgstr "Datei $file wird von Patch $next_patch verändert"
-#: ../quilt/add.in:104
+#: ../quilt/add.in:103
msgid "Failed to back up file $file"
msgstr "Konnte Datei $file nicht sichern"
-#: ../quilt/add.in:124
+#: ../quilt/add.in:123
msgid "File $file added to patch $patch"
msgstr "Datei $file zu Patch $patch hinzugefügt"
@@ -175,60 +175,60 @@ msgstr ""
"-z\tÄnderungen relativ zum angewandten Patch ausgeben.\n"
"\n"
-#: ../quilt/diff.in:138
+#: ../quilt/diff.in:140
#, fuzzy
msgid "Options \\`-c patch', \\`--snapshot', and \\`-z' cannot be combined."
msgstr "Die Optionen \\`-c patch' and \\`-z' können nicht kombiniert werden."
-#: ../quilt/diff.in:147 ../quilt/refresh.in:175
+#: ../quilt/diff.in:149 ../quilt/refresh.in:180
msgid "No patch seem to be applied"
msgstr "Es ist kein Patch angewandt"
-#: ../quilt/diff.in:154
+#: ../quilt/diff.in:156
msgid "Patch $last_patch is not applied"
msgstr "Patch $last_patch ist nicht angewandt"
-#: ../quilt/diff.in:164
+#: ../quilt/diff.in:166
msgid ""
"Cannot diff patches with -p$opt_strip_level, please specify -p0 or -p1 "
"instead"
msgstr ""
"Kann kein Diff mit -p$opt_strip_level erzeugen, bitte -p0 oder -p1 verwenden."
-#: ../quilt/diff.in:198
+#: ../quilt/diff.in:200
#, fuzzy
msgid "Patch $first_patch not applied before $last_patch."
msgstr "Patch $opt_combine ist nicht vor Patch $last_patch angewandt."
-#: ../quilt/diff.in:233
+#: ../quilt/diff.in:234
msgid "Cannot change into .pc/$last_patch"
msgstr "Kann nicht in Verzeichnis .pc/$last_patch wechseln."
-#: ../quilt/diff.in:238
+#: ../quilt/diff.in:239 ../scripts/rpatch.in:67
msgid "Failed to copy files to temporary directory"
msgstr "Konnte Dateien nicht in ein temporäres Verzeichnis kopieren"
-#: ../quilt/diff.in:243
+#: ../quilt/diff.in:250
msgid "Cannot change to temporary directory"
msgstr "Kann nicht in temporäres Verzeichnis wechseln"
-#: ../quilt/diff.in:260
+#: ../quilt/diff.in:267 ../scripts/rpatch.in:95
msgid "Failed to patch temporary files"
msgstr "Konnte temporäre Dateien nicht patchen"
-#: ../quilt/diff.in:267
+#: ../quilt/diff.in:274
msgid "Cannot change to source directory"
msgstr "Kann nicht in Quellverzeichnis wechseln"
-#: ../quilt/diff.in:285
+#: ../quilt/diff.in:292
msgid "File $file is not being modified."
msgstr "Datei $file wird nicht verändert."
-#: ../quilt/diff.in:304 ../quilt/refresh.in:215
+#: ../quilt/diff.in:311 ../quilt/refresh.in:220
msgid "Diff failed, aborting."
msgstr "Diff fehlgeschlagen, Abbruch."
-#: ../quilt/diff.in:311
+#: ../quilt/diff.in:318
msgid "More recent patches modify files in $last_patch."
msgstr "Später angewandte Patches verändern Dateien von $last_patch."
@@ -648,7 +648,7 @@ msgstr ""
"\teinige der selben Dateien verändern.\n"
"\n"
-#: ../quilt/refresh.in:192
+#: ../quilt/refresh.in:197
msgid ""
"Cannot refresh patches with -p$opt_strip_level, please specify -p0 or -p1 "
"instead"
@@ -656,17 +656,17 @@ msgstr ""
"Kann Patches mit Level -p$opt_strip_level nicht auffrischen, bitte -p0 oder -"
"p1 angeben"
-#: ../quilt/refresh.in:221
+#: ../quilt/refresh.in:226
msgid "More recent patches modify files in $patch. Enforce refresh with -f."
msgstr ""
"Später angewandte Patches verändern Dateien von $patch. Auffrischen mit -f "
"erzwingen."
-#: ../quilt/refresh.in:228
+#: ../quilt/refresh.in:233
msgid "Nothing in patch $patch"
msgstr "Patch $patch is leer"
-#: ../quilt/refresh.in:268
+#: ../quilt/refresh.in:275
msgid "Refreshed patch $patch"
msgstr "Patch $patch aufgefrischt."
@@ -703,7 +703,7 @@ msgstr "Datei $file ist nicht in Patch $patch enthalten."
msgid "Failed to remove file $file from patch $patch"
msgstr "Konnte Datei $file nicht aus Patch $patch entfernen."
-#: ../quilt/remove.in:116
+#: ../quilt/remove.in:110
msgid "File $file removed from patch $patch"
msgstr "Datei $file aus Patch $patch entfernt."
@@ -752,52 +752,52 @@ msgid ""
"\tspecified, also create a symlink to the series file.\n"
msgstr ""
-#: ../quilt/setup.in:126
+#: ../quilt/setup.in:110
msgid "Series file $series_file not found"
msgstr "Seriendatei $series_file nicht gefunden"
-#: ../quilt/setup.in:152
+#: ../quilt/setup.in:136
msgid "Reading sources from $arg"
msgstr "Quellen werden von $arg gelesen"
-#: ../quilt/setup.in:156
+#: ../quilt/setup.in:140
msgid "Unpacking archive $source/$arg"
msgstr "Entpacke Archiv source/$arg"
-#: ../quilt/setup.in:166
+#: ../quilt/setup.in:150
msgid "Directory $packagedir exists already."
msgstr "Verzeichnis $packagedir existiert bereits."
-#: ../quilt/setup.in:171
+#: ../quilt/setup.in:155
msgid "File $packagedir exists."
msgstr "Datei $packagedir existiert."
-#: ../quilt/setup.in:186
+#: ../quilt/setup.in:170
msgid "Creating link to patches directory $arg"
msgstr ""
-#: ../quilt/setup.in:190
+#: ../quilt/setup.in:174
msgid "$packagedir/patches exist, but not symlink"
msgstr ""
-#: ../quilt/setup.in:195
+#: ../quilt/setup.in:179
msgid "Copying patch $source/$arg"
msgstr "Kopiere Patch $source/$arg"
-#: ../quilt/setup.in:208
+#: ../quilt/setup.in:192
#, fuzzy
msgid "File $packagedir/series exists; will not override."
msgstr "Datei $packagedir existiert."
-#: ../quilt/setup.in:215 ../quilt/setup.in:229
+#: ../quilt/setup.in:199 ../quilt/setup.in:213
msgid "Copying series file"
msgstr "Kopiere Seriendatei"
-#: ../quilt/setup.in:225
+#: ../quilt/setup.in:209
msgid "Creatig link to series file $arg"
msgstr ""
-#: ../quilt/setup.in:259
+#: ../quilt/setup.in:243
msgid "Directory $packagedir set up."
msgstr "Verzeichnis $packagedir aufgebaut."
@@ -843,77 +843,71 @@ msgstr ""
msgid "Usage: $0 [-fqv] patchname"
msgstr "Verwendung: $0 [-fqv] patchname"
-#: ../scripts/apatch.in:40
+#: ../scripts/apatch.in:43
msgid "Interrupted by user; patch $patch was not applied."
msgstr "Unterbrechung durch Benutzer; Patch $patch wurde nicht angewandt."
-#: ../scripts/apatch.in:51 ../scripts/rpatch.in:128
+#: ../scripts/apatch.in:54
msgid "Patch file $patch_file appears to be empty"
msgstr "Patch-Datei $patch_file scheint leer zu sein"
-#: ../scripts/apatch.in:80
-msgid "refresh_file_list failed"
-msgstr "Fehler in refresh_file_list"
-
-#: ../scripts/apatch.in:84
+#: ../scripts/apatch.in:94
msgid "Applying $patch"
msgstr "Anwenden von $patch"
-#: ../scripts/apatch.in:87
+#: ../scripts/apatch.in:113
msgid "Patch $patch appears to be empty, applied"
msgstr "Patch $patch scheint leer zu sein, angewandt"
-#: ../scripts/apatch.in:95
-msgid "Recreated file list for $patch"
-msgstr "Dateiliste für $patch aktualisiert"
-
-#: ../scripts/apatch.in:126
+#: ../scripts/apatch.in:116
msgid "Applied $patch (forced; needs refresh)"
msgstr "Patch $patch angewandt (erzwungen, muß aufgefrischt werden (Refresh))"
-#: ../scripts/apatch.in:130
+#: ../scripts/apatch.in:120
msgid "Patch $patch does not apply (enforce with -f)"
msgstr "Patch $patch läßt sich nicht anwenden (erzwingen mit -f)"
-#: ../scripts/apatch.in:186 ../scripts/rpatch.in:257
+#: ../scripts/apatch.in:177 ../scripts/rpatch.in:217
msgid "The topmost patch $top needs to be refreshed first."
msgstr "Der oberste Patch $top muss zuerst aufgefrischt werden (Refresh)."
-#: ../scripts/rpatch.in:21
+#: ../scripts/rpatch.in:22
msgid "Usage: $0 [-fRq] patchname"
msgstr "Verwendung: $0 [-fRq] patchname"
-#: ../scripts/rpatch.in:43
-msgid "Patch does not remove changes:"
-msgstr "Patch entfernt folgende Änderungen nicht:"
-
-#: ../scripts/rpatch.in:117
-msgid "Interrupted by user; patch $patch was not removed."
-msgstr "Unterbrechung durch Benutzer; Patch $patch wurde nicht entfernt."
+#: ../scripts/rpatch.in:110
+#, fuzzy
+msgid "Patch $patch does not remove cleanly (enforce with -f)."
+msgstr "Patch $patch kann nicht entfernt werden (erzwingen mit -f)"
-#: ../scripts/rpatch.in:153
+#: ../scripts/rpatch.in:127
msgid "Patch $patch appears to be empty, removed"
msgstr "Patch $patch scheint leer zu sein, entfernt"
-#: ../scripts/rpatch.in:158
+#: ../scripts/rpatch.in:160
msgid "Removing $patch"
msgstr "Entferne $patch"
-#: ../scripts/rpatch.in:183
-msgid "Failed to create temporary files"
-msgstr "Konnte temporäres Verzeichnis nicht erstellen"
-
-#: ../scripts/rpatch.in:204
-msgid "Patch $patch does not remove (enforce with -f)"
-msgstr "Patch $patch kann nicht entfernt werden (erzwingen mit -f)"
-
#: ../scripts/spec2series.in:100 ../scripts/spec2series.in:192
msgid " done"
msgstr " fertig"
-#~ msgid "refresh_patches_per_file failed."
+#, fuzzy
+#~ msgid "refresh_file_list failed"
#~ msgstr "Fehler in refresh_patches_per_file."
+#~ msgid "Recreated file list for $patch"
+#~ msgstr "Dateiliste für $patch aktualisiert"
+
+#~ msgid "Patch does not remove changes:"
+#~ msgstr "Patch entfernt folgende Änderungen nicht:"
+
+#~ msgid "Interrupted by user; patch $patch was not removed."
+#~ msgstr "Unterbrechung durch Benutzer; Patch $patch wurde nicht entfernt."
+
+#~ msgid "Failed to create temporary files"
+#~ msgstr "Konnte temporäres Verzeichnis nicht erstellen"
+
#~ msgid ""
#~ "\n"
#~ "\n"
diff --git a/po/fr.po b/po/fr.po
index 1b5e3bf..c8306bb 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -50,7 +50,7 @@ msgstr ""
msgid "No patch applied"
msgstr "Aucun patch n'est appliqué"
-#: ../quilt/add.in:80 ../quilt/applied.in:71 ../quilt/refresh.in:182
+#: ../quilt/add.in:80 ../quilt/applied.in:71 ../quilt/refresh.in:187
#: ../quilt/remove.in:80
msgid "Patch $patch is not applied"
msgstr "Le patch $patch n'est pas appliqué"
@@ -63,11 +63,11 @@ msgstr "Le fichier $file est déjà dans le patch $patch"
msgid "File $file modified by patch $next_patch"
msgstr "Le fichier $file est modifié par le patch $next_patch"
-#: ../quilt/add.in:104
+#: ../quilt/add.in:103
msgid "Failed to back up file $file"
msgstr "Impossible de faire une copie de sécurité de $file"
-#: ../quilt/add.in:124
+#: ../quilt/add.in:123
msgid "File $file added to patch $patch"
msgstr "Le fichier $file a été ajouté au patch $patch"
@@ -175,20 +175,20 @@ msgstr ""
"\tau patch spécifié.\n"
"\n"
-#: ../quilt/diff.in:138
+#: ../quilt/diff.in:140
#, fuzzy
msgid "Options \\`-c patch', \\`--snapshot', and \\`-z' cannot be combined."
msgstr "Les options \\`-c patch' et \\`-z' ne peuvent pas être combinées."
-#: ../quilt/diff.in:147 ../quilt/refresh.in:175
+#: ../quilt/diff.in:149 ../quilt/refresh.in:180
msgid "No patch seem to be applied"
msgstr "Aucun patch ne semble appliqué"
-#: ../quilt/diff.in:154
+#: ../quilt/diff.in:156
msgid "Patch $last_patch is not applied"
msgstr "Le patch $last_patch ne semble pas appliqué"
-#: ../quilt/diff.in:164
+#: ../quilt/diff.in:166
msgid ""
"Cannot diff patches with -p$opt_strip_level, please specify -p0 or -p1 "
"instead"
@@ -196,40 +196,40 @@ msgstr ""
"Impossible de créer des patches avec -p$opt_strip_level. Veuillez spécifier -"
"p0 ou -p1 à la place"
-#: ../quilt/diff.in:198
+#: ../quilt/diff.in:200
#, fuzzy
msgid "Patch $first_patch not applied before $last_patch."
msgstr "Le patch $opt_combine n'est pas appliqué avant $last_patch."
-#: ../quilt/diff.in:233
+#: ../quilt/diff.in:234
msgid "Cannot change into .pc/$last_patch"
msgstr "Impossible d'entrer dans .pc/$last_patch"
-#: ../quilt/diff.in:238
+#: ../quilt/diff.in:239 ../scripts/rpatch.in:67
msgid "Failed to copy files to temporary directory"
msgstr "Impossible de copier les fichiers dans le répertoire temporaire"
-#: ../quilt/diff.in:243
+#: ../quilt/diff.in:250
msgid "Cannot change to temporary directory"
msgstr "Impossible d'entrer dans le répertoire temporaire"
-#: ../quilt/diff.in:260
+#: ../quilt/diff.in:267 ../scripts/rpatch.in:95
msgid "Failed to patch temporary files"
msgstr "Impossible de patcher les fichiers temporaires"
-#: ../quilt/diff.in:267
+#: ../quilt/diff.in:274
msgid "Cannot change to source directory"
msgstr "Impossible d'entrer dans le répertoire source"
-#: ../quilt/diff.in:285
+#: ../quilt/diff.in:292
msgid "File $file is not being modified."
msgstr "Le fichier $file n'est pas modifié."
-#: ../quilt/diff.in:304 ../quilt/refresh.in:215
+#: ../quilt/diff.in:311 ../quilt/refresh.in:220
msgid "Diff failed, aborting."
msgstr "Le diff a échoué. Abandon."
-#: ../quilt/diff.in:311
+#: ../quilt/diff.in:318
msgid "More recent patches modify files in $last_patch."
msgstr "Un patch plus recent modifie des fichiers communs à $last_patch."
@@ -652,7 +652,7 @@ msgstr ""
"-f\tForce le rafraîchissement, même si des patches plus haut changent \n"
"\tles mêmes fichiers.\n"
-#: ../quilt/refresh.in:192
+#: ../quilt/refresh.in:197
msgid ""
"Cannot refresh patches with -p$opt_strip_level, please specify -p0 or -p1 "
"instead"
@@ -660,17 +660,17 @@ msgstr ""
"Impossible de rafraîchir des patchs avec -p$opt_strip_level. Veuillez\n"
"spécifier -p0 ou -p1 à la place."
-#: ../quilt/refresh.in:221
+#: ../quilt/refresh.in:226
msgid "More recent patches modify files in $patch. Enforce refresh with -f."
msgstr ""
"Des fichiers plus récents modifient les mêmes fichiers que $patch.\n"
"Forcez le rafraîchissement avec -f."
-#: ../quilt/refresh.in:228
+#: ../quilt/refresh.in:233
msgid "Nothing in patch $patch"
msgstr "Le patch $patch ne contient rien"
-#: ../quilt/refresh.in:268
+#: ../quilt/refresh.in:275
msgid "Refreshed patch $patch"
msgstr "Le patch $patch a été rafraichi."
@@ -707,7 +707,7 @@ msgstr "Le fichier $file n'est pas dans le patch $patch."
msgid "Failed to remove file $file from patch $patch"
msgstr "Impossible d'enlever le fichier $file du patch $patch."
-#: ../quilt/remove.in:116
+#: ../quilt/remove.in:110
msgid "File $file removed from patch $patch"
msgstr "Le fichier $file a été enlevé du patch $patch."
@@ -757,52 +757,52 @@ msgid ""
"\tspecified, also create a symlink to the series file.\n"
msgstr ""
-#: ../quilt/setup.in:126
+#: ../quilt/setup.in:110
msgid "Series file $series_file not found"
msgstr "Fichier de série $series_file introuvable"
-#: ../quilt/setup.in:152
+#: ../quilt/setup.in:136
msgid "Reading sources from $arg"
msgstr "Lecture des sources depuis $arg"
-#: ../quilt/setup.in:156
+#: ../quilt/setup.in:140
msgid "Unpacking archive $source/$arg"
msgstr "Désarchivage depuis $source/$arg"
-#: ../quilt/setup.in:166
+#: ../quilt/setup.in:150
msgid "Directory $packagedir exists already."
msgstr "Le répertoire $packagedir existe déjà."
-#: ../quilt/setup.in:171
+#: ../quilt/setup.in:155
msgid "File $packagedir exists."
msgstr "Le fichier $packagedir existe."
-#: ../quilt/setup.in:186
+#: ../quilt/setup.in:170
msgid "Creating link to patches directory $arg"
msgstr ""
-#: ../quilt/setup.in:190
+#: ../quilt/setup.in:174
msgid "$packagedir/patches exist, but not symlink"
msgstr ""
-#: ../quilt/setup.in:195
+#: ../quilt/setup.in:179
msgid "Copying patch $source/$arg"
msgstr "Copie du patch $source/$arg"
-#: ../quilt/setup.in:208
+#: ../quilt/setup.in:192
#, fuzzy
msgid "File $packagedir/series exists; will not override."
msgstr "Le fichier $packagedir existe."
-#: ../quilt/setup.in:215 ../quilt/setup.in:229
+#: ../quilt/setup.in:199 ../quilt/setup.in:213
msgid "Copying series file"
msgstr "Copie du fichier de série"
-#: ../quilt/setup.in:225
+#: ../quilt/setup.in:209
msgid "Creatig link to series file $arg"
msgstr ""
-#: ../quilt/setup.in:259
+#: ../quilt/setup.in:243
msgid "Directory $packagedir set up."
msgstr "Le répertoire $packagedir est configuré."
@@ -850,78 +850,72 @@ msgstr ""
msgid "Usage: $0 [-fqv] patchname"
msgstr "Usage : $0 [-fqv] patchname"
-#: ../scripts/apatch.in:40
+#: ../scripts/apatch.in:43
msgid "Interrupted by user; patch $patch was not applied."
msgstr "Interrompu par l'utilisateur ; le patch $patch n'a pas été appliqué."
-#: ../scripts/apatch.in:51 ../scripts/rpatch.in:128
+#: ../scripts/apatch.in:54
msgid "Patch file $patch_file appears to be empty"
msgstr "Le fichier de patch $patch_file semble vide"
-#: ../scripts/apatch.in:80
-msgid "refresh_file_list failed"
-msgstr "refresh_file_list a échoué."
-
-#: ../scripts/apatch.in:84
+#: ../scripts/apatch.in:94
msgid "Applying $patch"
msgstr "Application de $patch"
-#: ../scripts/apatch.in:87
+#: ../scripts/apatch.in:113
msgid "Patch $patch appears to be empty, applied"
msgstr "Le patch $patch semble vide. Il a été appliqué."
-#: ../scripts/apatch.in:95
-msgid "Recreated file list for $patch"
-msgstr "La liste des fichiers pour $patch a été recrée."
-
-#: ../scripts/apatch.in:126
+#: ../scripts/apatch.in:116
msgid "Applied $patch (forced; needs refresh)"
msgstr "$patch a été appliqué (forcé ; vous devriez le rafraîchir)"
-#: ../scripts/apatch.in:130
+#: ../scripts/apatch.in:120
msgid "Patch $patch does not apply (enforce with -f)"
msgstr ""
"Le patch $patch ne s'applique pas proprement (forcez l'application avec -f)"
-#: ../scripts/apatch.in:186 ../scripts/rpatch.in:257
+#: ../scripts/apatch.in:177 ../scripts/rpatch.in:217
msgid "The topmost patch $top needs to be refreshed first."
msgstr "Le patch au sommet $top doit être rafraichi au préalable."
-#: ../scripts/rpatch.in:21
+#: ../scripts/rpatch.in:22
msgid "Usage: $0 [-fRq] patchname"
msgstr "Usage: $0 [-fRq] nom_de_patch"
-#: ../scripts/rpatch.in:43
-msgid "Patch does not remove changes:"
-msgstr "Le patch d'enlève pas les changements :"
-
-#: ../scripts/rpatch.in:117
-msgid "Interrupted by user; patch $patch was not removed."
-msgstr "Interrompu par l'utilisateur ; le patch $patch n'a pas été retiré;"
+#: ../scripts/rpatch.in:110
+#, fuzzy
+msgid "Patch $patch does not remove cleanly (enforce with -f)."
+msgstr "Le patch $patch ne se retire pas proprement (forcez avec -f)"
-#: ../scripts/rpatch.in:153
+#: ../scripts/rpatch.in:127
msgid "Patch $patch appears to be empty, removed"
msgstr "Le patch $patch semble vide. Il a été retiré."
-#: ../scripts/rpatch.in:158
+#: ../scripts/rpatch.in:160
msgid "Removing $patch"
msgstr "Retrait de $patch"
-#: ../scripts/rpatch.in:183
-msgid "Failed to create temporary files"
-msgstr "Impossible de créer les fichiers temporaires"
-
-#: ../scripts/rpatch.in:204
-msgid "Patch $patch does not remove (enforce with -f)"
-msgstr "Le patch $patch ne se retire pas proprement (forcez avec -f)"
-
#: ../scripts/spec2series.in:100 ../scripts/spec2series.in:192
msgid " done"
msgstr " fini"
-#~ msgid "refresh_patches_per_file failed."
+#, fuzzy
+#~ msgid "refresh_file_list failed"
#~ msgstr "refresh_patches_per_file a échoué."
+#~ msgid "Recreated file list for $patch"
+#~ msgstr "La liste des fichiers pour $patch a été recrée."
+
+#~ msgid "Patch does not remove changes:"
+#~ msgstr "Le patch d'enlève pas les changements :"
+
+#~ msgid "Interrupted by user; patch $patch was not removed."
+#~ msgstr "Interrompu par l'utilisateur ; le patch $patch n'a pas été retiré;"
+
+#~ msgid "Failed to create temporary files"
+#~ msgstr "Impossible de créer les fichiers temporaires"
+
#~ msgid ""
#~ "\n"
#~ "\n"
diff --git a/po/quilt.pot b/po/quilt.pot
index 45a0187..a0d7026 100644
--- a/po/quilt.pot
+++ b/po/quilt.pot
@@ -27,7 +27,7 @@ msgstr ""
msgid "No patch applied"
msgstr ""
-#: ../quilt/add.in:80 ../quilt/applied.in:71 ../quilt/refresh.in:182
+#: ../quilt/add.in:80 ../quilt/applied.in:71 ../quilt/refresh.in:187
#: ../quilt/remove.in:80
msgid "Patch $patch is not applied"
msgstr ""
@@ -40,11 +40,11 @@ msgstr ""
msgid "File $file modified by patch $next_patch"
msgstr ""
-#: ../quilt/add.in:104
+#: ../quilt/add.in:103
msgid "Failed to back up file $file"
msgstr ""
-#: ../quilt/add.in:124
+#: ../quilt/add.in:123
msgid "File $file added to patch $patch"
msgstr ""
@@ -118,57 +118,57 @@ msgid ""
"\n"
msgstr ""
-#: ../quilt/diff.in:138
+#: ../quilt/diff.in:140
msgid "Options \\`-c patch', \\`--snapshot', and \\`-z' cannot be combined."
msgstr ""
-#: ../quilt/diff.in:147 ../quilt/refresh.in:175
+#: ../quilt/diff.in:149 ../quilt/refresh.in:180
msgid "No patch seem to be applied"
msgstr ""
-#: ../quilt/diff.in:154
+#: ../quilt/diff.in:156
msgid "Patch $last_patch is not applied"
msgstr ""
-#: ../quilt/diff.in:164
+#: ../quilt/diff.in:166
msgid ""
"Cannot diff patches with -p$opt_strip_level, please specify -p0 or -p1 "
"instead"
msgstr ""
-#: ../quilt/diff.in:198
+#: ../quilt/diff.in:200
msgid "Patch $first_patch not applied before $last_patch."
msgstr ""
-#: ../quilt/diff.in:233
+#: ../quilt/diff.in:234
msgid "Cannot change into .pc/$last_patch"
msgstr ""
-#: ../quilt/diff.in:238
+#: ../quilt/diff.in:239 ../scripts/rpatch.in:67
msgid "Failed to copy files to temporary directory"
msgstr ""
-#: ../quilt/diff.in:243
+#: ../quilt/diff.in:250
msgid "Cannot change to temporary directory"
msgstr ""
-#: ../quilt/diff.in:260
+#: ../quilt/diff.in:267 ../scripts/rpatch.in:95
msgid "Failed to patch temporary files"
msgstr ""
-#: ../quilt/diff.in:267
+#: ../quilt/diff.in:274
msgid "Cannot change to source directory"
msgstr ""
-#: ../quilt/diff.in:285
+#: ../quilt/diff.in:292
msgid "File $file is not being modified."
msgstr ""
-#: ../quilt/diff.in:304 ../quilt/refresh.in:215
+#: ../quilt/diff.in:311 ../quilt/refresh.in:220
msgid "Diff failed, aborting."
msgstr ""
-#: ../quilt/diff.in:311
+#: ../quilt/diff.in:318
msgid "More recent patches modify files in $last_patch."
msgstr ""
@@ -473,21 +473,21 @@ msgid ""
"\t\n"
msgstr ""
-#: ../quilt/refresh.in:192
+#: ../quilt/refresh.in:197
msgid ""
"Cannot refresh patches with -p$opt_strip_level, please specify -p0 or -p1 "
"instead"
msgstr ""
-#: ../quilt/refresh.in:221
+#: ../quilt/refresh.in:226
msgid "More recent patches modify files in $patch. Enforce refresh with -f."
msgstr ""
-#: ../quilt/refresh.in:228
+#: ../quilt/refresh.in:233
msgid "Nothing in patch $patch"
msgstr ""
-#: ../quilt/refresh.in:268
+#: ../quilt/refresh.in:275
msgid "Refreshed patch $patch"
msgstr ""
@@ -515,7 +515,7 @@ msgstr ""
msgid "Failed to remove file $file from patch $patch"
msgstr ""
-#: ../quilt/remove.in:116
+#: ../quilt/remove.in:110
msgid "File $file removed from patch $patch"
msgstr ""
@@ -555,51 +555,51 @@ msgid ""
"\tspecified, also create a symlink to the series file.\n"
msgstr ""
-#: ../quilt/setup.in:126
+#: ../quilt/setup.in:110
msgid "Series file $series_file not found"
msgstr ""
-#: ../quilt/setup.in:152
+#: ../quilt/setup.in:136
msgid "Reading sources from $arg"
msgstr ""
-#: ../quilt/setup.in:156
+#: ../quilt/setup.in:140
msgid "Unpacking archive $source/$arg"
msgstr ""
-#: ../quilt/setup.in:166
+#: ../quilt/setup.in:150
msgid "Directory $packagedir exists already."
msgstr ""
-#: ../quilt/setup.in:171
+#: ../quilt/setup.in:155
msgid "File $packagedir exists."
msgstr ""
-#: ../quilt/setup.in:186
+#: ../quilt/setup.in:170
msgid "Creating link to patches directory $arg"
msgstr ""
-#: ../quilt/setup.in:190
+#: ../quilt/setup.in:174
msgid "$packagedir/patches exist, but not symlink"
msgstr ""
-#: ../quilt/setup.in:195
+#: ../quilt/setup.in:179
msgid "Copying patch $source/$arg"
msgstr ""
-#: ../quilt/setup.in:208
+#: ../quilt/setup.in:192
msgid "File $packagedir/series exists; will not override."
msgstr ""
-#: ../quilt/setup.in:215 ../quilt/setup.in:229
+#: ../quilt/setup.in:199 ../quilt/setup.in:213
msgid "Copying series file"
msgstr ""
-#: ../quilt/setup.in:225
+#: ../quilt/setup.in:209
msgid "Creatig link to series file $arg"
msgstr ""
-#: ../quilt/setup.in:259
+#: ../quilt/setup.in:243
msgid "Directory $packagedir set up."
msgstr ""
@@ -635,70 +635,50 @@ msgstr ""
msgid "Usage: $0 [-fqv] patchname"
msgstr ""
-#: ../scripts/apatch.in:40
+#: ../scripts/apatch.in:43
msgid "Interrupted by user; patch $patch was not applied."
msgstr ""
-#: ../scripts/apatch.in:51 ../scripts/rpatch.in:128
+#: ../scripts/apatch.in:54
msgid "Patch file $patch_file appears to be empty"
msgstr ""
-#: ../scripts/apatch.in:80
-msgid "refresh_file_list failed"
-msgstr ""
-
-#: ../scripts/apatch.in:84
+#: ../scripts/apatch.in:94
msgid "Applying $patch"
msgstr ""
-#: ../scripts/apatch.in:87
+#: ../scripts/apatch.in:113
msgid "Patch $patch appears to be empty, applied"
msgstr ""
-#: ../scripts/apatch.in:95
-msgid "Recreated file list for $patch"
-msgstr ""
-
-#: ../scripts/apatch.in:126
+#: ../scripts/apatch.in:116
msgid "Applied $patch (forced; needs refresh)"
msgstr ""
-#: ../scripts/apatch.in:130
+#: ../scripts/apatch.in:120
msgid "Patch $patch does not apply (enforce with -f)"
msgstr ""
-#: ../scripts/apatch.in:186 ../scripts/rpatch.in:257
+#: ../scripts/apatch.in:177 ../scripts/rpatch.in:217
msgid "The topmost patch $top needs to be refreshed first."
msgstr ""
-#: ../scripts/rpatch.in:21
+#: ../scripts/rpatch.in:22
msgid "Usage: $0 [-fRq] patchname"
msgstr ""
-#: ../scripts/rpatch.in:43
-msgid "Patch does not remove changes:"
-msgstr ""
-
-#: ../scripts/rpatch.in:117
-msgid "Interrupted by user; patch $patch was not removed."
+#: ../scripts/rpatch.in:110
+msgid "Patch $patch does not remove cleanly (enforce with -f)."
msgstr ""
-#: ../scripts/rpatch.in:153
+#: ../scripts/rpatch.in:127
msgid "Patch $patch appears to be empty, removed"
msgstr ""
-#: ../scripts/rpatch.in:158
+#: ../scripts/rpatch.in:160
msgid "Removing $patch"
msgstr ""
-#: ../scripts/rpatch.in:183
-msgid "Failed to create temporary files"
-msgstr ""
-
-#: ../scripts/rpatch.in:204
-msgid "Patch $patch does not remove (enforce with -f)"
-msgstr ""
-
#: ../scripts/spec2series.in:100 ../scripts/spec2series.in:192
msgid " done"
msgstr ""
diff --git a/quilt.changes b/quilt.changes
index 650bca2..a05e606 100644
--- a/quilt.changes
+++ b/quilt.changes
@@ -1,4 +1,42 @@
-------------------------------------------------------------------
+Fri Oct 31 16:59:06 CET 2003 - agruen@suse.de
+
+- Bump version number to 0.28 (cvs tag VER_0_28).
+
+-------------------------------------------------------------------
+Fri Oct 31 15:55:29 CET 2003 - agruen@suse.de
+
+- No longer verify if patches remove cleanly by reverse applying
+ them: This doesn't always succeed, and the the equivalent of
+ `quilt diff -z' should suffice, anyway.
+- Add `touch .pc/$patch' after successful refresh: Speeds up
+ `quilt pop' after a refresh.
+- Update test suite.
+- apatch was printing a spurious newline.
+
+-------------------------------------------------------------------
+Wed Oct 29 17:19:24 CET 2003 - agruen@suse.de
+
+- If a patch does not apply cleanly and `quilt push' removes
+ rejects files it GNU patch left behind, change the output from
+ ``saving rejects to file x.rej'' to ``rejects in file x''.
+
+-------------------------------------------------------------------
+Tue Oct 28 14:51:07 CET 2003 - agruen@suse.de
+
+- Remove .pc/*/.pc files, and adjust various scripts accordingly.
+- Run test/one.test inside sub-directory.
+- Bump version number to 0.27 (cvs tag VER_0_27).
+
+-------------------------------------------------------------------
+Tue Oct 28 14:32:13 CET 2003 - agruen@suse.de
+
+- Change name and semantics of PATCHSCRIPTS variable: Before, if
+ PATCHSCRIPTS was set, the patches were in $PATCHSCRIPTS/patches.
+ Now, if QUILT_PATCHES is set, the patches are in $QUILT_PATCHES.
+ QUILT_PATCHES defaults to "patches", like before.
+
+-------------------------------------------------------------------
Sun Oct 26 17:53:53 CET 2003 - agruen@suse.de
- Get rid of patches_per cache_in `quilt patches'. Remove
diff --git a/quilt.spec.in b/quilt.spec.in
index e5ba22e..027c19f 100644
--- a/quilt.spec.in
+++ b/quilt.spec.in
@@ -8,7 +8,7 @@ License: GPL
Group: Productivity/Text/Utilities
Version: 0
Release: 0
-Requires: coreutils diffutils patch gzip bzip2 perl mktemp gettext
+Requires: fileutils diffutils patch gzip bzip2 perl mktemp gettext
Autoreqprov: off
Source: quilt-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
diff --git a/quilt/add.in b/quilt/add.in
index b6074f7..a2640d2 100644
--- a/quilt/add.in
+++ b/quilt/add.in
@@ -98,8 +98,7 @@ do
continue
fi
- if ! @LIB@/backup-files -s -B .pc/$patch/ $file || \
- ! echo $file >> $(pc_file_name $patch)
+ if ! @LIB@/backup-files -s -B .pc/$patch/ $file
then
echo $"Failed to back up file $file" >&2
status=1
diff --git a/quilt/diff.in b/quilt/diff.in
index 2603f0b..6cb5c8a 100644
--- a/quilt/diff.in
+++ b/quilt/diff.in
@@ -70,6 +70,8 @@ do_diff()
if [ -n "$opt_diff" ]
then
+ [ -s "$old_file" ] || old_file=/dev/null
+ [ -s "$new_file" ] || new_file=/dev/null
if ! @DIFF@ -qN $old_file $new_file >/dev/null
then
$opt_diff $old_file $new_file
@@ -223,7 +225,6 @@ files=( $(sort -u $tmp_files) )
if [ -n "$opt_relative" ]
then
patch_file=$(patch_file_name $last_patch)
- pc_file=$(pc_file_name $last_patch)
patch_args=$(patch_args $last_patch)
workdir=$(gen_tempfile -d $PWD/quilt)
pwd=$PWD
@@ -238,6 +239,12 @@ then
echo $"Failed to copy files to temporary directory"
die 1
fi
+ # Now we may have some zero-size files that have no permissions
+ # (which represent files that the patch creates). Those may have
+ # been created in the meantime, but patch would refuse to touch
+ # them: We must remove them here.
+ find $workdir -type f -size 0 -exec rm -f '{}' ';'
+
if ! cd $workdir
then
echo $"Cannot change to temporary directory"
@@ -255,7 +262,7 @@ then
# files won't succeed, either. So, ignore the error
# in that particular case.
- if ! [ -e $pwd/$pc_file~refresh ]
+ if ! [ -e $pwd/.pc/$last_patch~refresh ]
then
echo $"Failed to patch temporary files"
die 1
diff --git a/quilt/fork.in b/quilt/fork.in
index 822036c..f2bee86 100644
--- a/quilt/fork.in
+++ b/quilt/fork.in
@@ -19,11 +19,14 @@ fi
usage()
{
- echo $"Usage: quilt fork {new_patchname}"
+ echo $"Usage: quilt fork [new_name]"
if [ x$1 = x-h ]
then
echo $"
- Fork the next patch in the series
+Fork the next patch. If new_name is missing, the name of the
+forked patch will be the current patch name, followed by \"-2\".
+If the patch name already ends in a dash-and-number, the number is
+further incremented (e.g., patch.diff, patch-2.diff).
"
exit 0
else
@@ -51,47 +54,55 @@ do
esac
done
-if [ $# -ne 1 ]
+if [ $# -gt 1 ]
then
usage
fi
-patch_file=$(echo $1 | @SED@ -e 's/^'"$(quote_bre $P)"'patches\///')
-patch=$(stripit $patch_file)
-
-if patch_in_series $patch
+next="$(patches_after $(top_patch) | head -n 1)"
+if [ -z "$next" ]
then
- echo $"Patch $patch exists already, please change a new_name"
+ echo $"All patches applied" >&2
exit 1
fi
+next_file_name="$(patch_file_name $next)"
-mkdir -p $(dirname $(pc_file_name $patch))
-rm -f $(pc_file_name $patch)
-
-next_patch=$(patches_after $(top_patch) | head -n 1)
-#copy the original patch to the cloned patch
-
-next_patch_file=$(patch_file_name $next_patch)
-next_pc=$(pc_file_name $next_patch)
+if [ $# -eq 1 ]
+then
+ patch_file="$1"
+else
+ set -- $(echo "$next" \
+ | @SED@ -e 's: :\ :g' -e 's:-\([0-9]\+\)$: \1:')
+ if [ $# -eq 1 ]; then
+ patch_file="$1-2"
+ else
+ patch_file="$1-$[$2+1]"
+ fi
+ ext="$(echo $next_file_name \
+ | @SED@ -e '\:\.\(diff\?\|patch\)\(\.gz\|\.bz2\|\)$:!d' \
+ -e 's:.*\(\.\(diff\?\|patch\)\(\.gz\|\.bz2\|\)\)$:\1:')"
+ patch_file="$patch_file$ext"
+fi
-cp -f ${next_patch_file} patches/${patch_file}.patch
+patch_file=$(echo $patch_file | @SED@ -e 's/^'"$(quote_bre $QUILT_PATCHES)"'\///')
+patch=$(stripit $patch_file)
-#remove the original patch
-if [ -z next_patch ]
+if patch_in_series $patch || \
+ [ -e "patches/$patch_file" ]
then
- echo $"patch ended at $(top_patch)"
+ echo $"Patch $patch exists already, please choose a new name"
exit 1
-else
- remove_from_series $next_patch
fi
-#add the cloned patch to series
-if ! insert_in_series ${patch_file}.patch
+if ! rename_in_series "$next" "$patch_file" || \
+ ! cp -p "$next_file_name" "$(patch_file_name $patch)"
then
- echo $"Failed to fork patch $patch"
+ echo $"Fork of $next_file_name to $patch_file failed" >&2
exit 1
fi
-echo $"cloned $next_patch to $patch_file"
+
+echo $"Fork of $next_file_name created as $(patch_file_name $patch)"
+
### Local Variables:
### mode: shell-script
### End:
diff --git a/quilt/import.in b/quilt/import.in
index 63b7470..9964dce 100644
--- a/quilt/import.in
+++ b/quilt/import.in
@@ -57,7 +57,7 @@ do
case "$1" in
-n)
opt_patch=$(echo "$2" |
- @SED@ -e 's/^'"$(quote_bre $P)"'patches\///' \
+ @SED@ -e 's/^'"$(quote_bre $QUILT_PATCHES)"'\///' \
-e 's/^\.pc\///')
shift 2 ;;
-p)
@@ -87,7 +87,7 @@ fi
if [ -n "$opt_patch" ]
then
patch=$(stripit "$opt_patch")
- patch_file="${P}patches/$opt_patch"
+ patch_file="$QUILT_PATCHES/$opt_patch"
else
patch="$(stripit "$input_file")"
if [ -n "$patch" ]
@@ -97,7 +97,7 @@ else
echo $"Please use -n to specify a patch file name."
exit 1
fi
- patch_file="${P}patches/$opt_patch"
+ patch_file="$QUILT_PATCHES/$opt_patch"
fi
if echo "$patch_file" | grep -q -e $'[ \t]'
diff --git a/quilt/new.in b/quilt/new.in
index bba2929..2266e19 100644
--- a/quilt/new.in
+++ b/quilt/new.in
@@ -59,7 +59,7 @@ then
usage
fi
-patch_file=$(echo $1 | @SED@ -e 's/^'"$(quote_bre $P)"'patches\///')
+patch_file=$(echo $1 | @SED@ -e 's/^'"$(quote_bre $QUILT_PATCHES)"'\///')
patch=$(stripit $patch_file)
if patch_in_series $patch
@@ -68,8 +68,8 @@ then
exit 1
fi
-mkdir -p $(dirname $(pc_file_name $patch))
-rm -f $(pc_file_name $patch)
+rm -rf ".pc/$patch"
+mkdir -p ".pc/$patch"
if ! insert_in_series $patch_file || \
! add_to_db $patch
diff --git a/quilt/refresh.in b/quilt/refresh.in
index 2d57e53..f0d9372 100644
--- a/quilt/refresh.in
+++ b/quilt/refresh.in
@@ -101,15 +101,14 @@ save_patches ()
local patch=$1
local saved_patch=$(save_patch_name $patch)
local patch_file=$(patch_file_name $patch)
- local saved_pc_file=$(pc_file_name $saved_patch)
-
+
#if we add a file to a new create patch, the patch_file are not exist
if ! [ -e "${patch_file}" ]; then
return
fi
- if [ -e $saved_pc_file ]; then
+ if [ -e "$saved_patch" ]; then
if [ $opt_Keep -eq 0 -a $opt_Overwrite -eq 0 ]; then
while :; do
readln "$patch save exist Overwrite/Keep:" "O"
@@ -270,7 +269,9 @@ then
die 1
fi
-rm -f $(pc_file_name $patch)~refresh
+touch .pc/$patch
+
+rm -f .pc/$patch~refresh
echo $"Refreshed patch $patch"
if ! change_db_strip_level -p$opt_strip_level $patch
then
diff --git a/quilt/remove.in b/quilt/remove.in
index d48300b..6e5511e 100644
--- a/quilt/remove.in
+++ b/quilt/remove.in
@@ -107,12 +107,6 @@ do
continue
fi
- pc_file=$(pc_file_name $patch)
- tmpfile=$(gen_tempfile)
- grep -v -E '^'"$(quote_re $file)"'$' $pc_file > $tmpfile
- mv -f $tmpfile $pc_file
- rm -f $tmpfile
-
echo $"File $file removed from patch $patch"
done
exit $status
diff --git a/quilt/snapshot.in b/quilt/snapshot.in
index 6883a59..453f265 100644
--- a/quilt/snapshot.in
+++ b/quilt/snapshot.in
@@ -63,11 +63,11 @@ then
usage
fi
-snap_dir=.pc/.snap
+snap_subdir=.snap
# Clean up from previous snapshot
-rm -rf $snap_dir
-mkdir -p $snap_dir
+rm -rf .pc/$snap_subdir
+mkdir -p .pc/$snap_subdir
if [ -n "$opt_remove" ]
then
@@ -79,19 +79,25 @@ for patch in $(applied_patches | tac)
do
for file in $(files_in_patch $patch)
do
- if ! [ -e "$snap_dir/$file" ]
+ if ! [ -e ".pc/$snap_subdir/$file" ]
then
- mkdir -p "$snap_dir/$(dirname $file)"
+ mkdir -p ".pc/$snap_subdir/$(dirname $file)"
if [ -e "$file" ]
then
- ln "$file" "$snap_dir/$file"
+ ln "$file" ".pc/$snap_subdir/$file"
else
- touch "$snap_dir/$file"
+ touch ".pc/$snap_subdir/$file"
fi
fi
done
done
+# Now we may have some zero-size files that have no permissions
+# (which represent files that the patch creates). Those may have
+# been created in the meantime, but patch would refuse to touch
+# them: We must remove them here.
+find .pc/$snap_subdir -type f -size 0 -exec rm -f '{}' ';'
+
### Local Variables:
### mode: shell-script
### End:
diff --git a/scripts/apatch.in b/scripts/apatch.in
index 973988a..d602c39 100755
--- a/scripts/apatch.in
+++ b/scripts/apatch.in
@@ -25,13 +25,16 @@ usage()
rollback_patch()
{
- local patch=$1 pc_file=$(pc_file_name $patch)
- @LIB@/backup-files $silent_unless_verbose \
- -f $pc_file -B .pc/$patch/ -r
+ local patch=$1 pc_file=$(gen_tempfile)
+
+ # FIXME backup_files should scan the directory hierarchy itself.
+ files_in_patch $patch > $pc_file
+ @LIB@/backup-files $silent_unless_verbose -f $pc_file -B .pc/$patch/ -r
if [ -z "$opt_leave_rejects" ]
then
- rm -f $(files_in_patch $patch | @SED@ -e 's/$/\.rej/')
+ @SED@ -e 's/$/\.rej/' $pc_file | xargs rm -f
fi
+ rm -f $pc_file
}
interrupt()
@@ -44,7 +47,7 @@ interrupt()
apply_patch()
{
local patch=$1
- local patch_file=$(patch_file_name $patch)
+ local patch_file=$(patch_file_name $patch) output
if ! [ -s $patch_file ]
then
@@ -54,56 +57,41 @@ apply_patch()
if [ "x${patch_file:(-3)}" = "x.gz" ]
then
+ output="$(
gzip -cd $patch_file \
- | @PATCH@ $(patch_args $patch) --no-backup-if-mismatch \
- -E $silent $force_apply
+ | @PATCH@ $(patch_args $patch) --backup --prefix=".pc/$patch/" \
+ -E $silent $force_apply 2>&1 )"
elif [ "x${patch_file:(-4)}" = "x.bz2" ]
then
+ output="$(
bzip2 -cd $patch_file \
- | @PATCH@ $(patch_args $patch) --no-backup-if-mismatch \
- -E $silent $force_apply
+ | @PATCH@ $(patch_args $patch) --backup --prefix=".pc/$patch/" \
+ -E $silent $force_apply 2>&1 )"
else
- @PATCH@ $(patch_args $patch) --no-backup-if-mismatch \
- -E $silent -i $patch_file $force_apply
+ output="$(
+ @PATCH@ $(patch_args $patch) --backup --prefix=".pc/$patch/" \
+ -E $silent -i $patch_file $force_apply 2>&1 )"
fi
+
+ status=${PIPESTATUS[0]}
+ if [ $status -ne 0 -a -z "$opt_leave_rejects" ]
+ then
+ # The reject files are removed in rollback_patch.
+ echo "$output" \
+ | sed -e 's/-- saving rejects to file \(.\+\)\.rej/-- rejects in file \1/'
+ elif [ -n "$output" ]
+ then
+ echo "$output"
+ fi
+ return $status
}
apatch()
{
local patch=$(stripit $1)
- local pc_file=$(pc_file_name $patch)
local file status
- trap "" SIGINT
- if ! refresh_file_list $patch
- then
- echo $"refresh_file_list failed"
- return 1
- fi
-
echo $"Applying $patch"
- if ! [ -e $pc_file ]
- then
- echo $"Patch $patch appears to be empty, applied"
- add_to_db $patch
- return 0
- fi
-
- status=$?
- if [ $status -eq 2 ]
- then
- [ -z "$opt_quiet" ] && echo $"Recreated file list for $patch"
- elif [ $status -ne 0 ]
- then
- return 1
- fi
-
- if ! @LIB@/backup-files $silent_unless_verbose \
- -f $pc_file -B .pc/$patch/
- then
- exit 1
- fi
-
trap "interrupt $patch" SIGINT
apply_patch $patch
@@ -111,18 +99,20 @@ apatch()
trap "" SIGINT
- # Remember date/time of applying so that pop can
- # avoid reverse applying the patch in the usual cases.
- touch $pc_file
-
if [ $status -eq 0 -o -n "$opt_force" ]
then
add_to_db $patch
if [ $status -eq 0 ]
then
- rm -f $pc_file~refresh
+ rm -f .pc/$patch~refresh
else
- touch $pc_file~refresh
+ touch .pc/$patch~refresh
+ fi
+ if [ "$(shopt -s nullglob ; echo .pc/$patch/*)" = "" ]
+ then
+ echo $"Patch $patch appears to be empty, applied"
+ elif [ $status -ne 0 ]
+ then
echo $"Applied $patch (forced; needs refresh)"
fi
else
@@ -177,11 +167,12 @@ fi
[ -n "$opt_quiet" ] && silent=-s
[ -z "$opt_verbose" ] && silent_unless_verbose=-s
[ -z "$opt_interactive" ] && force_apply=-f
+[ -n "$opt_force" ] && opt_leave_rejects=1
patch=$(stripit $1)
top=$(top_patch)
-if [ -n "$top" -a -e $(pc_file_name $top)~refresh ]
+if [ -n "$top" -a -e .pc/$top~refresh ]
then
echo $"The topmost patch $top needs to be refreshed first."
exit 1
diff --git a/scripts/patchfns.in b/scripts/patchfns.in
index 11c9c37..61c21e8 100644
--- a/scripts/patchfns.in
+++ b/scripts/patchfns.in
@@ -15,12 +15,7 @@ then
. $HOME/.quiltrc
fi
-if [ -n "$PATCHSCRIPTS" ]
-then
- P=$PATCHSCRIPTS/
-else
- unset P
-fi
+: ${QUILT_PATCHES:=patches}
if [ -e .pc/series ]
then
@@ -29,7 +24,7 @@ elif [ -e series ]
then
SERIES=series
else
- SERIES=${P}patches/series
+ SERIES=$QUILT_PATCHES/series
fi
DB=".pc/applied-patches"
@@ -70,7 +65,7 @@ patch_file_name()
if [ -e $SERIES ]
then
@AWK@ '/^'"$(quote_re $patch)"'(|\.patch|\.diff?)(|\.gz|\.bz2)([ \t]|$)/ \
- { printf "'"$P"'patches/%s\n", $1
+ { printf "'"$QUILT_PATCHES"'/%s\n", $1
exit
}
' $SERIES
@@ -245,18 +240,7 @@ save_patch_name()
echo "${patch}.quiltsave"
shift
done
-
-}
-pc_file_name()
-{
- while [ $# -gt 0 ]
- do
- echo ".pc/$1/.pc"
- shift
- done
-
}
-
backup_file_name()
{
local patch=$1
@@ -370,10 +354,14 @@ next_patch_for_file()
if [ -n "$patches_on_top" ]
then
- grep -l -E "^$(quote_re $file)\$" \
- $(pc_file_name $patches_on_top) \
- | head -n 1 \
- | @SED@ -e 's:^\.pc/::' -e 's:/\.pc$::'
+ for patch in $patches_on_top
+ do
+ if [ -f $(backup_file_name $patch $file) ]
+ then
+ echo $patch
+ break
+ fi
+ done
fi
}
@@ -401,7 +389,7 @@ stripit()
then
echo $1 |
@SED@ -e 's/^\(\.\/\)*//' \
- -e 's/^'"$(quote_bre $P)"'patches\///' \
+ -e 's/^'"$(quote_bre $QUILT_PATCHES)"'\///' \
-e 's/\.gz$//' -e 's/\.bz2$//' \
-e 's/\.patch$//' -e 's/\.diff\?$//'
fi
@@ -410,16 +398,19 @@ stripit()
file_in_patch()
{
local file=$1 patch=$2
- files_in_patch $patch \
- | grep -q -E "^$(quote_re $file)\$"
+ [ -f ".pc/$patch/$file" ]
}
files_in_patch()
{
- local pc_file=$(pc_file_name $1)
- if [ -e "$pc_file" ]
+ local patch="$1"
+ local path=".pc/$patch"
+ if [ -d "$path" ]
then
- cat $pc_file
+ for file in $(find "$path" -type f)
+ do
+ echo "${file:${#path}+1}"
+ done
fi
}
@@ -437,48 +428,6 @@ touched_by_patch()
print
}'
}
-
-refresh_file_list()
-{
- local patch=$1
- local pc_file=$(pc_file_name $patch)
- local patch_file=$(patch_file_name $patch)
-
- if ! [ -e "$patch_file" ]
- then
- return 0
- fi
- if [ ! -e $pc_file -o \
- $pc_file -ot $patch_file -o \
- $pc_file -ot $SERIES ]
- then
- local tmpfile status
- if ! mkdir -p $(dirname $pc_file) || \
- ! tmpfile=$(gen_tempfile)
- then
- return 1
- fi
-
- # Do not reorder files in the file list...
-
- if [ -e $pc_file ]
- then
- cat $pc_file >> $tmpfile
- fi
- if ! touched_by_patch $(patch_strip_level $patch) \
- $patch >> $tmpfile
- then
- return 1
- fi
- @AWK@ ' { if (seen[$0]) next
- seen[$0]=1
- print
- }' $tmpfile > $pc_file
- rm $tmpfile
- return 0
- fi
-}
-
fix_diff_header()
{
local from=$1 to=$2
@@ -491,10 +440,10 @@ diff_file()
local file=$1 old_file=$2 new_file=$3
local old_hdr new_hdr line
- if [ ! -e "$old_file" -a ! -e "$new_file" ]
- then
- return 0
- fi
+ [ -s "$old_file" ] || old_file=/dev/null
+ [ -s "$new_file" ] || new_file=/dev/null
+
+ : ${opt_strip_level:=1}
if [ $opt_strip_level -eq 0 ]
then
old_hdr=$file.orig
diff --git a/scripts/rpatch.in b/scripts/rpatch.in
index 0dd7a72..cccd741 100755
--- a/scripts/rpatch.in
+++ b/scripts/rpatch.in
@@ -6,6 +6,7 @@
#
# 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 ]
@@ -22,71 +23,18 @@ usage()
exit 1
}
-verify_removal()
-{
- local patch=$1
- local bup file status=0
- local dir=$(basename $PWD) suffix=${patch//\//_}
-
- # Check if all changes of the patch are undone
- for file in $(files_in_patch $patch)
- do
- bup=$(backup_file_name $patch $file)
- if ! [ -s $file -o -s $bup ] || \
- cmp $file $bup > /dev/null 2> /dev/null
- then
- continue
- fi
-
- if [ $status -eq 0 ]
- then
- echo $"Patch does not remove changes:"
- fi
-
- @DIFF@ -Nu $QUILT_DIFF_OPTS $bup $file \
- | @SED@ -e 's:^--- [^ '$'\t'']*:--- '"$dir/$file.orig"':' \
- -e 's:^+++ [^ '$'\t'']*:+++ '"$dir/$file"':'
-
- status=1
- done
- return $status
-}
-
files_may_have_changed()
{
local patch=$1 file
local patch_file=$(patch_file_name $patch)
- local pc_file=$(pc_file_name $patch)
-
- if ! [ -e $pc_file ]
- then
- return 1
- fi
-
- if [ -z $patch_file ]
- then
- echo "Waring: Can not find the $patch in your series file, the series file may changed"
- return 0 #can not find the patch in series
- fi
- local apply_ts=$(date -r $pc_file '+%s') ts
- for file in $(files_in_patch $patch)
- do
- if ! [ -e .pc/$patch/$file ]
- then
- echo "Warning: the backup files .pc/$patch/$file do not exist"
- echo "Check your backup files in .pc/$patch"
- echo "If pop did not success, please touch a empty .pc/$patch/$file and try again"
- touch .pc/$patch/$file
- return 1 # backup files is missing, we can not remove it with force
- fi
- done
+ local apply_ts=$(date -r ".pc/$patch" '+%s') ts
- if [ -e "$patch_file" -a $pc_file -ot "$patch_file" ]
+
+ if [ -e "$patch_file" -a ".pc/$patch" -ot "$patch_file" ]
then
return 0
fi
-
for file in $(files_in_patch $patch)
do
if ! [ -e $file ]
@@ -99,113 +47,125 @@ files_may_have_changed()
return 0 # file has changed
fi
done
- return 1
-}
-
-rollback_patch()
-{
- local patch=$1 pc_file=$(pc_file_name $patch)
- @LIB@/backup-files $silent_unless_verbose \
- -f $pc_file -z ~rpatch -r
- rm -f $(files_in_patch $patch | @SED@ -e 's/$/\.rej/')
-}
-
-interrupt()
-{
- local patch=$1
- rollback_patch $patch
- echo $"Interrupted by user; patch $patch was not removed."
- exit 1
+return 1
}
-reverse_patch()
+# Check if all changes have been folded back into the patch (quilt refresh),
+# and report any pending changes.
+check_for_pending_changes()
{
- local patch=$1
+ local patch=$1 pc_file=$2
local patch_file=$(patch_file_name $patch)
+ local patch_args=$(patch_args $patch)
+ local workdir=$(gen_tempfile -d quilt) status=0
- if ! [ -s $patch_file ]
+ if [ -d .pc/$patch ]
then
- echo $"Patch file $patch_file appears to be empty"
- return 0
+ if ! rmdir $workdir || # note that this is racey...
+ ! cp -rl .pc/$patch $workdir/
+ then
+ echo $"Failed to copy files to temporary directory"
+ rm -rf $workdir
+ return 1
+ fi
+
+ # Now we may have some zero-size files that have no
+ # permissions (which represent files that the patch
+ # creates). Those may have been created in the meantime,
+ # but patch would refuse to touch them: We must remove
+ # them here.
+ find $workdir -type f -size 0 -exec rm -f '{}' ';'
+
fi
- if [ "x${patch_file:(-3)}" = "x.gz" ]
+ if [ -s $patch_file ]
then
- gzip -cd $patch_file \
- | @PATCH@ $(patch_args $patch) --no-backup-if-mismatch \
- -R -E $silent
- elif [ "x${patch_file:(-4)}" = "x.bz2" ]
+ if ! cat_file $patch_file \
+ | @PATCH@ -d $workdir $patch_args \
+ --no-backup-if-mismatch -E \
+ >/dev/null 2>/dev/null
+ then
+ # If a patch was force applied (and therefore needs
+ # refreshing), we know that patching the temporary
+ # files won't succeed, either. So, ignore the error
+ # in that particular case.
+
+ if ! [ -e .pc/$patch ]
+ then
+ echo $"Failed to patch temporary files"
+ rm -rf $workdir
+ return 1
+ fi
+ fi
+ fi
+
+ local remains=$(gen_tempfile)
+ while read file
+ do
+ diff_file $file $workdir/$file $file >> $remains
+ done < $pc_file
+
+ if [ -s $remains ]
then
- bzip2 -cd $patch_file \
- | @PATCH@ $(patch_args $patch) --no-backup-if-mismatch \
- -R -E $silent
- else
- @PATCH@ $(patch_args $patch) --no-backup-if-mismatch \
- -R -E $silent -i $patch_file
+ echo $"Patch $patch does not remove cleanly (enforce with -f)."
+ status=1
fi
+ rm -f $remains
+ rm -rf $workdir
+
+ return $status
}
rpatch()
{
- local patch=$1 pc_file=$(pc_file_name $patch)
- if ! [ -e $pc_file ]
+ local patch=$1 pc_file=$(gen_tempfile) status=0
+
+ # FIXME backup-files should scan the directory tree itself.
+ files_in_patch $patch > $pc_file
+ if ! [ -s $pc_file ]
then
echo $"Patch $patch appears to be empty, removed"
remove_from_db $patch
return 0
fi
- echo $"Removing $patch"
trap "" SIGINT
-
- files_may_have_changed $patch
- patch_may_changed=$?
-
- if [ "$opt_force" -eq 1 ] || \
- ( [ "$opt_remove" -eq 0 ] && [ $patch_may_changed -eq 0 ] )
+ if [ -z "$opt_force" ]
then
- # Optimize: Force remove if the patch has not been
- # modified since it was applied. (Forced remove is
- # faster!)
+ for file in $(touched_by_patch $(patch_strip_level $patch) $patch)
+ do
+ if ! [ -e ".pc/$patch/$file" ]
+ then
+ echo "$file touched by $patch_file"
+ echo "but no backup files for $file"
+ echo "Please Make sure your $patch_file is right"
+ echo "otherwise, quilt push $patch will be failed"
+ echo "Please quilt pop with -f option"
+ echo "Suggestion: If you have done make distclean"
+ echo "in kernel src, it will delete 0 size file"
+ echo "Maybe you should delete those new created files"
+ return 0
+ fi
+ done
+ fi
+ if [ -z "$opt_force" ] && \
+ ( [ -n "$opt_remove" ] || files_may_have_changed $patch )
+ then
+ check_for_pending_changes $patch $pc_file || status=1
+ fi
+
+ if [ $status -eq 0 ]
+ then
+ echo $"Removing $patch"
@LIB@/backup-files $silent -f $pc_file -B .pc/$patch/ -r
status=$?
remove_from_db $patch
- rm -f $pc_file~refresh
- if [ $status != 0 ]
- then
- exit $status
- fi
- else
- if ! @LIB@/backup-files $silent_unless_verbose \
- -f $pc_file -z ~rpatch
- then
- echo $"Failed to create temporary files" >&2
- return 1
- fi
-
- trap "interrupt $patch" SIGINT
-
- reverse_patch $patch
- status=$?
-
- trap "" SIGINT
-
- if [ $status -eq 0 ] && verify_removal $patch
- then
- @LIB@/backup-files $silent_unless_verbose \
- -f $pc_file -z ~rpatch -x
- @LIB@/backup-files $silent_unless_verbose \
- -f $pc_file -B .pc/$patch/ -x
-
- remove_from_db $patch
- else
- rollback_patch $patch
- echo $"Patch $patch does not remove (enforce with -f)"
- return 1
- fi
+ rm -f .pc/$patch~refresh
fi
+ rm -f $pc_file
trap - SIGINT
+ return $status
}
options=`getopt -o fRqvh -- "$@"`
@@ -214,8 +174,8 @@ if [ $? -ne 0 ]
then
usage
fi
-opt_force=0
-opt_remove=0
+#opt_force=0
+#opt_remove=0
eval set -- "$options"
while true
@@ -252,7 +212,7 @@ patch=$(stripit $1)
[ -z "$opt_verbose" ] && silent_unless_verbose=-s
top=$(top_patch)
-if [ -n "$top" -a -e $(pc_file_name $top)~refresh -a -z "$opt_force" ]
+if [ -n "$top" -a -e .pc/$top~refresh -a -z "$opt_force" ]
then
echo $"The topmost patch $top needs to be refreshed first."
exit 1
diff --git a/test/conflicts.test b/test/conflicts.test
new file mode 100644
index 0000000..b8c6d11
--- /dev/null
+++ b/test/conflicts.test
@@ -0,0 +1,139 @@
+This test case creates a patch and then applies that patch to a modified
+source file. The source file is modified until the patch doesn't apply
+anymore, then the patch is fixed.
+
+ $ mkdir d
+ $ cd d
+
+ $ cat > one.txt
+ < 1
+ < 2
+ < 3
+ < 4
+ < 5
+ < 6
+ < 7
+ < --
+ < a
+ < b
+ < c
+ < d
+ < e
+ < f
+ < g
+
+ $ quilt new a.diff
+ > Patch a is now on top
+
+ $ quilt add one.txt
+ > File one.txt added to patch a
+
+ $ mv one.txt one.orig
+ $ sed -e "s/4/4+/" -e 's/d/d+/' one.orig > one.txt
+ $ quilt refresh
+ > Refreshed patch a
+
+ $ quilt pop -q
+ > Removing a
+ > No patches applied
+
+
+ $ sed -e "s/^\\([17]\\)\$/\\1-/" one.orig > one.txt
+ $ quilt push -q
+ > Applying a
+ > Now at patch a
+
+ $ quilt pop -q
+ > Removing a
+ > No patches applied
+
+ $ sed -e "s/^\\([1267]\\)\$/\\1-/" one.orig > one.txt
+ $ quilt push -q
+ > Applying a
+ > Now at patch a
+
+ $ quilt pop -q
+ > Removing a
+ > No patches applied
+
+
+ $ sed -e "s/^\\([123567]\\)\$/\\1-/" one.orig > one.txt
+ $ quilt push -q
+ > Applying a
+ > 1 out of 2 hunks FAILED -- rejects in file one.txt
+ > Patch a does not apply (enforce with -f)
+
+ $ quilt push -qf
+ > Applying a
+ > 1 out of 2 hunks FAILED -- saving rejects to file one.txt.rej
+ > Applied a (forced; needs refresh)
+
+ $ mv one.txt one.x
+ $ sed -e "s/4/4+/" one.x > one.txt
+ $ rm one.x
+ $ quilt diff -z | grep -v "^\\(---\\|+++\\)"
+ > Index: d/one.txt
+ > ===================================================================
+ > @@ -1,7 +1,7 @@
+ > 1-
+ > 2-
+ > 3-
+ > -4
+ > +4+
+ > 5-
+ > 6-
+ > 7-
+
+ $ quilt diff | grep -v "^\\(---\\|+++\\)"
+ > Index: d/one.txt
+ > ===================================================================
+ > @@ -1,7 +1,7 @@
+ > 1-
+ > 2-
+ > 3-
+ > -4
+ > +4+
+ > 5-
+ > 6-
+ > 7-
+ > @@ -9,7 +9,7 @@
+ > a
+ > b
+ > c
+ > -d
+ > +d+
+ > e
+ > f
+ > g
+
+ $ quilt refresh
+ > Refreshed patch a
+
+ $ cat patches/a.diff | grep -v "^\\(---\\|+++\\)"
+ > Index: d/one.txt
+ > ===================================================================
+ > @@ -1,7 +1,7 @@
+ > 1-
+ > 2-
+ > 3-
+ > -4
+ > +4+
+ > 5-
+ > 6-
+ > 7-
+ > @@ -9,7 +9,7 @@
+ > a
+ > b
+ > c
+ > -d
+ > +d+
+ > e
+ > f
+ > g
+
+ $ quilt pop -q
+ > Removing a
+ > No patches applied
+
+ $ cd ..
+ $ rm -rf d
diff --git a/test/merge.test b/test/merge.test
new file mode 100644
index 0000000..af85b4a
--- /dev/null
+++ b/test/merge.test
@@ -0,0 +1,87 @@
+Test the patch merging functionality of `quilt diff'.
+
+ $ mkdir d
+ $ cd d
+
+ $ cat > abc.txt
+ < a
+ < b
+ < c
+
+ $ mkdir patches
+ $ cat > patches/series
+ < a.diff
+ < b.diff
+ < c.diff
+
+ $ cat > patches/a.diff
+ < --- merge.orig/abc.txt
+ < +++ merge/abc.txt
+ < @@ -1 +1 @@
+ < -a
+ < +a+
+
+ $ cat > patches/b.diff
+ < --- merge.orig/abc.txt
+ < +++ merge/abc.txt
+ < @@ -2 +2 @@
+ < -b
+ < +b+
+
+ $ cat > patches/c.diff
+ < --- merge.orig/abc.txt
+ < +++ merge/abc.txt
+ < @@ -3 +3 @@
+ < -c
+ < +c+
+
+ $ quilt push -qa
+ > Applying a
+ > Applying b
+ > Applying c
+ > Now at patch c
+
+ $ quilt diff -P b.diff | grep -v "^\\(---\\|+++\\)"
+ > Index: d/abc.txt
+ > ===================================================================
+ > @@ -1,3 +1,3 @@
+ > a+
+ > -b
+ > +b+
+ > c
+ > More recent patches modify files in b.
+
+ $ quilt diff -c a.diff -P b.diff | grep -v "^\\(---\\|+++\\)"
+ > Index: d/abc.txt
+ > ===================================================================
+ > @@ -1,3 +1,3 @@
+ > -a
+ > -b
+ > +a+
+ > +b+
+ > c
+ > More recent patches modify files in b.
+
+ $ quilt diff -c b.diff | grep -v "^\\(---\\|+++\\)"
+ > Index: d/abc.txt
+ > ===================================================================
+ > @@ -1,3 +1,3 @@
+ > a+
+ > -b
+ > -c
+ > +b+
+ > +c+
+
+ $ quilt diff -c - | grep -v "^\\(---\\|+++\\)"
+ > Index: d/abc.txt
+ > ===================================================================
+ > @@ -1,3 +1,3 @@
+ > -a
+ > -b
+ > -c
+ > +a+
+ > +b+
+ > +c+
+
+ $ cd ..
+ $ rm -rf d
diff --git a/test/one.test b/test/one.test
index 40329a9..d1298c5 100644
--- a/test/one.test
+++ b/test/one.test
@@ -5,6 +5,8 @@ of the installed quilt with `make check'.
(To run, type `./run one.test' in this directory.)
+ $ mkdir d
+ $ cd d
$ mkdir dir
$ echo "This is file one." > dir/file1
$ quilt new patch1.diff
@@ -27,18 +29,18 @@ of the installed quilt with `make check'.
$ echo "This is file two." > file2
$ quilt diff | sed -e "s/\\t.*//"
- > Index: test/file2
+ > Index: d/file2
> ===================================================================
- > --- test.orig/file2
- > +++ test/file2
+ > --- d.orig/file2
+ > +++ d/file2
> @@ -0,0 +1 @@
> +This is file two.
$ quilt diff -z | sed -e "s/\\t.*//"
- > Index: test/file2
+ > Index: d/file2
> ===================================================================
- > --- test.orig/file2
- > +++ test/file2
+ > --- d.orig/file2
+ > +++ d/file2
> @@ -0,0 +1 @@
> +This is file two.
@@ -48,10 +50,10 @@ of the installed quilt with `make check'.
$ quilt diff -z
$ echo "Another line has been added." >> dir/file1
$ quilt diff -z | sed -e "s/\\t.*//"
- > Index: test/dir/file1
+ > Index: d/dir/file1
> ===================================================================
- > --- test.orig/dir/file1
- > +++ test/dir/file1
+ > --- d.orig/dir/file1
+ > +++ d/dir/file1
> @@ -1 +1,2 @@
> This is file one.
> +Another line has been added.
@@ -74,7 +76,7 @@ of the installed quilt with `make check'.
$ quilt pop -R
> Removing patch2
- > patching file dir/file3
+ > Removing dir/file3
>
> Now at patch patch1
@@ -99,10 +101,10 @@ of the installed quilt with `make check'.
$ rm file4
$ quilt diff | sed -e "s/\\t.*//"
- > Index: test/file4
+ > Index: d/file4
> ===================================================================
- > --- test.orig/file4
- > +++ test/file4
+ > --- d.orig/file4
+ > +++ d/file4
> @@ -1 +0,0 @@
> -This is file 4.
@@ -118,10 +120,10 @@ of the installed quilt with `make check'.
$ echo "Another line added." >> file2
$ quilt diff -z -P patch1 | sed -e "s/\\t.*//"
- > Index: test/file2
+ > Index: d/file2
> ===================================================================
- > --- test.orig/file2
- > +++ test/file2
+ > --- d.orig/file2
+ > +++ d/file2
> @@ -1 +1,2 @@
> This is file two.
> +Another line added.
@@ -136,7 +138,7 @@ of the installed quilt with `make check'.
$ echo "Another line here, too." >> dir/file3
$ quilt pop -R
> Removing subdir/patch3
- > patching file file4
+ > Restoring file4
>
> Now at patch patch2
@@ -148,4 +150,5 @@ of the installed quilt with `make check'.
> Removing patch1
> No patches applied
- $ rm -r dir patches
+ $ cd ..
+ $ rm -rf d