Package: devscripts
File: /usr/bin/debcheckout
Control: tags -1 +patch

On Tue, May 26, 2009 at 07:10 +0200, martin f krafft wrote:
> It would be nice if I could chose to use git-svn instead of svn,
> ideally even through a setting in ~/.devscripts.

Patch 0002 adds that option to ~/.devscripts.

Patch 0001 is just to tidy up the whitespace, as it had mixed
tabs and spaces for indents.

I've not included the automatic .po file changes in the patch.


On Fri, Aug 03, 2012 at 04:28 +0000, shawn wrote:
> Could also use git-hg. (this is distributed in the git package,
> however it is in /usr/share/doc, so using it where it is might be a violation
> of policy 12.1).

That's been fixed :)
git-hg is now in /usr/bin, in the hg-fast-export package.
And /usr/bin/git-bzr is in the git-bzr-ng (not git-bzr) package.

Cheers,
Steve

Attachment: 0001-debcheckout-Indentation-cleanup.patch.bz2
Description: Binary data

>From cc7afbbafac25d22a77c2cdae39bf669c7da736a Mon Sep 17 00:00:00 2001
From: Steve Cotton <Steve Cotton st...@s.cotton.clara.co.uk>
Date: Wed, 15 Jan 2014 00:44:15 +0000
Subject: [PATCH 2/2] debcheckout: Use alternative VCS (git-svn, git-hg and
 git-bzr)

Closes: #530580
---
 conf.default.in        |  3 +++
 debian/changelog       |  4 ++++
 scripts/debcheckout.pl | 32 +++++++++++++++++++++++++++++---
 3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/conf.default.in b/conf.default.in
index 97a5a5d..671822f 100644
--- a/conf.default.in
+++ b/conf.default.in
@@ -208,6 +208,9 @@
 
 ##### debcheckout
 #
+# Use git-svn for svn repos, etc.  Space-separated strings.
+# DEBCHECKOUT_ALTERNATE_VCS=''
+#
 # List of space-separated pairs REGEXP/REPLACEMENT_TEXT to define
 # custom rules to enable authenticated mode.
 # DEBCHECKOUT_AUTH_URLS=''
diff --git a/debian/changelog b/debian/changelog
index 49efc95..16e9665 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,10 @@ devscripts (2.13.10) UNRELEASED; urgency=low
   [ James McCoy ]
   * chdist: Ensure error messages end with an EOL.  (Closes: #734307)
 
+  [ Steve Cotton ]
+  * debcheckout: Use alternative VCS (git-svn, git-hg and git-bzr)
+    + Adds config option DEBCHECKOUT_ALTERNATE_VCS
+
  -- Jakub Wilk <jw...@debian.org>  Fri, 27 Dec 2013 18:39:11 +0100
 
 devscripts (2.13.9) unstable; urgency=low
diff --git a/scripts/debcheckout.pl b/scripts/debcheckout.pl
index 87744d7..6bcd1ac 100755
--- a/scripts/debcheckout.pl
+++ b/scripts/debcheckout.pl
@@ -184,6 +184,12 @@ for this purpose. The currently recognised variables are:
 
 =over
 
+=item B<DEBCHECKOUT_ALTERNATE_VCS>
+
+Use a different VCS than the repository, for example git-svn for SVN repos.
+This variable should be a space-separated list, currently only 'git-svn',
+'git-hg' and 'git-bzr' are supported.
+
 =item B<DEBCHECKOUT_AUTH_URLS>
 
 This variable should be a space separated list of Perl regular
@@ -260,6 +266,7 @@ my $compression_re = compression_get_file_extension_regex();
 #      configuration file parsing code -->
 my @config_files = ('/etc/devscripts.conf', '~/.devscripts');
 my %config_vars = (
+    'DEBCHECKOUT_ALTERNATE_VCS' => '',
     'DEBCHECKOUT_AUTH_URLS' => '',
     'DEBCHECKOUT_SOURCE' => 'auto',
     'DEBCHECKOUT_USER' => '',
@@ -522,10 +529,17 @@ sub munge_url($$)
 sub checkout_repo($$$) {
     my ($repo_type, $repo_url, $destdir) = @_;
     my @cmd;
+    my @alt_vcs = split(/ /, $config_vars{'DEBCHECKOUT_ALTERNATE_VCS'});
 
     given ($repo_type) {
         when ("arch") { @cmd = ("tla", "grab", $repo_url); }  # XXX ???
-        when ("bzr") { @cmd = ("bzr", "branch", $repo_url); }
+        when ("bzr") {
+            if ("git-bzr" ~~ @alt_vcs) {
+                @cmd = ("git", "bzr", "clone", $repo_url);
+            } else {
+                @cmd = ("bzr", "branch", $repo_url);
+            }
+        }
         when ("cvs") {
             $repo_url =~ s|^-d\s*||;
             my ($root, $module) = split /\s+/, $repo_url;
@@ -540,8 +554,20 @@ sub checkout_repo($$$) {
                 @cmd = ("git", "clone", $repo_url);
             }
         }
-        when ("hg") { @cmd = ("hg", "clone", $repo_url); }
-        when ("svn") { @cmd = ("svn", "co", $repo_url); }
+        when ("hg") {
+            if ("git-hg" ~~ @alt_vcs) {
+                @cmd = ("git", "hg", "clone", $repo_url);
+            } else {
+                @cmd = ("hg", "clone", $repo_url);
+            }
+        }
+        when ("svn") {
+            if ("git-svn" ~~ @alt_vcs) {
+                @cmd = ("git", "svn", "clone", $repo_url);
+            } else {
+                @cmd = ("svn", "co", $repo_url);
+            }
+        }
         default { die "unsupported version control system '$repo_type'.\n"; }
     }
     @cmd = set_destdir($repo_type, $destdir, @cmd) if length $destdir;
-- 
1.8.5.2

Reply via email to