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

51 lines
1.2 KiB
Python

#!/usr/bin/python
# Copyright (c) 2009 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
try:
import breakpad
except ImportError:
pass
from scm import GIT
import trychange
def GetRietveldIssueNumber():
return GIT.Capture(
['config', 'branch.%s.rietveldissue' % GIT.GetBranch(None)],
error_ok=True)
def GetRietveldPatchsetNumber():
return GIT.Capture(
['config', 'branch.%s.rietveldpatchset' % GIT.GetBranch(None)],
error_ok=True)
def GetRietveldServerUrl():
return GIT.Capture(
['config', 'rietveld.server'], error_ok=True).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, [], False, 'git-try'))