[StGit PATCH 05/13] Remove dead code from push_empty_patch

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David
Date: Friday, September 14, 2007 - 3:31 pm

Since the split from push_patch, the push_empty_patch contains some
code that fills no purpose. Remove it and simplify the code.

Signed-off-by: David Kågedal <davidk@lysator.liu.se>
---

 stgit/stack.py |   33 +++------------------------------
 1 files changed, 3 insertions(+), 30 deletions(-)


diff --git a/stgit/stack.py b/stgit/stack.py
index 79d6cf3..f31f308 100644
--- a/stgit/stack.py
+++ b/stgit/stack.py
@@ -1029,46 +1029,19 @@ class Series(PatchSet):
         assert(name in unapplied)
 
         patch = self.get_patch(name)
-
         head = git.get_head()
-        bottom = patch.get_bottom()
-        top = patch.get_top()
-
-        ex = None
-        modified = False
 
-        # top != bottom always since we have a commit for each patch
-        # just make an empty patch (top = bottom = HEAD). This
-        # option is useful to allow undoing already merged
-        # patches. The top is updated by refresh_patch since we
-        # need an empty commit
+        # The top is updated by refresh_patch since we need an empty
+        # commit
         patch.set_bottom(head, backup = True)
         patch.set_top(head, backup = True)
-        modified = True
 
         append_string(self.__applied_file, name)
 
         unapplied.remove(name)
         write_strings(self.__unapplied_file, unapplied)
 
-        # head == bottom case doesn't need to refresh the patch
-        if not ex:
-            # if the merge was OK and no conflicts, just refresh the patch
-            # The GIT cache was already updated by the merge operation
-            if modified:
-                log = 'push(m)'
-            else:
-                log = 'push'
-            self.refresh_patch(cache_update = False, log = log)
-        else:
-            # we store the correctly merged files only for
-            # tracking the conflict history. Note that the
-            # git.merge() operations should always leave the index
-            # in a valid state (i.e. only stage 0 files)
-            self.refresh_patch(cache_update = False, log = 'push(c)')
-            raise StackException, str(ex)
-
-        return modified
+        self.refresh_patch(cache_update = False, log = 'push(m)')
 
     def push_patch(self, name):
         """Pushes a patch on the stack

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[StGit PATCH 05/13] Remove dead code from push_empty_patch, David , (Fri Sep 14, 3:31 pm)
[StGit PATCH 06/13] Refactor Series.push_patch, David , (Fri Sep 14, 3:31 pm)
[StGit PATCH 10/13] Refactor Series.new_patch, David , (Fri Sep 14, 3:32 pm)
[StGit PATCH 12/13] Remove the 'bottom' field, David , (Fri Sep 14, 3:32 pm)
[StGit PATCH 13/13] Remove the 'top' field, David , (Fri Sep 14, 3:32 pm)
Re: [StGit PATCH 00/13] Eliminate 'top' and 'bottom' files, Catalin Marinas, (Sun Sep 16, 12:28 am)
Re: [StGit PATCH 13/13] Remove the 'top' field, David Kågedal, (Sun Sep 16, 3:22 am)
Re: [StGit PATCH 00/13] Eliminate 'top' and 'bottom' files, David Kågedal, (Sun Sep 16, 3:25 am)
Re: [StGit PATCH 00/13] Eliminate 'top' and 'bottom' files, David Kågedal, (Sun Sep 16, 3:28 am)
Re: [StGit PATCH 13/13] Remove the 'top' field, Karl , (Mon Sep 17, 12:30 am)