chiark / gitweb /
Remove dead code from push_empty_patch
authorDavid Kågedal <davidk@lysator.liu.se>
Fri, 14 Sep 2007 22:31:34 +0000 (00:31 +0200)
committerKarl Hasselström <kha@treskal.com>
Sun, 23 Sep 2007 22:54:06 +0000 (00:54 +0200)
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>
Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/stack.py

index 58e71eda53ad1d6263225d1d5378e61b2947b1e8..c63f7ce4f9a7aec2c202e7fcf5437cb27833e889 100644 (file)
@@ -1039,46 +1039,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