From 6024afaa0dc5624a8552a96383b36058c4d2544c Mon Sep 17 00:00:00 2001 Message-Id: <6024afaa0dc5624a8552a96383b36058c4d2544c.1715153534.git.mdw@distorted.org.uk> From: Mark Wooding Date: Thu, 20 Mar 2008 23:12:33 +0000 Subject: [PATCH] Check for unnecessary push/pop in 'float' Organization: Straylight/Edgeware From: Catalin Marinas Signed-off-by: Catalin Marinas --- stgit/commands/float.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stgit/commands/float.py b/stgit/commands/float.py index 0ba4446..5af7e85 100644 --- a/stgit/commands/float.py +++ b/stgit/commands/float.py @@ -82,6 +82,13 @@ def func(parser, options, args): topop.append(top) topush = patches + topush + # remove common patches to avoid unnecessary pop/push + while topush and topop: + if topush[-1] != topop[-1]: + break + topush.pop() + topop.pop() + # check whether the operation is really needed if topop != topush: if topop: -- [mdw]