From d44708ef52f10a22ca3c87ff3c92bdd911bca672 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Thu, 9 Apr 2009 23:40:59 +0300 Subject: [PATCH] Use a default "hidden" argument in StackTransaction.reorder_patches MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This argument is rarely used so adding a default value simplifies the calling code. Signed-off-by: Catalin Marinas Acked-by: Karl Hasselström --- stgit/commands/float.py | 3 +-- stgit/commands/sink.py | 4 +--- stgit/lib/transaction.py | 4 +++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/stgit/commands/float.py b/stgit/commands/float.py index 8410675..e561c39 100644 --- a/stgit/commands/float.py +++ b/stgit/commands/float.py @@ -71,7 +71,6 @@ def func(parser, options, args): applied = [p for p in stack.patchorder.applied if p not in patches] + \ patches unapplied = [p for p in stack.patchorder.unapplied if not p in patches] - hidden = list(stack.patchorder.hidden) iw = stack.repository.default_iw clean_iw = (not options.keep and iw) or None @@ -79,7 +78,7 @@ def func(parser, options, args): check_clean_iw = clean_iw) try: - trans.reorder_patches(applied, unapplied, hidden, iw) + trans.reorder_patches(applied, unapplied, iw = iw) except transaction.TransactionHalted: pass return trans.run(iw) diff --git a/stgit/commands/sink.py b/stgit/commands/sink.py index b9b8c8a..4677a75 100644 --- a/stgit/commands/sink.py +++ b/stgit/commands/sink.py @@ -81,9 +81,7 @@ def func(parser, options, args): else: insert_idx = 0 applied = applied[:insert_idx] + patches + applied[insert_idx:] - unapplied = [p for p in stack.patchorder.unapplied if p not in patches] - hidden = list(stack.patchorder.hidden) iw = stack.repository.default_iw clean_iw = (not options.keep and iw) or None @@ -91,7 +89,7 @@ def func(parser, options, args): check_clean_iw = clean_iw) try: - trans.reorder_patches(applied, unapplied, hidden, iw) + trans.reorder_patches(applied, unapplied, iw = iw) except transaction.TransactionHalted: pass return trans.run(iw) diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py index 4b5398a..b146648 100644 --- a/stgit/lib/transaction.py +++ b/stgit/lib/transaction.py @@ -365,8 +365,10 @@ class StackTransaction(object): # Update immediately. update() - def reorder_patches(self, applied, unapplied, hidden, iw = None): + def reorder_patches(self, applied, unapplied, hidden = None, iw = None): """Push and pop patches to attain the given ordering.""" + if hidden is None: + hidden = self.hidden common = len(list(it.takewhile(lambda (a, b): a == b, zip(self.applied, applied)))) to_pop = set(self.applied[common:]) -- 2.11.0