Title: [114120] trunk/Tools
Revision
114120
Author
jocelyn.turco...@nokia.com
Date
2012-04-13 06:01:51 -0700 (Fri, 13 Apr 2012)

Log Message

webkit-tools-completion: Support bugzilla email completion for webkit-patch upload --cc
https://bugs.webkit.org/show_bug.cgi?id=83690

Reviewed by Tor Arne Vestbø.

Typing part of an email and pressing <TAB> will bash-complete it using the list in
Tools/Scripts/webkitpy/common/config/committers.py

* Scripts/webkit-tools-completion.sh:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (114119 => 114120)


--- trunk/Tools/ChangeLog	2012-04-13 12:57:53 UTC (rev 114119)
+++ trunk/Tools/ChangeLog	2012-04-13 13:01:51 UTC (rev 114120)
@@ -1,3 +1,15 @@
+2012-04-11  Jocelyn Turcotte  <jocelyn.turco...@nokia.com>
+
+        webkit-tools-completion: Support bugzilla email completion for webkit-patch upload --cc
+        https://bugs.webkit.org/show_bug.cgi?id=83690
+
+        Reviewed by Tor Arne Vestbø.
+
+        Typing part of an email and pressing <TAB> will bash-complete it using the list in
+        Tools/Scripts/webkitpy/common/config/committers.py
+
+        * Scripts/webkit-tools-completion.sh:
+
 2012-04-13  Thiago Marcos P. Santos  <thiago.san...@intel.com>
 
         [EFL] Add API for color chooser

Modified: trunk/Tools/Scripts/webkit-tools-completion.sh (114119 => 114120)


--- trunk/Tools/Scripts/webkit-tools-completion.sh	2012-04-13 12:57:53 UTC (rev 114119)
+++ trunk/Tools/Scripts/webkit-tools-completion.sh	2012-04-13 13:01:51 UTC (rev 114120)
@@ -37,6 +37,20 @@
     COMPREPLY=( $(compgen -W "$1" -- "${COMP_WORDS[COMP_CWORD]}") )
 }
 
+__webkit-patch_upload_cc_generate_reply()
+{
+    # Completion is done on tokens and our comma-separated list is one single token, so we have to do completion on the whole list each time.
+    # Return a \n separated list for each possible bugzilla email completion of the substring following the last comma.
+    # Redirect strerr to /dev/null to prevent noise in the shell if this ever breaks somehow.
+    COMPREPLY=( $(PYTHONPATH=$(dirname "${BASH_SOURCE[0]}") python -c "
+import sys,re
+from webkitpy.common.config.committers import CommitterList
+m = re.match('((.*,)*)(.*)', sys.argv[1])
+untilLastComma = m.group(1)
+afterLastComma = m.group(3)
+print('\n'.join([untilLastComma + c.bugzilla_email() + ',' for c in CommitterList().contributors() if c.bugzilla_email().startswith(afterLastComma)]))" "${COMP_WORDS[COMP_CWORD]}" 2>/dev/null ) )
+}
+
 _webkit-patch_complete()
 {
     local command current_command="${COMP_WORDS[1]}"
@@ -78,6 +92,10 @@
             return
             ;;
         upload)
+            if [[ ${COMP_WORDS[COMP_CWORD-1]} == "--cc" || ${COMP_WORDS[COMP_CWORD-1]} == "=" && ${COMP_WORDS[COMP_CWORD-2]} == "--cc" ]]; then
+                __webkit-patch_upload_cc_generate_reply
+                return
+            fi
             __webkit-patch_generate_reply "--description --no-obsolete --no-review --request-commit --cc -m --open-bug"
             return
             ;;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to