From 03af1025e51fb68a86b11197e78e2bed3a68e55d Mon Sep 17 00:00:00 2001 Message-Id: <03af1025e51fb68a86b11197e78e2bed3a68e55d.1715223887.git.mdw@distorted.org.uk> From: Mark Wooding Date: Mon, 24 Mar 2008 11:16:59 +0000 Subject: [PATCH] Fix sync to push the popped patches back after sync'ing Organization: Straylight/Edgeware From: Catalin Marinas The t2000-sync.py test was failing after the previous change to this command. Signed-off-by: Catalin Marinas --- stgit/commands/sync.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stgit/commands/sync.py b/stgit/commands/sync.py index e0c8c7d..cbacef7 100644 --- a/stgit/commands/sync.py +++ b/stgit/commands/sync.py @@ -108,11 +108,11 @@ def func(parser, options, args): raise CmdException, 'No remote branch or series specified' applied = crt_series.get_applied() + unapplied = crt_series.get_unapplied() if options.all: patches = applied elif len(args) != 0: - unapplied = crt_series.get_unapplied() patches = parse_patches(args, applied + unapplied, len(applied), ordered = True) elif applied: @@ -136,7 +136,7 @@ def func(parser, options, args): to_pop = applied[applied.index(first_patch) + 1:] if to_pop: pop_patches(crt_series, to_pop[::-1]) - popped = patches[patches.index(first_patch) + 1:] + popped = to_pop + [p for p in patches if p in unapplied] else: popped = patches @@ -144,6 +144,7 @@ def func(parser, options, args): if p in popped: # push this patch push_patches(crt_series, [p]) + popped.remove(p) if p not in sync_patches: # nothing to synchronise continue @@ -171,3 +172,7 @@ def func(parser, options, args): out.done('updated') else: out.done() + + # push the remaining patches + if popped: + push_patches(crt_series, popped) -- [mdw]