From: Guido Günther Date: Mon, 19 May 2014 10:06:39 +0000 (+0200) Subject: pq: Try harder to cleanup after a failed patch X-Git-Tag: debian/0.6.14~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=54e454209a7573b4c321fc19a39f6991a6bd1ac0;p=tools%2Fgit-buildpackage.git 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 --- 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