From 54e454209a7573b4c321fc19a39f6991a6bd1ac0 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Mon, 19 May 2014 12:06:39 +0200 Subject: pq: Try harder to cleanup after a failed patch If we fail to apply the patch the tree is left in a dirty state so reset to the last head. This avoids irritating errors like: gbp:error: Failed to apply 'debian/patches/poison+remember_trash': Failed to commit tree: fatal: invalid date format: 1998/03/21 following files would be overwritten by checkout: doc/hosts.nntp.5 innd/art.c innd/innd.h innd/rc.c Please, commit your changes or stash them before you can switch branches. Aborting Thanks: Marco d'Itri for the repo to debug this --- gbp/scripts/pq.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py index 05e5660c..ea33c26c 100755 --- a/gbp/scripts/pq.py +++ b/gbp/scripts/pq.py @@ -176,6 +176,7 @@ def import_quilt_patches(repo, branch, series, tries, force): apply_and_commit_patch(repo, patch, maintainer, patch.topic) except (GbpError, GitRepositoryError) as e: gbp.log.err("Failed to apply '%s': %s" % (patch.path, e)) + repo.force_head('HEAD', hard=True) repo.set_branch(branch) repo.delete_branch(pq_branch) break -- cgit v1.2.3