1
1
#!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
2
4
- import click
5
3
import collections
6
4
import enum
7
5
import os
8
- import subprocess
9
- import webbrowser
10
6
import re
7
+ import subprocess
11
8
import sys
9
+ import webbrowser
10
+
11
+ import click
12
12
import requests
13
13
import toml
14
-
15
14
from gidgethub import sansio
16
15
17
16
from . import __version__
@@ -167,7 +166,7 @@ def get_pr_url(self, base_branch, head_branch):
167
166
return f"https://github.com/{ self .config ['team' ]} /{ self .config ['repo' ]} /compare/{ base_branch } ...{ self .username } :{ head_branch } ?expand=1"
168
167
169
168
def fetch_upstream (self ):
170
- """ git fetch <upstream> """
169
+ """git fetch <upstream>"""
171
170
set_state (WORKFLOW_STATES .FETCHING_UPSTREAM )
172
171
cmd = ["git" , "fetch" , self .upstream , "--no-tags" ]
173
172
self .run_cmd (cmd )
@@ -182,7 +181,7 @@ def run_cmd(self, cmd):
182
181
return output .decode ("utf-8" )
183
182
184
183
def checkout_branch (self , branch_name ):
185
- """ git checkout -b <branch_name> """
184
+ """git checkout -b <branch_name>"""
186
185
cmd = [
187
186
"git" ,
188
187
"checkout" ,
@@ -219,7 +218,7 @@ def get_commit_message(self, commit_sha):
219
218
return message
220
219
221
220
def checkout_default_branch (self ):
222
- """ git checkout default branch """
221
+ """git checkout default branch"""
223
222
set_state (WORKFLOW_STATES .CHECKING_OUT_DEFAULT_BRANCH )
224
223
225
224
cmd = "git" , "checkout" , self .config ["default_branch" ]
@@ -236,7 +235,7 @@ def status(self):
236
235
return self .run_cmd (cmd )
237
236
238
237
def cherry_pick (self ):
239
- """ git cherry-pick -x <commit_sha1> """
238
+ """git cherry-pick -x <commit_sha1>"""
240
239
cmd = ["git" , "cherry-pick" , "-x" , self .commit_sha1 ]
241
240
try :
242
241
click .echo (self .run_cmd (cmd ))
@@ -261,7 +260,7 @@ def get_exit_message(self, branch):
261
260
"""
262
261
263
262
def amend_commit_message (self , cherry_pick_branch ):
264
- """ prefix the commit message with (X.Y) """
263
+ """prefix the commit message with (X.Y)"""
265
264
266
265
commit_prefix = ""
267
266
if self .prefix_commit :
@@ -283,7 +282,7 @@ def amend_commit_message(self, cherry_pick_branch):
283
282
return updated_commit_message
284
283
285
284
def push_to_remote (self , base_branch , head_branch , commit_message = "" ):
286
- """ git push <origin> <branchname> """
285
+ """git push <origin> <branchname>"""
287
286
set_state (WORKFLOW_STATES .PUSHING_TO_REMOTE )
288
287
289
288
cmd = ["git" , "push" ]
@@ -607,7 +606,16 @@ class state:
607
606
@click .argument ("branches" , nargs = - 1 )
608
607
@click .pass_context
609
608
def cherry_pick_cli (
610
- ctx , dry_run , pr_remote , abort , status , push , auto_pr , config_path , commit_sha1 , branches
609
+ ctx ,
610
+ dry_run ,
611
+ pr_remote ,
612
+ abort ,
613
+ status ,
614
+ push ,
615
+ auto_pr ,
616
+ config_path ,
617
+ commit_sha1 ,
618
+ branches ,
611
619
):
612
620
"""cherry-pick COMMIT_SHA1 into target BRANCHES."""
613
621
0 commit comments