|
4 | 4 |
|
5 | 5 |
|
6 | 6 | class Checkout(SubCommand): |
7 | | - '''Switch to another branch''' |
| 7 | + """Switch to another branch""" |
| 8 | + |
8 | 9 | @staticmethod |
9 | 10 | def add_args(parser): |
10 | 11 | parser.add_argument( |
11 | | - '--skip-errors', action='store_true', default=False, |
12 | | - help='Skip failed objects and continue', |
13 | | - ) |
14 | | - parser.add_argument( |
15 | | - '--dry-run', action='store_true', default=False, |
16 | | - help='Only check for conflicts and roll back at the end.', |
| 12 | + "--skip-errors", |
| 13 | + action="store_true", |
| 14 | + default=False, |
| 15 | + help="Skip failed objects and continue", |
17 | 16 | ) |
18 | 17 | parser.add_argument( |
19 | | - '-b', action='store_true', default=False, |
20 | | - help='Create branch.', |
| 18 | + "--dry-run", |
| 19 | + action="store_true", |
| 20 | + default=False, |
| 21 | + help="Only check for conflicts and roll back at the end.", |
21 | 22 | ) |
22 | 23 | parser.add_argument( |
23 | | - '-t', '--track', type=str, help='Set up upstream configuration.' |
| 24 | + "-b", |
| 25 | + action="store_true", |
| 26 | + default=False, |
| 27 | + help="Create branch.", |
24 | 28 | ) |
25 | 29 | parser.add_argument( |
26 | | - '--reset', type=str, |
27 | | - help='Reset branch onto given commit.', |
| 30 | + "-t", "--track", type=str, help="Set up upstream configuration." |
28 | 31 | ) |
29 | 32 | parser.add_argument( |
30 | | - '--rebase', type=str, |
31 | | - help='Rebase branch onto given commit.', |
| 33 | + "--reset", |
| 34 | + type=str, |
| 35 | + help="Reset branch onto given commit.", |
32 | 36 | ) |
33 | 37 | parser.add_argument( |
34 | | - 'branch', type=str, |
35 | | - help='''Branch name''' |
| 38 | + "--rebase", |
| 39 | + type=str, |
| 40 | + help="Rebase branch onto given commit.", |
36 | 41 | ) |
| 42 | + parser.add_argument("branch", type=str, help="""Branch name""") |
37 | 43 |
|
38 | 44 | @SubCommand.gitexec |
39 | 45 | def run(self): |
40 | | - self.logger.info('Checking out %s.' % self.args.branch) |
41 | | - cmd = ['checkout'] |
| 46 | + self.logger.info("Checking out %s." % self.args.branch) |
| 47 | + cmd = ["checkout"] |
42 | 48 | if self.args.b: |
43 | | - cmd.append('-b') |
| 49 | + cmd.append("-b") |
44 | 50 | cmd.append(self.args.branch) |
45 | 51 | if self.args.b and self.args.track: |
46 | | - cmd.extend(['--track', self.args.track]) |
| 52 | + cmd.extend(["--track", self.args.track]) |
47 | 53 | self.gitcmd_run(*cmd) |
48 | 54 | if self.args.reset: |
49 | | - self.gitcmd_run('reset', '--hard', self.args.reset) |
| 55 | + self.gitcmd_run("reset", "--hard", self.args.reset) |
50 | 56 | if self.args.rebase: |
51 | | - self.gitcmd_run('rebase', self.args.rebase) |
| 57 | + self.gitcmd_run("rebase", self.args.rebase) |
0 commit comments