From f4893b17323f7d6a62790f38e4929f9ea75e42e4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Karl=20Hasselstr=C3=B6m?= Date: Fri, 22 May 2009 22:35:25 +0200 Subject: [PATCH] Transaction.push_patch(): Set self.head only when we have a merge conflict MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Setting self.head when we don't have a merge conflict is a harmless no-op---as long as we set it to the commit that was going to be the stack top anyway---so this patch should not change the behavior. But it's not really nice to do it unconditionally, especially considering that we want people to be able to understand what the code does ... Also add a comment that explains why we set it, since the logic is rather more hairy than I'd like. Signed-off-by: Karl Hasselström --- stgit/lib/transaction.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py index 13323dd..96c57b9 100644 --- a/stgit/lib/transaction.py +++ b/stgit/lib/transaction.py @@ -343,7 +343,13 @@ class StackTransaction(object): if any(getattr(cd, a) != getattr(orig_cd, a) for a in ['parent', 'tree', 'author', 'message']): comm = self.__stack.repository.commit(cd) - self.head = comm + if merge_conflict: + # When we produce a conflict, we'll run the update() + # function defined below _after_ having done the + # checkout in run(). To make sure that we check out + # the real stack top (as it will look after update() + # has been run), set it hard here. + self.head = comm else: comm = None s = 'unmodified' -- 2.11.0