-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-try
executable file
·47 lines (36 loc) · 1.18 KB
/
git-try
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/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, [], False, 'git-try'))