def func(parser, options, args):
"""Pull the changes from a remote repository
"""
- if len(args) > 1:
- parser.error('incorrect number of arguments')
+ policy = config.get('branch.%s.stgit.pull-policy' % crt_series.get_branch()) or \
+ config.get('stgit.pull-policy')
+
+ if policy == 'rebase':
+ # parent is local
+ if len(args) == 1:
+ parser.error('specifying a repository is meaningless for policy="%s"' % policy)
+ if len(args) > 0:
+ parser.error('incorrect number of arguments')
- if len(args) >= 1:
- repository = args[0]
else:
- repository = crt_series.get_parent_remote()
+ # parent is remote
+ if len(args) > 1:
+ parser.error('incorrect number of arguments')
+
+ if len(args) >= 1:
+ repository = args[0]
+ else:
+ repository = crt_series.get_parent_remote()
if crt_series.get_protected():
raise CmdException, 'This branch is protected. Pulls are not permitted'
check_conflicts()
check_head_top_equal()
- policy = config.get('branch.%s.stgit.pull-policy' % crt_series.get_branch()) or \
- config.get('stgit.pull-policy')
if policy == 'pull':
must_rebase = 0
elif policy == 'fetch-rebase':
config.set('branch.%s.stgit.parentbranch' % self.__name, name)
def set_parent(self, remote, localbranch):
- # policy: record local branches as remote='.'
- recordremote = remote or '.'
if localbranch:
- self.__set_parent_remote(recordremote)
+ self.__set_parent_remote(remote)
self.__set_parent_branch(localbranch)
# We'll enforce this later
# else: