Implementation of manifest defined githooks

When working within a team or corporation it is often
useful/required to use predefined git templates. This
change teaches repo to use a per-remote git hook template
structure.

The implementation is done as a continuation of the
existing projecthook functionality. The terminology is
therefore defined as projecthooks.

The downloaded projecthooks are stored in the .repo
directory as a metaproject separating them from the users
project forest.

The projecthooks are downloaded and set up when doing a
repo init and updated for each new repo init.

When downloading a mirror the projecthooks gits are
not added to the bare forest since the intention is to
ensure that the latest are used (allows for company policy
enforcement).

The projecthooks are defined in the manifest file in the
remote element as a subnode, the name refers to the
project name on the server referred to in the remote.
<remote name="myremote ..>
   <projecthook name="myprojecthookgit" revision="myrevision"/>
</remote>

The hooks found in the projecthook revision supersede
the stock hooks found in repo. This removes the need for
updating the projecthook gits for repo stock hook changes.

Change-Id: I6796b7b0342c1f83c35f4b3e46782581b069a561
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
Signed-off-by: Ian Kumlien <ian.kumlien@gmail.com>
diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt
index 1aa9396..4b979c7 100644
--- a/docs/manifest-format.txt
+++ b/docs/manifest-format.txt
@@ -31,7 +31,7 @@
 
     <!ELEMENT notice (#PCDATA)>
 
-    <!ELEMENT remote (EMPTY)>
+    <!ELEMENT remote (projecthook?)>
     <!ATTLIST remote name         ID    #REQUIRED>
     <!ATTLIST remote alias        CDATA #IMPLIED>
     <!ATTLIST remote fetch        CDATA #REQUIRED>
@@ -73,6 +73,10 @@
     <!ATTLIST extend-project path CDATA #IMPLIED>
     <!ATTLIST extend-project groups CDATA #IMPLIED>
 
+    <!ELEMENT projecthook (EMPTY)>
+    <!ATTLIST projecthook name CDATA #REQUIRED>
+    <!ATTLIST projecthook revision CDATA #REQUIRED>
+
     <!ELEMENT remove-project (EMPTY)>
     <!ATTLIST remove-project name  CDATA #REQUIRED>
 
@@ -306,6 +310,15 @@
 Attribute `name`: the manifest to include, specified relative to
 the manifest repository's root.
 
+Element projecthook
+-------------------
+
+This element is used to define a per-remote hook git that is
+fetched and applied to all projects using the remote. The project-
+hook functionality allows for company/team .git/hooks to be used.
+The hooks in the supplied project and revision are supplemented to
+the current repo stock hooks for each project. Supplemented hooks
+overrule any stock hooks.
 
 Local Manifests
 ===============