tags 450878 + patch
thanks

Hi,

I have implemented this for at having debian/ under SVN, CVS or Darcs.
The patch allows to use debcommit from either debian/ or the source
directory, and it will do the right thing.

This incorporates Colin’s patch.

This is achieved by:
 * Looking for changelog in debian/changelog or ./changelog
 * Passing debian/ to SVN/CVS, if no explicit filename is passed to it.
 * Passing --repodir=debian to darcs.

Please consider including this patch and Greetings from Cacares,

Joachim


-- 
Joachim "nomeata" Breitner
Debian Developer
  [email protected] | ICQ# 74513189 | GPG-Keyid: 4743206C
  JID: [email protected] | http://people.debian.org/~nomeata
Index: debian/changelog
===================================================================
--- debian/changelog	(Revision 1926)
+++ debian/changelog	(Arbeitskopie)
@@ -1,5 +1,6 @@
 devscripts (2.10.53) UNRELEASED; urgency=low
 
+  [ Adam D. Barratt ]
   * checkbashisms: Detect the use of "source" when the sourced filename
     contains a tilde (Closes: #528592) or consists of a single character
     (Closes: #535252).  Thanks, Raphael Geissert and Ryan Niebur.
@@ -18,6 +19,10 @@
     + When using curl, follow redirects by default.  (Also from the Ubuntu
       patch).
 
+  [ Joachim Breitner ]
+  * Add support for having only debian/ under a svn, cvs or darcs VCS (Closes:
+    #450878)
+
  -- Adam D. Barratt <[email protected]>  Wed, 01 Jul 2009 18:43:43 +0100
 
 devscripts (2.10.52) unstable; urgency=low
Index: scripts/debcommit.pl
===================================================================
--- scripts/debcommit.pl	(Revision 1926)
+++ scripts/debcommit.pl	(Arbeitskopie)
@@ -238,9 +238,10 @@
 my $all=0;
 my $stripmessage=1;
 my $signtags=0;
-my $changelog="debian/changelog";
+my $changelog;
 my $keyid;
 my $version;
+my $onlydebian=0;
 
 # Now start by reading configuration files and then command line
 # The next stuff is boilerplate
@@ -295,6 +296,12 @@
     }
 }
 
+# Find a good default for the changelog file location
+
+for (qw"debian/changelog changelog") {
+    $changelog = $_ if -e ($_);
+}
+
 # Now read the command line arguments
 
 Getopt::Long::Configure("bundling");
@@ -327,6 +334,9 @@
 }
 
 my $prog=getprog();
+if (! defined $changelog) {
+    die "debcommit: Could not find a Debian changelog\n";
+}
 if (! -e $changelog) {
     die "debcommit: cannot find $changelog\n";
 }
@@ -341,7 +351,7 @@
     }
     close C;
     
-    $version=`dpkg-parsechangelog | grep '^Version:' | cut -f 2 -d ' '`;
+    $version=`dpkg-parsechangelog -l\Q$changelog\E | grep '^Version:' | cut -f 2 -d ' '`;
     chomp $version;
 
     $message="releasing version $version" if ! defined $message;
@@ -360,8 +370,17 @@
 sub getprog {
     if (-d "debian") {
 	if (-d "debian/.svn") {
+	    # SVN has .svn even in subdirs...
+	    if (! -d ".svn") {
+		$onlydebian = 1;
+	    }
 	    return "svn";
 	} elsif (-d "debian/CVS") {
+	    # CVS has CVS even in subdirs...
+	    if (! -d "CVS") {
+		$onlydebian = 1;
+	    }
+	    $onlydebian = 1;
 	    return "cvs";
 	} elsif (-d "debian/{arch}") {
 	    # I don't think we can tell just from the working copy
@@ -373,6 +392,7 @@
 		return "tla";
 	    }
 	} elsif (-d "debian/_darcs") {
+	    $onlydebian = 1;
 	    return "darcs";
 	}
     }
@@ -428,6 +448,9 @@
 
 sub action {
     my $prog=shift;
+    if ($prog eq "darcs" && $onlydebian) {
+	splice(@_,1,0,"--repodir=debian");
+    }
     print $prog, " ",
       join(" ", map { if (/[^-A-Za-z0-9]/) { "'$_'" } else { $_ } } @_), "\n";
     return 1 if $noact;
@@ -464,6 +487,9 @@
 
     my $action_rc;  # return code of external command
     if ($prog =~ /^(cvs|svn|svk|hg)$/) {
+	if (!...@files_to_commit && $onlydebian) {
+	    @files_to_commit = ("debian");
+	}
         $action_rc = $diffmode
 	    ? action($prog, "diff", @files_to_commit)
 	    : action($prog, "commit", "-m", $message, @files_to_commit);
@@ -652,6 +678,8 @@
 	} elsif ($prog eq 'svk') {
 	    $ENV{'SVKDIFF'} = '/usr/bin/diff -w -u';
 	    @diffcmd = ($prog, 'diff');
+	} elsif ($prog eq 'darcs' && $onlydebian) {
+	    @diffcmd = ($prog, 'diff', '--repodir=debian', '--diff-opts=-wu');
 	} elsif ($prog eq 'darcs') {
 	    @diffcmd = ($prog, 'diff', '--diff-opts=-wu');
 	} else {

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to