- if os.path.isdir(to_stack.__patch_dir):
- raise StackException, '"%s" already exists' % to_stack.__patch_dir
- if os.path.isfile(to_stack.__base_file):
- raise StackException, '"%s" already exists' % to_stack.__base_file
+
+ if to_stack.is_initialised():
+ raise StackException, '"%s" already exists' % to_stack.get_branch()
+ if os.path.exists(to_stack.__base_file):
+ os.remove(to_stack.__base_file)