chiark / gitweb /
check for applied patches/uncommitted changes before tg-rmdir
authormartin f. krafft <madduck@debian.org>
Fri, 6 Nov 2009 09:32:53 +0000 (10:32 +0100)
committermartin f. krafft <madduck@debian.org>
Fri, 6 Nov 2009 10:14:38 +0000 (11:14 +0100)
Signed-off-by: martin f. krafft <madduck@debian.org>
debian/tg2quilt.mk

index 70ad40288e163f7ff71ddbe9db02e9e4ca4de4a2..1a8893acfc1c42e6cb23f4818d61224d4e87c33c 100644 (file)
@@ -31,7 +31,9 @@
 #                  target, and invokes tg-rmdir
 #
 #        tg-rmdir: tries to remove debian/patches, but only if there are no
 #                  target, and invokes tg-rmdir
 #
 #        tg-rmdir: tries to remove debian/patches, but only if there are no
-#                  non-TopGit files under the directory.
+#                  non-TopGit files under the directory, the repository has
+#                  no uncommitted changes, and there are not quilt patches
+#                  applied.
 #                    The heuristic is to find files that do not contain a line
 #                  matchines /^tg:/, minus the series file. If any such files
 #                  are found, an error occurs. Otherwise, the directory is
 #                    The heuristic is to find files that do not contain a line
 #                  matchines /^tg:/, minus the series file. If any such files
 #                  are found, an error occurs. Otherwise, the directory is
@@ -120,6 +122,17 @@ else
   tg-rmdir: __TG_FILES := $(shell find $(QUILT_PATCH_DIR) -type f -a -not -path \*/series \
                                     | xargs grep -l '^tg:')
   tg-rmdir:
   tg-rmdir: __TG_FILES := $(shell find $(QUILT_PATCH_DIR) -type f -a -not -path \*/series \
                                     | xargs grep -l '^tg:')
   tg-rmdir:
+       QUILT_PATCHES=$(QUILT_PATCH_DIR) quilt pop -a
+       @if quilt applied >/dev/null 2>&1; then \
+         echo "E: there are applied quilt patches." >&2; \
+         echo "E: please unapply (pop) all patches and try again." >&2; \
+         false; \
+       fi
+       @if git status -am. >/dev/null; then \
+         echo "E: there are uncommitted changes in the working directory." >&2; \
+         echo "E: please commit or revert all changes." >&2; \
+         false; \
+       fi
        # remove all files whose contents matches /^tg:/
        rm -f $(__TG_FILES)
        # remove the series file
        # remove all files whose contents matches /^tg:/
        rm -f $(__TG_FILES)
        # remove the series file