Chromium Code Reviews| Index: git_cl.py |
| diff --git a/git_cl.py b/git_cl.py |
| index 7a9bff92d10e9ff14eb0b16983b0550aa00c939c..bdc57a57a66e55360acefaae863a64d7004c1ab2 100755 |
| --- a/git_cl.py |
| +++ b/git_cl.py |
| @@ -1864,6 +1864,9 @@ def CMDpatch(parser, args): |
| help='create a new branch off trunk for the patch') |
| parser.add_option('-f', action='store_true', dest='force', |
| help='with -b, clobber any existing branch') |
| + parser.add_option('-d', '--directory', action='store', dest='directory', |
|
M-A Ruel
2013/10/16 16:10:12
Remove dest argument. While at it, remove it on 'r
qsr
2013/10/16 16:16:53
Done.
|
| + help='Change to the directory DIRECTORY immediately, ' |
| + 'before doing anything else.') |
| parser.add_option('--reject', action='store_true', dest='reject', |
| help='failed patches spew .rej files rather than ' |
| 'attempting a 3-way merge') |
| @@ -1885,10 +1888,11 @@ def CMDpatch(parser, args): |
| RunGit(['checkout', '-b', options.newbranch, |
| Changelist().GetUpstreamBranch()]) |
| - return PatchIssue(issue_arg, options.reject, options.nocommit) |
| + return PatchIssue(issue_arg, options.reject, options.nocommit, |
| + options.directory) |
| -def PatchIssue(issue_arg, reject, nocommit): |
| +def PatchIssue(issue_arg, reject, nocommit, directory): |
| if type(issue_arg) is int or issue_arg.isdigit(): |
| # Input is an issue id. Figure out the URL. |
| issue = int(issue_arg) |
| @@ -1930,6 +1934,9 @@ def PatchIssue(issue_arg, reject, nocommit): |
| # pick up file adds. |
| # The --index flag means: also insert into the index (so we catch adds). |
| cmd = ['git', 'apply', '--index', '-p0'] |
| + if directory: |
| + cmd.append('--directory') |
|
M-A Ruel
2013/10/16 16:10:12
cmd.extend(('--directory', directory))
qsr
2013/10/16 16:16:53
Done.
|
| + cmd.append(directory) |
| if reject: |
| cmd.append('--reject') |
| elif IsGitVersionAtLeast('1.7.12'): |
| @@ -2160,7 +2167,7 @@ def CMDdiff(parser, args): |
| RunGit(['checkout', '-q', '-b', TMP_BRANCH, base_branch]) |
| try: |
| # Patch in the latest changes from rietveld. |
| - rtn = PatchIssue(cl.GetIssue(), False, False) |
| + rtn = PatchIssue(cl.GetIssue(), False, False, None) |
| if rtn != 0: |
| return rtn |