[sysadmin-bin] gnome-post-receive-email: graft in notes email
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] gnome-post-receive-email: graft in notes email
- Date: Thu, 6 Feb 2014 21:54:56 +0000 (UTC)
commit 96e2bf63b159ff498bfd0f7f3409e7b32227fb83
Author: Ray Strode <rstrode redhat com>
Date: Thu Feb 6 16:51:09 2014 -0500
gnome-post-receive-email: graft in notes email
Try to give primitive support for handling new notes getting added,
removed and updated.
git/gnome-post-receive-email | 60 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/git/gnome-post-receive-email b/git/gnome-post-receive-email
index 3cf256b..af83ded 100755
--- a/git/gnome-post-receive-email
+++ b/git/gnome-post-receive-email
@@ -763,6 +763,56 @@ This is unexpected because:
# ========================
+class NotesChange(RefChange):
+ def __init__(self, *args):
+ RefChange.__init__(self, *args)
+
+class NotesCreation(NotesChange):
+ def get_subject(self):
+ return "Created " + self.short_refname + " note"
+
+ def generate_body(self, out):
+ print >>out, s("""
+The note '%(short_refname)s' was created.
+
+%(commit_oneline)s
+""") % {
+ 'short_refname': self.short_refname,
+ 'commit_oneline': commit_oneline(self.newrev)
+ }
+
+class NotesDeletion(NotesChange):
+ def get_subject(self):
+ return "Deleted " + self.short_refname + " note"
+
+ def generate_body(self, out):
+ print >>out, s("""
+The note '%(short_refname)s' was deleted.
+""") % {
+ 'short_refname': self.short_refname,
+ }
+
+class NotesUpdate(NotesChange):
+ def get_subject(self):
+ return "Updated " + self.short_refname + " note"
+
+ def generate_body(self, out):
+ print >>out, s("""
+The note '%(short_refname)s' was updated from:
+
+ %(old_commit)s
+
+To:
+
+ %(new_commit)s
+""") % {
+ 'short_refname': self.short_refname,
+ 'old_commit': commit_oneline(self.oldrev),
+ 'new_commit': commit_oneline(self.newrev),
+ }
+
+# ========================
+
def make_change(oldrev, newrev, refname):
refname = refname
@@ -840,6 +890,16 @@ def make_change(oldrev, newrev, refname):
return make(BranchUpdate)
else:
return make_misc_change("%s is not a commit object" % target)
+ elif re.match(r'^refs/notes/.*$', refname):
+ if object_type == 'commit':
+ if change_type == CREATE:
+ return make(NotesCreation)
+ elif change_type == DELETE:
+ return make(NotesDeletion)
+ else:
+ return make(NotesUpdate)
+ else:
+ return make_misc_change("%s is not a commit object" % target)
elif re.match(r'^refs/remotes/.*$', refname):
return make_misc_change("'%s' is a tracking branch and doesn't belong on the server" % refname)
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]