~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Regression test for "stg import"
[stgit]
/
stgit
/
stack.py
diff --git
a/stgit/stack.py
b/stgit/stack.py
index
e50f189
..
a477e7d
100644
(file)
--- a/
stgit/stack.py
+++ b/
stgit/stack.py
@@
-332,6
+332,11
@@
class Series:
for patch in self.get_applied() + self.get_unapplied():
self.get_patch(patch).update_top_ref()
for patch in self.get_applied() + self.get_unapplied():
self.get_patch(patch).update_top_ref()
+ # trash directory
+ self.__trash_dir = os.path.join(self.__series_dir, 'trash')
+ if self.is_initialised() and not os.path.isdir(self.__trash_dir):
+ os.makedirs(self.__trash_dir)
+
def get_branch(self):
"""Return the branch name for the Series object
"""
def get_branch(self):
"""Return the branch name for the Series object
"""
@@
-425,7
+430,7
@@
class Series:
def patch_exists(self, name):
"""Return true if there is a patch with the given name, false
otherwise."""
def patch_exists(self, name):
"""Return true if there is a patch with the given name, false
otherwise."""
- return self.__patch_applied(name) or self.__patch_applied(name)
+ return self.__patch_applied(name) or self.__patch_
un
applied(name)
def __begin_stack_check(self):
"""Save the current HEAD into .git/refs/heads/base if the stack
def __begin_stack_check(self):
"""Save the current HEAD into .git/refs/heads/base if the stack
@@
-580,6
+585,11
@@
class Series:
for p in patches:
Patch(p, self.__patch_dir, self.__refs_dir).delete()
for p in patches:
Patch(p, self.__patch_dir, self.__refs_dir).delete()
+ # remove the trash directory
+ for fname in os.listdir(self.__trash_dir):
+ os.remove(fname)
+ os.rmdir(self.__trash_dir)
+
if os.path.exists(self.__applied_file):
os.remove(self.__applied_file)
if os.path.exists(self.__unapplied_file):
if os.path.exists(self.__applied_file):
os.remove(self.__applied_file)
if os.path.exists(self.__unapplied_file):
@@
-769,6
+779,9
@@
class Series:
elif not name in self.get_unapplied():
raise StackException, 'Unknown patch "%s"' % name
elif not name in self.get_unapplied():
raise StackException, 'Unknown patch "%s"' % name
+ # save the commit id to a trash file
+ write_string(os.path.join(self.__trash_dir, name), patch.get_top())
+
patch.delete()
unapplied = self.get_unapplied()
patch.delete()
unapplied = self.get_unapplied()