#pullcmd = git-pull
#fetchcmd = git-fetch
+ # Rebase command. Note that this command is internally implemented in
+ # a different way. Only define this option if a different rebase
+ # is needed (i.e. 'git svn rebase')
+ #rebasecmd = git-reset
+
# "stg pull" policy. This is the repository default, which can be
# overriden on a per-branch basis using branch.*.stgit.pull-policy
# By default:
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):