Sha256: e7e3e1fd3e1cc5788ec3126bb9c1b24c93c41906c6408fa29501fb4afe32b262

Contents?: true

Size: 1.99 KB

Versions: 8

Compression:

Stored size: 1.99 KB

Contents

#!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Wrapper for trychange.py for git checkout."""

import logging
import sys

from scm import GIT
import subprocess2
import third_party.upload
import trychange
import git_cl


def GetRietveldIssueNumber():
  try:
    return GIT.Capture(
        ['config', 'branch.%s.rietveldissue' % GIT.GetBranch('.')],
        '.').strip()
  except subprocess2.CalledProcessError:
    return None


def GetRietveldPatchsetNumber():
  try:
    return GIT.Capture(
        ['config', 'branch.%s.rietveldpatchset' % GIT.GetBranch('.')],
        '.').strip()
  except subprocess2.CalledProcessError:
    return None


def GetRietveldServerUrl():
  try:
    return GIT.Capture(['config', 'rietveld.server'], '.').strip()
  except subprocess2.CalledProcessError:
    return None


def main(args):
  patchset = GetRietveldPatchsetNumber()
  if patchset:
    args.extend([
        '--issue', GetRietveldIssueNumber(),
        '--patchset', patchset,
    ])
  else:
    rietveld_url = GetRietveldServerUrl()
    if rietveld_url:
      args.extend(['--rietveld_url', GetRietveldServerUrl()])
  try:
    cl = git_cl.Changelist()
    change = cl.GetChange(cl.GetUpstreamBranch(), None)
    # Hack around a limitation in logging.
    logging.getLogger().handlers = []
    sys.exit(trychange.TryChange(
        args, change, swallow_exception=False,
        prog='git try',
        extra_epilog='\n'
                     'git try will diff against your tracked branch and will '
                     'detect your rietveld\n'
                     'code review if you are using git-cl\n'))
  except third_party.upload.ClientLoginError, e:
    print('Got an exception while trying to log in to Rietveld.')
    print(str(e))
  return 0


if __name__ == '__main__':
  try:
    sys.exit(main(sys.argv[1:]))
  except KeyboardInterrupt:
    sys.stderr.write('interrupted\n')
    sys.exit(1)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
libv8-5.2.361.43.1 vendor/depot_tools/git_try.py
libv8-5.2.361.43.0 vendor/depot_tools/git_try.py
libv8-5.1.281.59.1 vendor/depot_tools/git_try.py
libv8-5.1.281.59.0 vendor/depot_tools/git_try.py
libv8-5.1.281.59.0beta3 vendor/depot_tools/git_try.py
libv8-5.0.71.48.3 vendor/depot_tools/git_try.py
libv8-5.0.71.48.2 vendor/depot_tools/git_try.py
libv8-5.0.71.48.0beta2 vendor/depot_tools/git_try.py