This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade libnet from version 3.10 to 3.11
[perl5.git] / Porting / git-deltatool
index 1458989..33bd595 100644 (file)
@@ -97,6 +97,7 @@ sub assign {
       say "-" x 75;
       $self->show_header($log);
       $self->show_body($log, 1);
+      $self->show_files($log);
       say "-" x 75;
       return $self->dispatch( $self->prompt( @choices ), $log);
     }
@@ -228,15 +229,14 @@ sub edit_text {
   else {
     warn("No VISUAL or EDITOR defined");
   }
-  $tempfh->seek(0,0);
-  return do { local $/; <$tempfh> };
+  return do { local (@ARGV,$/) = "$tempfh"; <> };
 }
 
 sub find_commits {
   my ($self, $type) = @_;
   $type //= 'new';
   my @commits = $self->git->log($self->last_tag . "..HEAD");
-  $_ = Git::Wrapper::XLog->from_log($_) for @commits;
+  $_ = Git::Wrapper::XLog->from_log($_, $self->git) for @commits;
   my @list;
   if ( $type eq 'new' ) {
     @list = grep { ! $_->notes } @commits;
@@ -325,6 +325,16 @@ sub show_body {
   return;
 }
 
+sub show_files {
+  my ($self, $log) = @_;
+  my @files = $self->git->diff_tree({r => 1, abbrev => 1}, $log->id);
+  shift @files; # throw away commit line
+  return unless @files;
+  say "\nChanged:";
+  say join("\n", map { "  * $_" } sort map { /.*\s+(\S+)/; $1 } @files);
+  return;
+}
+
 sub show_header {
   my ($self, $log) = @_;
   my $header = $log->short_id;
@@ -775,7 +785,7 @@ sub short_id { shift->attr->{short_id} }
 sub author { shift->attr->{author} }
 
 sub from_log {
-  my ($class, $log) = @_;
+  my ($class, $log, $git) = @_;
 
   my $msg = $log->message;
   my ($subject, $body) = $msg =~ m{^([^\n]+)\n*(.*)}ms;
@@ -783,7 +793,7 @@ sub from_log {
   $body //= '';
   $body =~ s/[\r\n]*\z//ms;
 
-  my ($short) = Git::Wrapper->new(".")->rev_parse({short => 1}, $log->id);
+  my ($short) = $git->rev_parse({short => 1}, $log->id);
 
   $log->attr->{subject} = $subject;
   $log->attr->{body} = $body;