"""
return os.path.isdir(self.__patch_dir)
- def init(self):
+ def init(self, create_at=False):
"""Initialises the stgit series
"""
bases_dir = os.path.join(self.__base_dir, 'refs', 'bases')
- if self.is_initialised():
+ if os.path.exists(self.__patch_dir):
raise StackException, self.__patch_dir + ' already exists'
+ if os.path.exists(self.__refs_dir):
+ raise StackException, self.__refs_dir + ' already exists'
+ if os.path.exists(self.__base_file):
+ raise StackException, self.__base_file + ' already exists'
+
+ if (create_at!=False):
+ git.create_branch(self.__name, create_at)
+
os.makedirs(self.__patch_dir)
if not os.path.isdir(bases_dir):
os.rename(self.__series_dir, to_stack.__series_dir)
if os.path.exists(self.__base_file):
os.rename(self.__base_file, to_stack.__base_file)
+ if os.path.exists(self.__refs_dir):
+ os.rename(self.__refs_dir, to_stack.__refs_dir)
self.__init__(to_name)
"""Clones a series
"""
base = read_string(self.get_base_file())
- git.create_branch(target_series, tree_id = base)
- Series(target_series).init()
+ Series(target_series).init(create_at = base)
new_series = Series(target_series)
# generate an artificial description file