Simplify the display of most updatesets.
The potentially confusing part is that complex updatesets will still
display the same, but simple stuff, e.g., foo-1.0->foo-1.1 will becom
foo-1.0->1.1
I'm definitely not the best guy to say whether it's clearer or not,
since I spend too much time looking at that code.
Better or worse ?
Index: OpenBSD/UpdateSet.pm
===================================================================
RCS file: /cvs/src/usr.sbin/pkg_add/OpenBSD/UpdateSet.pm,v
retrieving revision 1.69
diff -u -p -r1.69 UpdateSet.pm
--- OpenBSD/UpdateSet.pm 17 Jul 2011 13:18:07 -0000 1.69
+++ OpenBSD/UpdateSet.pm 4 Sep 2012 13:57:22 -0000
@@ -342,6 +342,16 @@ sub print
if ($self->kept > 0) {
$result = "[".join('+', sort $self->kept_names)."]";
}
+ # XXX common case
+ if ($self->newer == 1 && $self->older == 1) {
+ my ($a, $b) = ($self->older_names, $self->newer_names);
+ my $stema = OpenBSD::PackageName::splitstem($a);
+ my ($stemb, @rest) = OpenBSD::PackageName::splitname($b);
+ if ($stema eq $stemb) {
+ return $result .$a."->".join('-', @rest);
+ }
+ }
+
if ($self->older > 0) {
$result .= $self->SUPER::print."->";
}