From f72ad3d613850b9cb831d98e2eff96e0a0fa3402 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Fri, 2 Feb 2007 17:18:40 +0000 Subject: [PATCH] Do not return 'origin' as parent remote when there is no such remote. Signed-off-by: Yann Dirson --- stgit/stack.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/stgit/stack.py b/stgit/stack.py index f57e4f0..3960729 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -414,7 +414,15 @@ class Series(StgitObject): self._set_field('description', line) def get_parent_remote(self): - return config.get('branch.%s.remote' % self.__name) or 'origin' + value = config.get('branch.%s.remote' % self.__name) + if value: + return value + elif 'origin' in git.remotes_list(): + # FIXME: this is for compatibility only. Should be + # dropped when all relevant commands record this info. + return 'origin' + else: + raise StackException, 'Cannot find a parent remote for "%s"' % self.__name def __set_parent_remote(self, remote): value = config.set('branch.%s.remote' % self.__name, remote) @@ -424,6 +432,8 @@ class Series(StgitObject): if value: return value elif git.rev_parse('heads/origin'): + # FIXME: this is for compatibility only. Should be + # dropped when all relevant commands record this info. return 'heads/origin' else: raise StackException, 'Cannot find a parent branch for "%s"' % self.__name -- 2.11.0