# save the commit id to a trash file
write_string(os.path.join(self.__trash_dir, name), patch.get_top())
+ if self.patch_hidden(name):
+ self.unhide_patch(name)
+
patch.delete()
unapplied = self.get_unapplied()
f.writelines([line + '\n' for line in unapplied])
f.close()
- if self.patch_hidden(name):
- self.unhide_patch(name)
-
def forward_patches(self, names):
"""Try to fast-forward an array of patches.
if self.patch_hidden(oldname):
self.unhide_patch(oldname)
- self.hide_patch(newname)
+ was_hidden=True
+ else:
+ was_hidden=False
if oldname in unapplied:
Patch(oldname, self.__patch_dir, self.__refs_dir).rename(newname)
else:
raise StackException, 'Unknown patch "%s"' % oldname
+ if was_hidden:
+ self.hide_patch(newname)
+
def log_patch(self, patch, message):
"""Generate a log commit for a patch
"""
[ $(stg applied | wc -l) -eq 2 ]
'
+test_expect_success \
+ 'Hide the topmost patch and try to delete it' \
+ '
+ [ $(stg applied | wc -l) -eq 2 ] &&
+ stg hide bar &&
+ stg delete bar &&
+ [ $(stg applied | wc -l) -eq 1 ]
+ '
+
test_expect_success \
'Create another branch, and put one patch in each branch' \
'
test_expect_success \
'Delete a patch in another branch' \
'
- [ $(stg applied | wc -l) -eq 3 ] &&
+ [ $(stg applied | wc -l) -eq 2 ] &&
[ $(stg applied -b br | wc -l) -eq 1 ] &&
stg delete -b br baz &&
- [ $(stg applied | wc -l) -eq 3 ] &&
+ [ $(stg applied | wc -l) -eq 2 ] &&
[ $(stg applied -b br | wc -l) -eq 0 ]
'