diff options
Diffstat (limited to 'subcmds')
-rw-r--r-- | subcmds/download.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/subcmds/download.py b/subcmds/download.py index badd9ab3..723124fd 100644 --- a/subcmds/download.py +++ b/subcmds/download.py | |||
@@ -37,6 +37,8 @@ If no project is specified try to use current directory as a project. | |||
37 | """ | 37 | """ |
38 | 38 | ||
39 | def _Options(self, p): | 39 | def _Options(self, p): |
40 | p.add_option('-b', '--branch', | ||
41 | help='create a new branch first') | ||
40 | p.add_option('-c', '--cherry-pick', | 42 | p.add_option('-c', '--cherry-pick', |
41 | dest='cherrypick', action='store_true', | 43 | dest='cherrypick', action='store_true', |
42 | help="cherry-pick instead of checkout") | 44 | help="cherry-pick instead of checkout") |
@@ -119,6 +121,11 @@ If no project is specified try to use current directory as a project. | |||
119 | else: | 121 | else: |
120 | mode = 'checkout' | 122 | mode = 'checkout' |
121 | 123 | ||
124 | # We'll combine the branch+checkout operation, but all the rest need a | ||
125 | # dedicated branch start. | ||
126 | if opt.branch and mode != 'checkout': | ||
127 | project.StartBranch(opt.branch) | ||
128 | |||
122 | try: | 129 | try: |
123 | if opt.cherrypick: | 130 | if opt.cherrypick: |
124 | project._CherryPick(dl.commit, ffonly=opt.ffonly, | 131 | project._CherryPick(dl.commit, ffonly=opt.ffonly, |
@@ -128,7 +135,10 @@ If no project is specified try to use current directory as a project. | |||
128 | elif opt.ffonly: | 135 | elif opt.ffonly: |
129 | project._FastForward(dl.commit, ffonly=True) | 136 | project._FastForward(dl.commit, ffonly=True) |
130 | else: | 137 | else: |
131 | project._Checkout(dl.commit) | 138 | if opt.branch: |
139 | project.StartBranch(opt.branch, revision=dl.commit) | ||
140 | else: | ||
141 | project._Checkout(dl.commit) | ||
132 | 142 | ||
133 | except GitError: | 143 | except GitError: |
134 | print('[%s] Could not complete the %s of %s' | 144 | print('[%s] Could not complete the %s of %s' |