for addr in addr_str.split(',')]
return ', '.join([addr for addr in addr_list if addr])
-def prepare_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'
-
+def prepare_rebase():
# pop all patches
applied = crt_series.get_applied()
if len(applied) > 0:
action = 'store_true'),
make_option('-m', '--merged',
help = 'check for patches merged upstream',
- action = 'store_true'),
- make_option('--force',
- help = 'force rebase even if the stack based was moved by (un)commits',
action = 'store_true')]
def func(parser, options, args):
if policy not in ['pull', 'fetch-rebase', 'rebase']:
raise GitConfigException, 'Unsupported pull-policy "%s"' % policy
- applied = prepare_rebase(force=options.force)
+ applied = prepare_rebase()
# pull the remote changes
if policy == 'pull':
action = 'store_true'),
make_option('-m', '--merged',
help = 'check for patches merged upstream',
- action = 'store_true'),
- make_option('--force',
- help = 'force rebase even if the stack based was moved by (un)commits',
action = 'store_true')]
def func(parser, options, args):
if git_id(args[0]) == None:
raise GitException, 'Unknown revision: %s' % args[0]
- applied = prepare_rebase(force=options.force)
+ applied = prepare_rebase()
rebase(args[0])
post_rebase(applied, options.nopush, options.merged)
self.create_empty_field('applied')
self.create_empty_field('unapplied')
- self._set_field('orig-base', git.get_head())
config.set(self.format_version_key(), str(FORMAT_VERSION))
test `wc -l <clone/file2` = 3
'
-# this one exercises the guard against commits
-# (use a new file to avoid mistaking a conflict for a success)
-test_expect_success \
- 'New upstream commit and commit a patch in clone' \
- '
- (cd upstream && stg new u2 -m u2 &&
- echo a > file3 && stg add file3 && stg refresh) &&
- (cd clone && stg commit && stg new c2 -m c2 &&
- echo a >> file && stg refresh)
- '
-test_expect_success \
- 'Try to and commit a patch in clone' \
- '(cd clone && ! stg pull)'
-
test_done
test `wc -l <file2` = 2
'
-# this one exercises the guard against commits
-# (use a new file to avoid mistaking a conflict for a success)
-test_expect_success \
- 'New commit in parent and commit a patch in stack' \
- '
- stg branch parent && stg new u2 -m u2 &&
- echo c > file3 && stg add file3 && stg refresh &&
- stg branch stack && stg commit && stg new c2 -m c2 &&
- echo a >> file && stg refresh
- '
-test_expect_success \
- 'Try to pull/rebase now that stack base has moved' \
- '! stg pull'
-
-test_expect_success \
- 'Force the pull/rebase, but do not push yet' \
- 'stg pull --force --nopush'
-test_expect_success \
- '...check we lost the committed patch' \
- '! test -e file'
-test_expect_success \
- '...and check we get a conflict while pushing' \
- '! stg push'
-
test_done