[StGit PATCH 4/4] Use a default "hidden" argument in StackTransaction.reorder_patches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This argument is rarely used so adding a default value simplifies the
calling code.

Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxxxx>
---
 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 641ab7b..63be461 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:])

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux