OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Repo lives in ~evanm/projects/git-try -- feel free to send patches. | |
4 | |
5 import getpass | 3 import getpass |
6 import optparse | 4 import optparse |
7 import os | 5 import os |
8 import subprocess | 6 import subprocess |
9 import tempfile | 7 import tempfile |
10 import traceback | 8 import traceback |
11 import urllib | 9 import urllib |
12 import sys | 10 import sys |
13 | 11 |
14 | 12 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 | 95 |
98 def GetEmail(): | 96 def GetEmail(): |
99 # TODO: check for errors here? | 97 # TODO: check for errors here? |
100 return Backquote(['git', 'config', 'user.email']) | 98 return Backquote(['git', 'config', 'user.email']) |
101 | 99 |
102 | 100 |
103 def TryChange(args): | 101 def TryChange(args): |
104 """Put a patch on the try server using SVN.""" | 102 """Put a patch on the try server using SVN.""" |
105 root_dir = Backquote(['git', 'rev-parse', '--show-cdup']) | 103 root_dir = Backquote(['git', 'rev-parse', '--show-cdup']) |
106 script_path = os.path.dirname(sys.argv[0]) | 104 script_path = os.path.dirname(sys.argv[0]) |
107 path = os.path.join(script_path, '..') | 105 sys.path.append(script_path) |
M-A Ruel
2009/08/24 15:38:17
All this stuff is not necessary anymore since both
| |
108 sys.path.append(path) | |
109 try: | 106 try: |
110 import trychange | 107 import trychange |
111 except ImportError, e: | 108 except ImportError, e: |
112 print "Error trying to import trychange from", path | 109 print "Error trying to import trychange from", script_path |
113 print "git-try expects to live at depot_tools/git-try-repo/git-try" | 110 print "git-try expects to live at depot_tools/git-try" |
114 raise e | 111 raise e |
115 trychange.checkout_root = os.path.abspath(root_dir) | 112 trychange.checkout_root = os.path.abspath(root_dir) |
116 trychange.TryChange(args, None, False) | 113 trychange.TryChange(args, None, False) |
117 | 114 |
118 | 115 |
119 def WriteTryDiffHTTP(config, patch_name, diff, options): | 116 def WriteTryDiffHTTP(config, patch_name, diff, options): |
120 """Put a patch on the try server.""" | 117 """Put a patch on the try server.""" |
121 params = { | 118 params = { |
122 'user': getpass.getuser(), | 119 'user': getpass.getuser(), |
123 'name': patch_name, | 120 'name': patch_name, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 if options.revision: | 195 if options.revision: |
199 args.extend(['-r', options.revision]) | 196 args.extend(['-r', options.revision]) |
200 else: | 197 else: |
201 args.extend(['-r', GetRevision()]) | 198 args.extend(['-r', GetRevision()]) |
202 if GetRietveldPatchsetNumber(): | 199 if GetRietveldPatchsetNumber(): |
203 args.extend([ | 200 args.extend([ |
204 '--issue', GetRietveldIssueNumber(), | 201 '--issue', GetRietveldIssueNumber(), |
205 '--patchset', GetRietveldPatchsetNumber(), | 202 '--patchset', GetRietveldPatchsetNumber(), |
206 ]) | 203 ]) |
207 TryChange(args=args) | 204 TryChange(args=args) |
OLD | NEW |