Add git cl web command to open the current issue in the web browser.

R=maruel@chromium.org

Review URL: https://codereview.chromium.org/92533002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@238220 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cl.py b/git_cl.py
index 90b0542..bad3e65 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -21,6 +21,7 @@
 import threading
 import urllib2
 import urlparse
+import webbrowser
 
 try:
   import readline  # pylint: disable=F0401,W0611
@@ -2133,7 +2134,6 @@
   _, args = parser.parse_args(args)
   if len(args) > 1:
     parser.error('Unrecognized args: %s' % ' '.join(args))
-    return 0
 
   cl = Changelist()
   if args:
@@ -2146,6 +2146,21 @@
   return 0
 
 
+def CMDweb(parser, args):
+  """Opens the current CL in the web browser."""
+  _, args = parser.parse_args(args)
+  if args:
+    parser.error('Unrecognized args: %s' % ' '.join(args))
+
+  issue_url = Changelist().GetIssueURL()
+  if not issue_url:
+    print >> sys.stderr, 'ERROR No issue to open'
+    return 1
+
+  webbrowser.open(issue_url)
+  return 0
+
+
 def CMDset_commit(parser, args):
   """Sets the commit bit to trigger the Commit Queue."""
   _, args = parser.parse_args(args)