Print this page
4389 webrev should fetch preparer info from git if available

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/scripts/webrev.sh
          +++ new/usr/src/tools/scripts/webrev.sh
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19  #
  20   20  # CDDL HEADER END
  21   21  #
  22   22  
  23   23  #
  24   24  # Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  25   25  #
  26   26  
  27   27  # Copyright 2008, 2010, Richard Lowe
  28   28  # Copyright 2012 Marcel Telka <marcel@telka.sk>
       29 +# Copyright 2013 Ivan Richwalski <ivan@seppuku.net>
  29   30  
  30   31  #
  31   32  # This script takes a file list and a workspace and builds a set of html files
  32   33  # suitable for doing a code review of source changes via a web page.
  33   34  # Documentation is available via the manual page, webrev.1, or just
  34   35  # type 'webrev -h'.
  35   36  #
  36   37  # Acknowledgements to contributors to webrev are listed in the webrev(1)
  37   38  # man page.
  38   39  #
↓ open down ↓ 3434 lines elided ↑ open up ↑
3473 3474  
3474 3475  print "<table>"
3475 3476  
3476 3477  #
3477 3478  # Get the preparer's name:
3478 3479  #
3479 3480  # If the SCM detected is Mercurial, and the configuration property
3480 3481  # ui.username is available, use that, but be careful to properly escape
3481 3482  # angle brackets (HTML syntax characters) in the email address.
3482 3483  #
     3484 +# For git, use the user.name and user.email properties if they are set.
     3485 +#
3483 3486  # Otherwise, use the current userid in the form "John Doe (jdoe)", but
3484 3487  # to maintain compatibility with passwd(4), we must support '&' substitutions.
3485 3488  #
3486 3489  preparer=
3487 3490  if [[ "$SCM_MODE" == mercurial ]]; then
3488 3491          preparer=`hg showconfig ui.username 2>/dev/null`
3489      -        if [[ -n "$preparer" ]]; then
3490      -                preparer="$(echo "$preparer" | html_quote)"
     3492 +elif [[ "$SCM_MODE" == git ]]; then
     3493 +        preparer=$( git config user.name 2>/dev/null )
     3494 +        prepmail=$( git config user.email 2>/dev/null )
     3495 +        if [[ -n "$prepmail" ]]; then
     3496 +                preparer="$preparer <$prepmail>"
3491 3497          fi
3492 3498  fi
     3499 +if [[ -n "$preparer" ]]; then
     3500 +        preparer="$(echo "$preparer" | html_quote)"
     3501 +fi
3493 3502  if [[ -z "$preparer" ]]; then
3494 3503          preparer=$(
3495 3504              $PERL -e '
3496 3505                  ($login, $pw, $uid, $gid, $quota, $cmt, $gcos) = getpwuid($<);
3497 3506                  if ($login) {
3498 3507                      $gcos =~ s/\&/ucfirst($login)/e;
3499 3508                      printf "%s (%s)\n", $gcos, $login;
3500 3509                  } else {
3501 3510                      printf "(unknown)\n";
3502 3511                  }
↓ open down ↓ 250 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX