aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-07-31 13:25:47 +0200
committerGuido Günther <agx@sigxcpu.org>2016-07-31 13:30:58 +0200
commit3d261da774b79a4d8b280b9e10558ad6af3111b4 (patch)
tree208a7777e21e55da21199096e0e6932a41a043c7
parenta52aff5028dd3d786154d4dc3229f5735707a3d4 (diff)
import_orig: Only try rollbacks if necessary
If the list of possible rollbacks is empty don't print confusing messages to the user like: gbp:error: No archive to import specified. Try --help. gbp:error: Error detected, Will roll back changes. gbp:error: Rolled back changes after import error.
-rw-r--r--gbp/scripts/import_orig.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py
index aead3ebc..e344926d 100644
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -59,6 +59,9 @@ class ImportOrigDebianGitRepository(DebianGitRepository):
self.rollback_errors = []
DebianGitRepository.__init__(self, *args, **kwargs)
+ def has_rollbacks(self):
+ return len(self.rollbacks) > 0
+
def vcs_tag_parent(self, vcs_tag_format, version):
"""If linking to the upstream VCS get the commit id"""
if vcs_tag_format:
@@ -597,7 +600,7 @@ def main(argv):
if str(err):
gbp.log.err(err)
ret = 1
- if repo and options.rollback:
+ if repo and repo.has_rollbacks() and options.rollback:
gbp.log.err("Error detected, Will roll back changes.")
try:
repo.rollback()
@@ -608,7 +611,6 @@ def main(argv):
gbp.log.error("Clean up manually and please report a bug: %s" %
repo.rollback_errors)
-
if pristine_orig and linked and not options.symlink_orig:
os.unlink(pristine_orig)