From 7d7210c881f52397e421238528d4368c6a51414b Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Tue, 9 Mar 2010 10:05:58 +0000 Subject: [PATCH] Allow interactive merging via StackTransaction.reorder_patches() This way other commands like sink and pop can use the interactive mergetool. Signed-off-by: Catalin Marinas --- stgit/commands/pop.py | 3 ++- stgit/commands/sink.py | 3 ++- stgit/lib/transaction.py | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/stgit/commands/pop.py b/stgit/commands/pop.py index f67cc0a..abf2814 100644 --- a/stgit/commands/pop.py +++ b/stgit/commands/pop.py @@ -79,7 +79,8 @@ def func(parser, options, args): applied = [p for p in trans.applied if not p in set(patches)] unapplied = patches + trans.unapplied try: - trans.reorder_patches(applied, unapplied, iw = iw) + trans.reorder_patches(applied, unapplied, iw = iw, + allow_interactive = True) except transaction.TransactionException: pass return trans.run(iw) diff --git a/stgit/commands/sink.py b/stgit/commands/sink.py index eadc27d..4b7535e 100644 --- a/stgit/commands/sink.py +++ b/stgit/commands/sink.py @@ -89,7 +89,8 @@ def func(parser, options, args): check_clean_iw = clean_iw) try: - trans.reorder_patches(applied, unapplied, iw = iw) + trans.reorder_patches(applied, unapplied, iw = iw, + allow_interactive = True) except transaction.TransactionHalted: pass return trans.run(iw) diff --git a/stgit/lib/transaction.py b/stgit/lib/transaction.py index d82e724..e76f5ab 100644 --- a/stgit/lib/transaction.py +++ b/stgit/lib/transaction.py @@ -398,7 +398,8 @@ class StackTransaction(object): del x[x.index(pn)] self.applied.append(pn) - def reorder_patches(self, applied, unapplied, hidden = None, iw = None): + def reorder_patches(self, applied, unapplied, hidden = None, iw = None, + allow_interactive = False): """Push and pop patches to attain the given ordering.""" if hidden is None: hidden = self.hidden @@ -407,7 +408,7 @@ class StackTransaction(object): to_pop = set(self.applied[common:]) self.pop_patches(lambda pn: pn in to_pop) for pn in applied[common:]: - self.push_patch(pn, iw) + self.push_patch(pn, iw, allow_interactive = allow_interactive) assert self.applied == applied assert set(self.unapplied + self.hidden) == set(unapplied + hidden) self.unapplied = unapplied -- 2.11.0