Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: differences between the two branches



On Oct 12,  2:45pm, Bart Schaefer wrote:
} 
} } Anyway to make this task easier, I passed both ChangeLogs through a bit
} } of sed to extract just the entries, wrapped onto one line each.
} 
} Hmm, a bit of perl could probably help here.  It should be possible to
} gobble up the entries to sort them by article number without actually
} unfolding them.  I might fiddle with that later.

Attached are the script and the output.  (Thanks go to S. Spencer Sun,
who happens both to work at Zanshin with me and to be an old Princeton
crony of PF's, for the basic algorithm that I hacked to produce this
script.)

What this does is parse change-long entries, pick out the article numbers
(for very loose definitions of "article" and "number"), and stash each
entry in a hash keyed on that article number.  If it can't parse one, it
lumps all such entries under "unattributed".  Every entry so hashed gets
its own "date name email" line (provided one could be parsed, so this
doesn't work very well on ChangeLog.3.0 as yet, though ChangeLog-3.1 is
mostly acceptable).

If there are multiple article numbers between the `*' and the `:' in the
same entry, they all get sucked up into one big key.  The regex to do this
took up about 80% of the time I expended on the script.  (I shouldn't have
bothered about being able to parse ChangeLog-3.1, but I did.)

The script then sorts the hash keys in reverse order (which means that
workers/*, users/*, unattributed, etc., come before article numbers, so
it's not perfect) and walks both hashes, comparing the keys.  If it
finds a key in one hash but not the other, it prints an "only in XXX"
line.  Otherwise it runs diff on the actual entries and prints out any
lines it gets back.

So the result is, in roughly descending-article-number order, a list of
all the articles that appear in only one file, plus the diffs of any
log entries where the same article was logged differently to each.

You run it as

	difflog.pl [diff-options] older-file newer-file

E.g. I ran

	difflog.pl -u1 branch/ChangeLog current/ChangeLog

The option `-bw' is always added to the diff-options, see `@differ'.

You can probably think of ways to make the output more useful, e.g. by
dumping the actual log entries that appear only in the newer file so
you don't have to go hunting for them.  Left as an excercise; I'm very
sleepy now.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

#!/usr/bin/perl

use IO::File;

my @differ = qw(diff -bw);
my $oldtmp = "/tmp/difflog$$.old";
my $newtmp = "/tmp/difflog$$.new";

my $newfn = pop(@ARGV);
my $oldfn = pop(@ARGV);
my (%oldhash, %newhash);

read_file($newfn, \%newhash);
read_file($oldfn, \%oldhash);

my @oldentries = reverse sort keys %oldhash;
my @newentries = reverse sort keys %newhash;

my $old = 0;
my $new = 0;

while ($old < @oldentries && $new < @newentries)
{
  my $cmp = $oldentries[$old] cmp $newentries[$new];
  if ($cmp > 0)
  {
    printf("only in %s: %s\n\n", $oldfn, $oldentries[$old++]);
  }
  elsif ($cmp < 0)
  {
    printf("only in %s: %s\n\n", $newfn, $newentries[$new++]);
  }
  else
  {
    if ($oldhash{$oldentries[$old]} ne $newhash{$newentries[$new]}) {
      my $oldfh = new IO::File("/tmp/difflog$$.old", 'w');
      $oldfh->print($oldhash{$oldentries[$old]});
      $oldfh->close();
      my $newfh = new IO::File("/tmp/difflog$$.new", 'w');
      $newfh->print($newhash{$newentries[$new]});
      $newfh->close();
      open(DIFF, join(' ', @differ, @ARGV, $oldtmp, $newtmp, '|'));
      my @lines = <DIFF>;
      close(DIFF);
      unlink </tmp/difflog$$.*>;
      if (@lines)
      {
	print "diff for ", $oldentries[$old], ":\n";
	map {
	  s/$oldtmp/$oldfn/;
	  s/$newtmp/$newfn/;
	} @lines;
	print @lines, "\n";
      }
    }
    ++$old;
    ++$new;
  }
}

while ($old < @oldentries)    
{
  printf("only in %s: %s\n", $oldfn, $oldentries[$old++]);
}

while ($new < @newentries)
{
  printf("only in %s: %s\n", $newfn, $newentries[$new++]);
}

sub read_file
{
  my $fn = shift;
  my $hashref = shift;
  my $fh = new IO::File($fn, 'r');
  my ($tag, $date, $entry, $block);

  my $attrib = q[(:?(:?workers?|users?)/)?\d+];
  $attrib = q[(?:\w+\s+)*] . $attrib;
  $attrib = q[(?:[^/]*\D:\s*)?] . $attrib;
  $attrib = qq[(?:unposted|$attrib)];
  $attrib = qq[(?:(?:$attrib,)*\s*$attrib)];

  $hashref->{unattributed} = $block = '';

  while (my $line = $fh->getline())
  {
    if ($line =~ /(\d{4}-\d\d-\d\d)\s+.+\s+<.+\@.+>/i) {
      $date = $1;
      $block =~ s/\n*\Z/\n/;
      if ($entry) {
	$hashref->{$entry} .= "$tag\n$block";
      } elsif ($tag) {
	$hashref->{unattributed} .= "\n$tag$block";
      }
      $entry = $block = '';
      $tag = $line;
    } elsif ($line =~ /\* ((?:$attrib)[^:]*):/) {
      my $next = $1;
      if ($entry) {
	$block =~ s/\n*\Z/\n/;
	$hashref->{$entry} .= "$tag\n$block";
      }
      $entry = $next;
      $hashref->{$next} = '';
      $block = $line;
    } else {
      $block .= $line;
    }
  }
  $fh->close();
}
only in current/ChangeLog: users/4157 (plus workers/15674)

diff for users/4092:
--- branch/ChangeLog	Fri Oct 12 23:45:56 2001
+++ current/ChangeLog	Fri Oct 12 23:45:56 2001
@@ -1,4 +1,4 @@
-2001-08-17  Wayne Davison  <wayned@xxxxxxxxxxxxxxxxxxxxx>
+2001-08-07  Wayne Davison  <wayned@xxxxxxxxxxxxxxxxxxxxx>
 
-	* users/4092: Src/hist.c: Don't drop the last line of the history
-	file when handling a signal.
+	* users/4092: Src/hist.c: Don't lose the last history line
+	when a signal causes us to rewrite the history file.

only in current/ChangeLog: unposted; based on 14679 (me) and 14693 (Bart)

diff for unposted:
--- branch/ChangeLog	Fri Oct 12 23:45:56 2001
+++ current/ChangeLog	Fri Oct 12 23:45:56 2001
@@ -1,5 +1,3 @@
-2001-06-13  Peter Stephenson  <pws@xxxxxxx>
+2001-06-06  Andrej Borsenkow  <bor@xxxxxxx>
 
-	* unposted: Completion/compinstall: spotted by Bart: assignments
-	when finding $fpath if not set in current shell were completely
-	garbled.
+	* unposted: Etc/zsh-development-guide: we now support autoconf-2.50

diff for unattributed:
--- branch/ChangeLog	Fri Oct 12 23:45:56 2001
+++ current/ChangeLog	Fri Oct 12 23:45:56 2001
@@ -0,0 +1,8 @@
+
+2001-09-21  Andrew Main (Zefram)  <zefram@xxxxxxx>
+
+	* Doc/Zsh/contrib.yo, Functions/Misc/tetris: Tetris game for ZLE.
+
+2001-06-04  Peter Stephenson  <pws@xxxxxxx>
+
+	* Relabelled this version 4.1.0-dev-0.

diff for David Lebel: 15742:
--- branch/ChangeLog	Fri Oct 12 23:45:56 2001
+++ current/ChangeLog	Fri Oct 12 23:45:56 2001
@@ -1,2 +1,2 @@
-2001-09-09  Bart Schaefer  <schaefer@xxxxxxxxxxxxxxxx>
+2001-09-09  Bart Schaefer  <schaefer@xxxxxxx>
 

only in current/ChangeLog: Bart: 15106, small changes in 15152

only in current/ChangeLog: Back out 15266

only in current/ChangeLog: 16xxx

only in branch/ChangeLog: 16018

only in current/ChangeLog: 16006

only in current/ChangeLog: 16005

only in current/ChangeLog: 16002

only in current/ChangeLog: 16000

only in current/ChangeLog: 15995

only in current/ChangeLog: 15994

only in current/ChangeLog: 15991

only in current/ChangeLog: 15987

diff for 15983:
--- branch/ChangeLog	Fri Oct 12 23:45:57 2001
+++ current/ChangeLog	Fri Oct 12 23:45:57 2001
@@ -1,6 +1,6 @@
-2001-10-12  Oliver Kiddle  <opk@xxxxxxx>
+2001-10-08  Oliver Kiddle  <opk@xxxxxxx>
 
-	* 15983: Completion/Unix/Command/_user_admin,
-	Completion/Unix/Command/_sysctl, Completion/Unix/Type/_urls,
-	Completion/Unix/Command/_webbrowser: darwin support in _sysctl,
-	complete files for galeon
+	* 15983: Completion/Unix/Command/_wget, Completion/Unix/Type/_urls,
+	Completion/Unix/Command/_user_admin, Completion/Unix/Command/_sysctl,
+	Completion/Unix/Command/_webbrowser: update for wget 1.7, darwin
+	support in _sysctl, complete files for galeon

only in current/ChangeLog: 15980

only in branch/ChangeLog: 15974

only in current/ChangeLog: 15973

only in current/ChangeLog: 15964

only in current/ChangeLog: 15949

only in current/ChangeLog: 15946

only in current/ChangeLog: 15945

only in current/ChangeLog: 15944

only in current/ChangeLog: 15931

only in current/ChangeLog: 15919

only in current/ChangeLog: 15917

only in current/ChangeLog: 15895

only in current/ChangeLog: 15886

diff for 15882:
--- branch/ChangeLog	Fri Oct 12 23:45:57 2001
+++ current/ChangeLog	Fri Oct 12 23:45:57 2001
@@ -1,2 +1,2 @@
-2001-10-12  Oliver Kiddle  <opk@xxxxxxx>
+2001-09-27  Oliver Kiddle  <opk@xxxxxxx>
 

only in branch/ChangeLog: 15866, Sven 15468

only in current/ChangeLog: 15866

only in current/ChangeLog: 15851, 15948

only in current/ChangeLog: 15844

diff for 15837:
--- branch/ChangeLog	Fri Oct 12 23:45:58 2001
+++ current/ChangeLog	Fri Oct 12 23:45:58 2001
@@ -1,2 +1,2 @@
-2001-09-18  Wayne Davison  <wayned@xxxxxxxxxxxxxxxxxxxxx>
+2001-09-17  Wayne Davison  <wayned@xxxxxxxxxxxxxxxxxxxxx>
 

only in current/ChangeLog: 15836

only in current/ChangeLog: 15812

only in current/ChangeLog: 15809

only in current/ChangeLog: 15806

only in current/ChangeLog: 15783

only in current/ChangeLog: 15780

only in current/ChangeLog: 15779

only in current/ChangeLog: 15772

only in current/ChangeLog: 15770

only in current/ChangeLog: 15768

only in current/ChangeLog: 15766

only in current/ChangeLog: 15765

only in current/ChangeLog: 15763

only in current/ChangeLog: 15762

only in current/ChangeLog: 15740

only in current/ChangeLog: 15739

only in current/ChangeLog: 15734

only in current/ChangeLog: 15722

only in current/ChangeLog: 15721

only in current/ChangeLog: 15720

only in current/ChangeLog: 15713

only in current/ChangeLog: 15708

only in current/ChangeLog: 15702

only in current/ChangeLog: 15676

only in current/ChangeLog: 15669

only in current/ChangeLog: 15653

only in current/ChangeLog: 15650

only in current/ChangeLog: 15647

only in current/ChangeLog: 15638

only in branch/ChangeLog: 15630 & 15713

only in current/ChangeLog: 15630

diff for 15621:
--- branch/ChangeLog	Fri Oct 12 23:45:59 2001
+++ current/ChangeLog	Fri Oct 12 23:45:59 2001
@@ -1,2 +1,2 @@
-2001-09-09  Geoff Wing  <gcw@xxxxxxx>
+2001-08-15  Geoff Wing  <gcw@xxxxxxx>
 

only in current/ChangeLog: 15615

only in current/ChangeLog: 15608

only in current/ChangeLog: 15606

only in current/ChangeLog: 15597

only in current/ChangeLog: 15596

diff for 15594:
--- branch/ChangeLog	Fri Oct 12 23:45:59 2001
+++ current/ChangeLog	Fri Oct 12 23:45:59 2001
@@ -1,2 +1,2 @@
-2001-10-12  Oliver Kiddle  <opk@xxxxxxx>
+2001-08-07  Oliver Kiddle  <opk@xxxxxxx>
 

only in current/ChangeLog: 15590

only in current/ChangeLog: 15588

only in current/ChangeLog: 15586

only in current/ChangeLog: 15585

only in current/ChangeLog: 15584

only in current/ChangeLog: 15583

only in branch/ChangeLog: 15577

diff for 15574:
--- branch/ChangeLog	Fri Oct 12 23:45:59 2001
+++ current/ChangeLog	Fri Oct 12 23:45:59 2001
@@ -2,5 +2,10 @@
 
-	* 15574: Completion/Unix/Command/_cvs, Completion/Unix/Type/_users,
-	Completion/Unix/Command/_user_admin, Completion/Unix/Type/_groups,
-	Completion/Unix/Type/_directories: new _user_admin completion for
-	useradd, groupmod etc and remove redundant duplication in _cvs
+	* 15574: Completion/Unix/Command/_cvs, Completion/Unix/Command/_dd,
+	Completion/Unix/Command/_dict, Completion/Unix/Command/_grep,
+	Completion/Unix/Command/_loadkeys, Completion/Unix/Command/_ls,
+	Completion/Unix/Command/_patch, Completion/Unix/Command/_user_admin,
+	Completion/Unix/Command/_wget, Completion/Unix/Type/_diff_options,
+	Completion/Unix/Type/_directories,  Completion/Unix/Type/_groups,
+	Completion/Unix/Type/_users: new _user_admin for useradd, groupmod etc,
+	rewrite of _dd to use _values and make more completions share
+	descriptions for long and short options

diff for 15562, Akinori Musha: 15559, 15563:
--- branch/ChangeLog	Fri Oct 12 23:45:59 2001
+++ current/ChangeLog	Fri Oct 12 23:45:59 2001
@@ -1,2 +1,2 @@
-2001-08-06  Oliver Kiddle  <opk@xxxxxxx>
+2001-08-03  Oliver Kiddle  <opk@xxxxxxx>
 

only in current/ChangeLog: 15549

only in current/ChangeLog: 15526

only in current/ChangeLog: 15511

only in current/ChangeLog: 15509

only in current/ChangeLog: 15508

only in current/ChangeLog: 15507

only in current/ChangeLog: 15498

only in current/ChangeLog: 15489

only in current/ChangeLog: 15488

diff for 15487:
--- branch/ChangeLog	Fri Oct 12 23:45:59 2001
+++ current/ChangeLog	Fri Oct 12 23:45:59 2001
@@ -2,3 +2,4 @@
 
-	* 15487: Src/Zle/complete.c: fix for `--' before matches ignoring all
-	-M options in compadd
+	* 15487: Completion/Base/Utility/_describe, Src/Zle/complete.c:
+	move pattern matching in the loop to make sure all match specs
+	are used

only in current/ChangeLog: 15485

only in current/ChangeLog: 15484

only in current/ChangeLog: 15482

only in current/ChangeLog: 15477

only in current/ChangeLog: 15472

only in current/ChangeLog: 15468

only in current/ChangeLog: 15432

only in current/ChangeLog: 15415

only in current/ChangeLog: 15409

only in current/ChangeLog: 15407

only in current/ChangeLog: 15389

only in current/ChangeLog: 15375

only in current/ChangeLog: 15354

only in current/ChangeLog: 15334

only in current/ChangeLog: 15329

only in current/ChangeLog: 15327

only in current/ChangeLog: 15305

only in current/ChangeLog: 15304

only in current/ChangeLog: 15291, 15292

only in current/ChangeLog: 15288

only in current/ChangeLog: 15279

only in current/ChangeLog: 15278 (Sven), 15390

diff for 15277:
--- branch/ChangeLog	Fri Oct 12 23:46:00 2001
+++ current/ChangeLog	Fri Oct 12 23:46:00 2001
@@ -1,4 +1,4 @@
-2001-07-05  Peter Stephenson  <pws@xxxxxxx>
+2001-07-06  Peter Stephenson  <pws@xxxxxxx>
 
-	* 15277: Src/glob.c: bug with ${(S)...%%...}: the indices
+	* 15277: Src/glob.c: *real* bug with ${(S)...%%...}: the indices
 	for start and end of backreferences were incorrect.

only in current/ChangeLog: 15271

only in current/ChangeLog: 15266

only in current/ChangeLog: 15265

only in current/ChangeLog: 15250

only in current/ChangeLog: 15242

only in current/ChangeLog: 15234

only in current/ChangeLog: 15228

only in current/ChangeLog: 15211

only in current/ChangeLog: 15198

only in current/ChangeLog: 15181

only in current/ChangeLog: 15180

only in current/ChangeLog: 15169

only in current/ChangeLog: 15160 and Andrej zsh-users/3973

only in branch/ChangeLog: 15160

diff for 15151:
--- branch/ChangeLog	Fri Oct 12 23:46:01 2001
+++ current/ChangeLog	Fri Oct 12 23:46:01 2001
@@ -1,2 +1,2 @@
-2001-06-28  Peter Stephenson  <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
+2001-06-27  Peter Stephenson  <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
 

only in current/ChangeLog: 15123

only in current/ChangeLog: 15115

only in current/ChangeLog: 15099

only in current/ChangeLog: 15094

only in current/ChangeLog: 15087

diff for 15079:
--- branch/ChangeLog	Fri Oct 12 23:46:01 2001
+++ current/ChangeLog	Fri Oct 12 23:46:01 2001
@@ -1,2 +1,2 @@
-2001-06-28  Clint Adams  <clint@xxxxxxx>
+2001-06-25  Clint Adams  <clint@xxxxxxx>
 

only in current/ChangeLog: 15060

only in current/ChangeLog: 15057

only in current/ChangeLog: 15056

only in current/ChangeLog: 15050, 15054

only in current/ChangeLog: 15038

only in current/ChangeLog: 15030

only in current/ChangeLog: 15029

only in current/ChangeLog: 15023, 15027

only in current/ChangeLog: 14952

only in current/ChangeLog: 14939

only in current/ChangeLog: 14931

only in current/ChangeLog: 14929

diff for 14921:
--- branch/ChangeLog	Fri Oct 12 23:46:02 2001
+++ current/ChangeLog	Fri Oct 12 23:46:02 2001
@@ -2,3 +2,4 @@
 
-	* 14921: Completion/Zsh/_zftp: autoload zfcd_match and zfget_match
-	if necessary.
+	* 14921: Functions/Zftp/zfinit, Completion/Zsh/Command/_zftp:
+	Load tcp module for zftp; autoload zfget_match and zfcd_match
+	for _zftp.

only in current/ChangeLog: 14915

only in current/ChangeLog: 14863

only in current/ChangeLog: 14843

only in current/ChangeLog: 14827

only in current/ChangeLog: 14815

only in current/ChangeLog: 14813

diff for 14792:
--- branch/ChangeLog	Fri Oct 12 23:46:03 2001
+++ current/ChangeLog	Fri Oct 12 23:46:03 2001
@@ -2,4 +2,4 @@
 
-	* 14792: Test/comptest: Don't import the current terminal type for
-	the zpty terminal, because the current terminal might not be able
-	to run ZLE (e.g., emacs shell mode).
+	* 14792: Src/Modules/tcp.h, Src/Modules/zftp.c: Shuffle around
+	several #include directives to get the sockaddr_in definition in
+	all the places it's needed.

only in current/ChangeLog: 14778

only in current/ChangeLog: 14770

only in current/ChangeLog: 14760

only in current/ChangeLog: 14758

only in branch/ChangeLog: 14679, Bart 14693, 14758, 14760



Messages sorted by: Reverse Date, Date, Thread, Author