root/scripts/metadata_report.sh

Revision 626:67183f7d583f, 1.2 kB (checked in by David Anderson <dave@…>, 5 months ago)

Fix the regular expression to *actually* accept nicknames correctly.

  • Property exe set to *
Line 
1#!/bin/bash
2#
3# Copyright (c) 2008 the NxOS developers
4#
5# See AUTHORS for a full list of the developers.
6#
7# Redistribution of this file is permitted under
8# the terms of the GNU Public License (GPL) version 2.
9#
10# Check the commit metadata for common mistakes:
11#  - Author is the auto-guessed email, instead of a nice name.
12#  - Commit message is way too short.
13
14AUTHOR=`hg tip --template {author}`
15AUTHOR_VALID=`echo $AUTHOR | egrep -i '[a-z ]+ (\[[a-z0-9 ]+\] )?<[a-z.+@]+>'`
16
17if [ "x$AUTHOR_VALID" = "x" ]; then
18  echo "Changeset author does not conform to the pattern Firstname Lastname <email>"
19  echo " eg. John Smith <jsmith@example.com>"
20  echo "Please add the ui:username variable to you ~/.hgrc. Here is a sample .hgrc:"
21  echo
22  echo "[ui]"
23  echo "username = John Smith <jsmith@example.com>"
24  echo
25  hg tip --template {desc} >commit.msg
26  echo "Commit message saved in commit.msg"
27  exit 1
28fi
29
30MSG_OK=`hg tip --template {desc} | wc -c`
31
32if [ $MSG_OK -lt 15 ]; then
33  echo "Your commit message is very short, and probably doesn't describe your"
34  echo "change very well. Please be a little more verbose."
35  echo
36  hg tip --template {desc} >commit.msg
37  echo "Commit message saved in commit.msg"
38  exit 1
39fi
40
41exit 0
Note: See TracBrowser for help on using the browser.