You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
depot_tools/git-try

54 lines
1.4 KiB
Plaintext

#!/usr/bin/python
# Copyright (c) 2010 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
import breakpad
from scm import GIT
import trychange
def GetRietveldIssueNumber():
return GIT.Capture(
['config', 'branch.%s.rietveldissue' % GIT.GetBranch(None)],
error_ok=True)[0]
def GetRietveldPatchsetNumber():
return GIT.Capture(
['config', 'branch.%s.rietveldpatchset' % GIT.GetBranch(None)],
error_ok=True)[0]
def GetRietveldServerUrl():
return GIT.Capture(
['config', 'rietveld.server'], error_ok=True)[0].strip()
if __name__ == '__main__':
args = sys.argv[:]
patchset = GetRietveldPatchsetNumber()
if patchset:
args.extend([
'--issue', GetRietveldIssueNumber(),
'--patchset', patchset,
])
else:
rietveld_url = GetRietveldServerUrl()
if rietveld_url:
args.extend(['--rietveld_url', GetRietveldServerUrl()])
# Hack around a limitation in logging.
logging.getLogger().handlers = []
sys.exit(trychange.TryChange(
args, file_list=[], 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'))