diff options
author | James W. Mills <jameswmills@gmail.com> | 2012-04-12 15:04:13 -0500 |
---|---|---|
committer | Shawn O. Pearce <sop@google.com> | 2012-04-23 12:35:08 -0700 |
commit | 24c130884018364f91baa8de0ff3541f4c32d1bb (patch) | |
tree | 213b269d05e2a5f2b70d895325301a9a9f30e4a2 /project.py | |
parent | b962a1f5e0daad323bdd66fad93f00a3738cc255 (diff) | |
download | git-repo-24c130884018364f91baa8de0ff3541f4c32d1bb.tar.gz |
Add project annotation handling to repo
Allow the optional addition of "annotation" nodes nested under
projects. Each annotation node must have "name" and "value"
attributes. These name/value pairs will be exported into the
environment during any forall command, prefixed with "REPO__"
In addition, an optional "keep" attribute with case insensitive "true"
or "false" values can be included to determine whether the annotation
will be exported with 'repo manifest'
Change-Id: Icd7540afaae02c958f769ce3d25661aa721a9de8
Signed-off-by: James W. Mills <jameswmills@gmail.com>
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -213,6 +213,11 @@ class DiffColoring(Coloring): | |||
213 | Coloring.__init__(self, config, 'diff') | 213 | Coloring.__init__(self, config, 'diff') |
214 | self.project = self.printer('header', attr = 'bold') | 214 | self.project = self.printer('header', attr = 'bold') |
215 | 215 | ||
216 | class _Annotation: | ||
217 | def __init__(self, name, value, keep): | ||
218 | self.name = name | ||
219 | self.value = value | ||
220 | self.keep = keep | ||
216 | 221 | ||
217 | class _CopyFile: | 222 | class _CopyFile: |
218 | def __init__(self, src, dest, abssrc, absdest): | 223 | def __init__(self, src, dest, abssrc, absdest): |
@@ -529,6 +534,7 @@ class Project(object): | |||
529 | 534 | ||
530 | self.snapshots = {} | 535 | self.snapshots = {} |
531 | self.copyfiles = [] | 536 | self.copyfiles = [] |
537 | self.annotations = [] | ||
532 | self.config = GitConfig.ForRepository( | 538 | self.config = GitConfig.ForRepository( |
533 | gitdir = self.gitdir, | 539 | gitdir = self.gitdir, |
534 | defaults = self.manifest.globalConfig) | 540 | defaults = self.manifest.globalConfig) |
@@ -1175,6 +1181,9 @@ class Project(object): | |||
1175 | abssrc = os.path.join(self.worktree, src) | 1181 | abssrc = os.path.join(self.worktree, src) |
1176 | self.copyfiles.append(_CopyFile(src, dest, abssrc, absdest)) | 1182 | self.copyfiles.append(_CopyFile(src, dest, abssrc, absdest)) |
1177 | 1183 | ||
1184 | def AddAnnotation(self, name, value, keep): | ||
1185 | self.annotations.append(_Annotation(name, value, keep)) | ||
1186 | |||
1178 | def DownloadPatchSet(self, change_id, patch_id): | 1187 | def DownloadPatchSet(self, change_id, patch_id): |
1179 | """Download a single patch set of a single change to FETCH_HEAD. | 1188 | """Download a single patch set of a single change to FETCH_HEAD. |
1180 | """ | 1189 | """ |