elif patch_id == 'log':
return series.get_patch(patch).get_log()
if patch == 'base' and patch_id == None:
- return read_string(series.get_base_file())
+ return series.get_base()
except RevParseException:
pass
return git.rev_parse(rev + '^{commit}')
names = patches[forwarded:]
# check for patches merged upstream
- if check_merged:
+ if names and check_merged:
print 'Checking for patches merged upstream...',
sys.stdout.flush()
patchname = '%s-%d' % (patchname, suffix)
return patchname
-def prepare_rebase():
+def prepare_rebase(real_rebase, force=None):
+ if not force:
+ # Be sure we won't loose results of stg-(un)commit by error.
+ # Do not require an existing orig-base for compatibility with 0.12 and earlier.
+ origbase = crt_series._get_field('orig-base')
+ if origbase and crt_series.get_base() != origbase:
+ raise CmdException, 'Rebasing would possibly lose data'
+
# pop all patches
applied = crt_series.get_applied()
if len(applied) > 0:
git.reset(tree_id = git_id(target))
def post_rebase(applied, nopush, merged):
+ # memorize that we rebased to here
+ crt_series._set_field('orig-base', git.get_head())
# push the patches back
if not nopush:
push_patches(applied, merged)