Source: git-buildpackage
Version: 0.8.7
Severity: wishlist
Tags: patch

Hi,

It would be nice to be able to specify the target directory to
import to when creating a new repo. I would find this useful as
I use "pkg-packagename" instead of just "packagename".

Patch attached.


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [email protected] / chris-lamb.co.uk
       `-
diff --git a/gbp/scripts/import_dsc.py b/gbp/scripts/import_dsc.py
index aa734e8..0f31d31 100644
--- a/gbp/scripts/import_dsc.py
+++ b/gbp/scripts/import_dsc.py
@@ -269,6 +269,8 @@ def build_parser(name):
                                                 dest="author_committer_date")
     
import_group.add_boolean_config_file_option(option_name="allow-unauthenticated",
                                                 dest="allow_unauthenticated")
+    import_group.add_option("--target", dest="target",
+                            help="Specify target directory")
     return parser
 
 
@@ -324,13 +326,14 @@ def main(argv):
             print_dsc(src)
 
         if needs_repo:
-            if os.path.exists(src.pkg):
+            target = options.target if options.target is not None else src.pkg
+            if os.path.exists(target):
                 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)
+                               % target)
             gbp.log.info("No git repository found, creating one.")
-            repo = DebianGitRepository.create(src.pkg)
-            os.chdir(repo.path)
+            repo = DebianGitRepository.create(target)
+            os.chdir(target)
 
         if repo.bare:
             disable_pristine_tar(options, "Bare repository")
@@ -429,7 +432,7 @@ def main(argv):
             gbpc.RemoveTree(dirs[d])()
 
     if not ret and not skipped:
-        gbp.log.info("Version '%s' imported under '%s'" % (src.version, 
src.pkg))
+        gbp.log.info("Version '%s' imported under '%s'" % (src.version, 
repo.path))
     return ret
 
 

Reply via email to