|
@@ -37,6 +37,8 @@ If no project is specified try to use current directory as a project.
|
|
|
"""
|
|
"""
|
|
|
|
|
|
|
|
def _Options(self, p):
|
|
def _Options(self, p):
|
|
|
|
|
+ p.add_option('-b', '--branch',
|
|
|
|
|
+ help='create a new branch first')
|
|
|
p.add_option('-c', '--cherry-pick',
|
|
p.add_option('-c', '--cherry-pick',
|
|
|
dest='cherrypick', action='store_true',
|
|
dest='cherrypick', action='store_true',
|
|
|
help="cherry-pick instead of checkout")
|
|
help="cherry-pick instead of checkout")
|
|
@@ -119,6 +121,11 @@ If no project is specified try to use current directory as a project.
|
|
|
else:
|
|
else:
|
|
|
mode = 'checkout'
|
|
mode = 'checkout'
|
|
|
|
|
|
|
|
|
|
+ # We'll combine the branch+checkout operation, but all the rest need a
|
|
|
|
|
+ # dedicated branch start.
|
|
|
|
|
+ if opt.branch and mode != 'checkout':
|
|
|
|
|
+ project.StartBranch(opt.branch)
|
|
|
|
|
+
|
|
|
try:
|
|
try:
|
|
|
if opt.cherrypick:
|
|
if opt.cherrypick:
|
|
|
project._CherryPick(dl.commit, ffonly=opt.ffonly,
|
|
project._CherryPick(dl.commit, ffonly=opt.ffonly,
|
|
@@ -128,7 +135,10 @@ If no project is specified try to use current directory as a project.
|
|
|
elif opt.ffonly:
|
|
elif opt.ffonly:
|
|
|
project._FastForward(dl.commit, ffonly=True)
|
|
project._FastForward(dl.commit, ffonly=True)
|
|
|
else:
|
|
else:
|
|
|
- project._Checkout(dl.commit)
|
|
|
|
|
|
|
+ if opt.branch:
|
|
|
|
|
+ project.StartBranch(opt.branch, revision=dl.commit)
|
|
|
|
|
+ else:
|
|
|
|
|
+ project._Checkout(dl.commit)
|
|
|
|
|
|
|
|
except GitError:
|
|
except GitError:
|
|
|
print('[%s] Could not complete the %s of %s'
|
|
print('[%s] Could not complete the %s of %s'
|