pre-upload.py: check that Change-Id is in the last line

If the Change-Id is not on the last line a new review gets created
on upload.

BUG=none
TEST=Tested by adding stuff below Change-Id in this cl.

Change-Id: Iea595752f267df29248f59fc69d417c63519181a
diff --git a/pre-upload.py b/pre-upload.py
index b992489..f9a1133 100644
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -224,6 +224,13 @@
   if not re.search(BUG_RE, _get_commit_desc(commit)):
      _report_error('Changelist description needs BUG field (after first line)')
 
+def _check_change_has_proper_changeid(project, commit):
+  """Verify that Change-ID is present in last paragraph of commit message."""
+  desc = _get_commit_desc(commit)
+  loc = desc.rfind('\nChange-Id:')
+  if loc == -1 or re.search('\n\s*\n\s*\S+', desc[loc:]):
+     _report_error('Change-Id must be in last paragraph of description.')
+
 def _check_license(project, commit):
   """Verifies the license header."""
   LICENSE_HEADER = (
@@ -280,6 +287,7 @@
                 _check_no_tabs,
                 _check_change_has_test_field,
                 _check_change_has_bug_field,
+                _check_change_has_proper_changeid,
                 _check_license]
 
 def _setup_project_hooks():