from stgit.out import *
from stgit import stack, git, basedir
from stgit.config import config, file_extensions
+from stgit.run import *
crt_series = None
class CmdException(Exception):
pass
+class CmdRunException(CmdException):
+ pass
+class CmdRun(Run):
+ exc = CmdRunException
# Utility functions
class RevParseException(Exception):
if target == git.get_head():
out.info('Already at "%s", no need for rebasing.' % target)
return
- out.start('Rebasing to "%s"' % target)
- git.reset(tree_id = git_id(target))
+ command = config.get('branch.%s.stgit.rebasecmd' % git.get_head_file()) \
+ or config.get('stgit.rebasecmd')
+ if target:
+ args = [target]
+ out.start('Rebasing to "%s"' % target)
+ elif command:
+ args = []
+ out.start('Rebasing to the default target')
+ else:
+ raise CmdException, 'Default rebasing requires a target'
+ if command:
+ CmdRun(*(command.split() + args)).run()
+ else:
+ git.reset(tree_id = git_id(target))
out.done()
def post_rebase(applied, nopush, merged):