[PATCH 2/5] Move stack-base querying into Series class.
Signed-off-by: Yann Dirson <ydirson@altern.org>
---
stgit/commands/common.py | 2 +-
stgit/stack.py | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/stgit/commands/common.py b/stgit/commands/common.py
index a352d89..240d003 100644
--- a/stgit/commands/common.py
+++ b/stgit/commands/common.py
@@ -101,7 +101,7 @@ def git_id(rev):
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}')
diff --git a/stgit/stack.py b/stgit/stack.py
index 3632aa1..dc6caa6 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -394,6 +394,9 @@ class Series(StgitObject):
self.__begin_stack_check()
return self.__base_file
+ def get_base(self):
+ return read_string(self.get_base_file())
+
def get_protected(self):
return os.path.isfile(os.path.join(self._dir(), 'protected'))
@@ -609,7 +612,7 @@ class Series(StgitObject):
"""
try:
# allow cloning of branches not under StGIT control
- base = read_string(self.get_base_file())
+ base = self.get_base()
except:
base = git.get_head()
Series(target_series).init(create_at = base)