aboutsummaryrefslogtreecommitdiff
path: root/gbp/scripts/import_dsc.py
diff options
context:
space:
mode:
authorGuido G√ľnther <agx@sigxcpu.org>2015-11-19 09:22:11 +0100
committerGuido G√ľnther <agx@sigxcpu.org>2015-11-19 09:26:33 +0100
commit8583e0364cf785f9d036b25a778c6c20690c44a8 (patch)
tree45de2b14ee39d2ce0864538d3a8f692acdb236f5 /gbp/scripts/import_dsc.py
parentcbd40e5f49a43b6b5e525be8048c0407dbb783cb (diff)
import-dsc: Bail out if target dir exists
If import-dsc is not run from within a Git repository it tries to create one named like the souce package. If that directory already exists we get confusing message like: gbp:info: No git repository found, creating one. gbp:warning: Version 0.7.0 already imported. gbp:info: Everything imported under /foo/git-buildpackage Avoid this by checking if the directory exists and aborting in this case. Closes: #766350
Diffstat (limited to 'gbp/scripts/import_dsc.py')
-rw-r--r--gbp/scripts/import_dsc.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py
index 6c9530c..bc93bb8 100644
--- a/gbp/scripts/import_dsc.py
+++ b/gbp/scripts/import_dsc.py
@@ -316,13 +316,16 @@ def main(argv):
if not clean and not is_empty:
gbp.log.err("Repository has uncommitted changes, commit these first: ")
raise GbpError(out)
-
except GitRepositoryError:
# no repo found, create one
needs_repo = True
is_empty = True
if needs_repo:
+ if os.path.exists(src.pkg):
+ raise GbpError("Directory '%s' already exists. If you want to import into it, "
+ "please change into this directory otherwise move it away first."
+ % src.pkg)
gbp.log.info("No git repository found, creating one.")
repo = DebianGitRepository.create(src.pkg)
os.chdir(repo.path)