- # Be sure we won't loose results of stg-commit by error.
- # Note: checking for refs/bases should not be necessary with
- # repo format version 2, but better safe than sorry.
- branchname = crt_series.get_name()
- # references for anything but the current stack
- refs = [ref for ref in git.all_refs()
- if ref != 'refs/heads/'+branchname
- and ref != 'refs/bases/'+branchname
- and not re.match('^refs/patches/%s/'%branchname, ref)]
- stray_commits = git._output_lines(['git-rev-list',
- crt_series.get_base(),
- '--not'] + refs)
- if len(stray_commits) != 0:
- raise CmdException, 'Rebasing would make the following commits below the stack base unreachable: %s' % stray_commits
+ # 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'