Author: adsb
Date: 2008-11-11 19:18:01 +0000 (Tue, 11 Nov 2008)
New Revision: 1723
Modified:
trunk/debian/changelog
trunk/scripts/debdiff.1
trunk/scripts/debdiff.pl
Log:
debdiff: When comparing source packages, do so in version order rather
than the order the .dsc files were passed on the command line. (May
be disabled using --no-auto-ver-sort if desired). (Closes: #505264)
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-11-11 19:13:09 UTC (rev 1722)
+++ trunk/debian/changelog 2008-11-11 19:18:01 UTC (rev 1723)
@@ -22,6 +22,9 @@
+ Check whether a SOAP call returned a valid value before attempting to
call result() on it.
+ Produce more useful error messages on failure. (Closes: #496013)
+ * debdiff: When comparing source packages, do so in version order rather
+ than the order the .dsc files were passed on the command line. (May
+ be disabled using --no-auto-ver-sort if desired). (Closes: #505264)
* tagpending: If an error occurs retrieving the list of bugs for the
package, suggest using "--force" in order to tag all the bugs as
pending without attempting to query the BTS.
Modified: trunk/scripts/debdiff.1
===================================================================
--- trunk/scripts/debdiff.1 2008-11-11 19:13:09 UTC (rev 1722)
+++ trunk/scripts/debdiff.1 2008-11-11 19:18:01 UTC (rev 1723)
@@ -128,10 +128,19 @@
.B \-\-diffstat
Include the result of \fBdiffstat\fR before the generated diff.
.TP
-.B \-\-no-diffstat
+.B \-\-no-\diffstat
The default behaviour; can be used to override a configuration file
setting.
.TP
+.B \-\-auto\-ver\-sort
+When comparing source packages, do so in version order. This is
+the default behaviour.
+.TP
+.B \-\-no\-auto\-ver\-sort
+Compare source packages in the order they were passed on the
+command-line, even if that means comparing a package with a higher
+version against one with a lower version.
+.TP
\fB\-\-no-conf\fR, \fB\-\-noconf\fR
Do not read any configuration files. This can only be used as the
first option given on the command-line.
Modified: trunk/scripts/debdiff.pl
===================================================================
--- trunk/scripts/debdiff.pl 2008-11-11 19:13:09 UTC (rev 1722)
+++ trunk/scripts/debdiff.pl 2008-11-11 19:18:01 UTC (rev 1723)
@@ -19,6 +19,8 @@
use Cwd;
use File::Basename;
use File::Temp qw/ tempdir tempfile /;
+use lib '/usr/share/devscripts';
+use Devscripts::Versort;
# Predeclare functions
sub wdiff_control_files($$$$$);
@@ -75,6 +77,9 @@
--quiet, -q Be quiet if no differences were found
--exclude PATTERN Exclude files that match PATTERN
--ignore-space, -w Ignore whitespace in diffs
+ --auto-ver-sort When comparing source packages, ensure the
+ comparison is performed in version order (default)
+ --no-auto-ver-sort Do not do so
Default settings modified by devscripts configuration files:
$modified_conf_msg
@@ -101,6 +106,7 @@
my @diff_opts = ();
my $show_diffstat = 0;
my $wdiff_source_control = 0;
+my $auto_ver_sort = 1;
my $quiet = 0;
@@ -248,6 +254,8 @@
elsif ($ARGV[0] =~ /^--no-?diffstat$/) { $show_diffstat = 0; shift; }
elsif ($ARGV[0] eq '--wdiff-source-control') { $wdiff_source_control = 1;
shift; }
elsif ($ARGV[0] =~ /^--no-?wdiff-source-control$/) { $wdiff_source_control
= 0; shift; }
+ elsif ($ARGV[0] eq '--auto-ver-sort') { $auto_ver_sort = 1; shift; }
+ elsif ($ARGV[0] =~ /^--no-?auto-ver-sort$/) { $auto_ver_sort = 0; shift; }
elsif ($ARGV[0] =~ /^--no-?conf$/) {
fatal "--no-conf is only acceptable as the first command-line option!";
}
@@ -404,7 +412,7 @@
# Compare source packages
my $pwd = cwd;
- my (@origs, @diffs, @dscs, @dscformats);
+ my (@origs, @diffs, @dscs, @dscformats, @versions);
foreach my $i (1,2) {
my $dsc = shift;
chdir dirname($dsc)
@@ -421,6 +429,8 @@
next;
} elsif (/^Format: (.*)$/) {
$dscformats[$i] = $1;
+ } elsif (/^Version: (.*)$/) {
+ $versions[$i - 1] = [ $1, $i ];
}
next unless $infiles;
last if /^\s*$/;
@@ -446,6 +456,16 @@
chdir $pwd or fatal "Couldn't chdir $pwd: $!";
}
+ @versions = Devscripts::Versort::versort(@versions);
+ # If the versions are currently out of order, should we swap them?
+ if ($auto_ver_sort and !$guessed_version and $versions[0][1] == 1) {
+ foreach my $var (([EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL
PROTECTED], [EMAIL PROTECTED])) {
+ my $temp = @{$var}[1];
+ @{$var}[1] = @{$var}[2];
+ @{$var}[2] = $temp;
+ }
+ }
+
# Do we have interdiff?
system("command -v interdiff >/dev/null 2>&1");
my $use_interdiff = ($?==0) ? 1 : 0;
--
To unsubscribe, send mail to [EMAIL PROTECTED]