summaryrefslogtreecommitdiffstats
path: root/docs/manifest-format.txt
diff options
context:
space:
mode:
authorDoug Anderson <dianders@google.com>2011-03-04 11:54:18 -0800
committerShawn O. Pearce <sop@google.com>2011-03-11 11:53:23 -0800
commit37282b4b9c5b1d9a1ff07f7f0686a81b65a0a5c6 (patch)
treeaba568b85d38de4cfef90cd771169c9422aef09c /docs/manifest-format.txt
parent835cd6888f16ff30a3428adfa3a775efad918880 (diff)
downloadgit-repo-37282b4b9c5b1d9a1ff07f7f0686a81b65a0a5c6.tar.gz
Support repo-level pre-upload hook and prep for future hooks.v1.7.4
All repo-level hooks are expected to live in a single project at the top level of that project. The name of the hooks project is provided in the manifest.xml. The manifest also lists which hooks are enabled to make it obvious if a file somehow failed to sync down (or got deleted). Before running any hook, we will prompt the user to make sure that it is OK. A user can deny running the hook, allow once, or allow "forever" (until hooks change). This tries to keep with the git spirit of not automatically running anything on the user's computer that got synced down. Note that individual repo commands can add always options to avoid these prompts as they see fit (see below for the 'upload' options). When hooks are run, they are loaded into the current interpreter (the one running repo) and their main() function is run. This mechanism is used (instead of using subprocess) to make it easier to expand to a richer hook interface in the future. During loading, the interpreter's sys.path is updated to contain the directory containing the hooks so that hooks can be split into multiple files. The upload command has two options that control hook behavior: - no-verify=False, verify=False (DEFAULT): If stdout is a tty, can prompt about running upload hooks if needed. If user denies running hooks, the upload is cancelled. If stdout is not a tty and we would need to prompt about upload hooks, upload is cancelled. - no-verify=False, verify=True: Always run upload hooks with no prompt. - no-verify=True, verify=False: Never run upload hooks, but upload anyway (AKA bypass hooks). - no-verify=True, verify=True: Invalid Sample bit of manifest.xml code for enabling hooks (assumes you have a project named 'hooks' where hooks are stored): <repo-hooks in-project="hooks" enabled-list="pre-upload" /> Sample main() function in pre-upload.py in hooks directory: def main(project_list, **kwargs): print ('These projects will be uploaded: %s' % ', '.join(project_list)) print ('I am being a good boy and ignoring anything in kwargs\n' 'that I don\'t understand.') print 'I fail 50% of the time. How flaky.' if random.random() <= .5: raise Exception('Pre-upload hook failed. Have a nice day.') Change-Id: I5cefa2cd5865c72589263cf8e2f152a43c122f70
Diffstat (limited to 'docs/manifest-format.txt')
-rw-r--r--docs/manifest-format.txt7
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt
index 2e1c8c35..c76df801 100644
--- a/docs/manifest-format.txt
+++ b/docs/manifest-format.txt
@@ -25,7 +25,8 @@ following DTD:
25 default?, 25 default?,
26 manifest-server?, 26 manifest-server?,
27 remove-project*, 27 remove-project*,
28 project*)> 28 project*,
29 repo-hooks?)>
29 30
30 <!ELEMENT notice (#PCDATA)> 31 <!ELEMENT notice (#PCDATA)>
31 32
@@ -49,6 +50,10 @@ following DTD:
49 50
50 <!ELEMENT remove-project (EMPTY)> 51 <!ELEMENT remove-project (EMPTY)>
51 <!ATTLIST remove-project name CDATA #REQUIRED> 52 <!ATTLIST remove-project name CDATA #REQUIRED>
53
54 <!ELEMENT repo-hooks (EMPTY)>
55 <!ATTLIST repo-hooks in-project CDATA #REQUIRED>
56 <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED>
52 ]> 57 ]>
53 58
54A description of the elements and their attributes follows. 59A description of the elements and their attributes follows.