chiark / gitweb /
Don't set the default authdate if none specified
[stgit] / stgit / stack.py
index 1130210de3f8d5052c4f34e84ab7b6203054eb53..c2eb2de9e7292521a38fe1cbc4aaa17db3fe66ba 100644 (file)
@@ -165,7 +165,7 @@ class Patch(StgitObject):
         self.create_empty_field('bottom')
         self.create_empty_field('top')
 
-    def delete(self):
+    def delete(self, keep_log = False):
         if os.path.isdir(self._dir()):
             for f in os.listdir(self._dir()):
                 os.remove(os.path.join(self._dir(), f))
@@ -177,7 +177,7 @@ class Patch(StgitObject):
             git.delete_ref(self.__top_ref)
         except git.GitException, e:
             out.warn(str(e))
-        if git.ref_exists(self.__log_ref):
+        if not keep_log and git.ref_exists(self.__log_ref):
             git.delete_ref(self.__log_ref)
 
     def get_name(self):
@@ -753,10 +753,10 @@ class Series(PatchSet):
                 raise StackException('Series directory %s is not empty'
                                      % self._dir())
 
-            try:
-                git.delete_branch(self.get_name())
-            except GitException:
-                out.warn('Could not delete branch "%s"' % self.get_name())
+        try:
+            git.delete_branch(self.get_name())
+        except GitException:
+            out.warn('Could not delete branch "%s"' % self.get_name())
 
         config.remove_section('branch.%s' % self.get_name())
         config.remove_section('branch.%s.stgit' % self.get_name())
@@ -767,7 +767,7 @@ class Series(PatchSet):
                       author_name = None, author_email = None,
                       author_date = None,
                       committer_name = None, committer_email = None,
-                      backup = False, sign_str = None, log = 'refresh',
+                      backup = True, sign_str = None, log = 'refresh',
                       notes = None, bottom = None):
         """Generates a new commit for the topmost patch
         """
@@ -793,8 +793,6 @@ class Series(PatchSet):
             author_name = patch.get_authname()
         if not author_email:
             author_email = patch.get_authemail()
-        if not author_date:
-            author_date = patch.get_authdate()
         if not committer_name:
             committer_name = patch.get_commname()
         if not committer_email:
@@ -940,7 +938,7 @@ class Series(PatchSet):
 
         return patch
 
-    def delete_patch(self, name):
+    def delete_patch(self, name, keep_log = False):
         """Deletes a patch
         """
         self.__patch_name_valid(name)
@@ -957,7 +955,7 @@ class Series(PatchSet):
         # save the commit id to a trash file
         write_string(os.path.join(self.__trash_dir, name), patch.get_top())
 
-        patch.delete()
+        patch.delete(keep_log = keep_log)
 
         unapplied = self.get_unapplied()
         unapplied.remove(name)