Author: zack
Date: 2008-10-29 22:41:14 +0000 (Wed, 29 Oct 2008)
New Revision: 1680
Modified:
trunk/debian/changelog
trunk/scripts/debcheckout.pl
Log:
debcheckout: try to guess repository type when given raw URLs
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-10-29 20:38:17 UTC (rev 1679)
+++ trunk/debian/changelog 2008-10-29 22:41:14 UTC (rev 1680)
@@ -20,6 +20,9 @@
[ Christoph Berg ]
* debian/control: Remove the Dm-Upload-Allowed flag.
+ [ Stefano Zacchiroli ]
+ * debcheckout: try to guess repository type when given raw URLs
+
-- Christoph Berg <[EMAIL PROTECTED]> Sat, 25 Oct 2008 18:29:57 +0200
devscripts (2.10.39) unstable; urgency=low
Modified: trunk/scripts/debcheckout.pl
===================================================================
--- trunk/scripts/debcheckout.pl 2008-10-29 20:38:17 UTC (rev 1679)
+++ trunk/scripts/debcheckout.pl 2008-10-29 22:41:14 UTC (rev 1680)
@@ -55,8 +55,11 @@
Alternatively, a particular version may be selected from those available by
specifying the package name as I<PACKAGE>=I<VERSION>.
-If you already know the URL of a given repository you can invoke debcheckout
-directly on it, but you will probably need to pass the appropriate B<-t> flag.
+If you already know the URL of a given repository you can invoke
+debcheckout directly on it, but you will probably need to pass the
+appropriate B<-t> flag. That is, some heuristics are in use to guess
+the repository type from the URL; if they fail, you might want to
+override the guessed type using B<-t>.
The currently supported version control systems are: arch, bzr, cvs, darcs,
git,
hg, svn.
@@ -590,6 +593,15 @@
exit(0);
}
+sub guess_repo_type($$) {
+ my ($repo_url, $default) = @_;
+ my $repo_type = $default;
+ if ($repo_url =~ /^(git|svn)(\+ssh)?:/) {
+ $repo_type = $1;
+ }
+ return $repo_type;
+}
+
# Does a given string match the lexical rules for package names?
sub is_package($) {
my ($arg) = @_;
@@ -625,6 +637,7 @@
$version ||= "";
if (not is_package($pkg)) { # repo-url passed on the command line
$repo_url = $ARGV[0];
+ $repo_type = guess_repo_type($repo_url, $repo_type);
$pkg = ""; $version = "";
} else { # package name passed on the command line
($repo_type, $repo_url) = find_repo($pkg, $version);
--
To unsubscribe, send mail to [EMAIL PROTECTED]