Skip to contentSkip to conversation

Display (empty) when appropriate for the goto command

PATCH In review Catalin Marinas 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Display (empty) when appropriate for the goto command

This is a fix for bug #11810. The original implementation of goto used to display (empty patch) when a patch became empty during a push + merge operation. This patch adds this feature again.

---
 stgit/lib/transaction.py |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
stgit/lib/transaction.py +3 -1
index de62a8c..6623645 100644
@@ -290,7 +290,6 @@ class StackTransaction(object):
         conflicts to them."""
         orig_cd = self.patches[pn].data
         cd = orig_cd.set_committer(None)
-        s = ['', ' (empty)'][cd.is_nochange()]
         oldparent = cd.parent
         cd = cd.set_parent(self.top)
         base = oldparent.data.tree
@@ -298,6 +297,7 @@ class StackTransaction(object):
         theirs = cd.tree
         tree, self.temp_index_tree = self.temp_index.merge(
             base, ours, theirs, self.temp_index_tree)
+        s = ''
         merge_conflict = False
         if not tree:
             if iw == None:
@@ -324,6 +324,8 @@ class StackTransaction(object):
         else:
             comm = None
             s = ' (unmodified)'
+        if not merge_conflict and cd.is_nochange():
+            s = ' (empty)'
         out.info('Pushed %s%s' % (pn, s))
         def update():
             if comm: