Control: tag -1 patch

Cyril Brulebois <k...@debian.org> (02/12/2011):
> while reviewing (for sponsorship reasons) two versions of the same dsc
> (it was updated), I ran:
>   debdiff old/foo.dsc new/foo.dsc
> 
> and got a reverse diff.
> 
> Apparently, the logic behind DEBDIFF_AUTO_VER_SORT=yes is reversing a
> bit too much: in this case, the version is strictly the same in both
> dsc's, so it would be nice not to reverse in this case. ;-)

Here's a patch to fix that behaviour.

Mraw,
KiBi.
From da7985c6fa3633266e807993618ee3ed4b1153b7 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <k...@debian.org>
Date: Fri, 14 Dec 2012 11:35:46 +0100
Subject: [PATCH] Don't auto reverse diffs when the same version is passed and
 when DEBDIFF_AUTO_VER_SORT=yes

Closes: #650732
Signed-off-by: Cyril Brulebois <k...@debian.org>
---
 debian/changelog   |    4 ++++
 scripts/debdiff.pl |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index aaa22ab..33708bc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -35,6 +35,10 @@ devscripts (2.12.6+exp1) UNRELEASED; urgency=low
   * debian/control: Mark devscripts Multi-Arch: foreign.
     Thanks to Colin Watson. (Closes: #694760)
 
+  [ Cyril Brulebois ]
+  * Don't auto reverse diffs when DEBDIFF_AUTO_VER_SORT is set to yes, and
+    when the version in both packages is the same. (Closes: #650732)
+
  -- James McCoy <james...@debian.org>  Sat, 15 Sep 2012 16:12:16 -0400
 
 devscripts (2.12.6) unstable; urgency=low
diff --git a/scripts/debdiff.pl b/scripts/debdiff.pl
index 2ec4a81..6ceee8f 100755
--- a/scripts/debdiff.pl
+++ b/scripts/debdiff.pl
@@ -516,7 +516,7 @@ elsif ($type eq 'dsc') {
 
     @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) {
+    if ($auto_ver_sort and !$guessed_version and $versions[0][1] == 1 and $versions[0][0] ne $versions[1][0]) {
 	foreach my $var ((\@origs, \@diffs, \@dscs, \@dscformats)) {
 	    my $temp = @{$var}[1];
 	    @{$var}[1] = @{$var}[2];
-- 
1.7.10.4

Attachment: signature.asc
Description: Digital signature

Reply via email to