chiark / gitweb /
Remove the reordering side-effect of the latter sync changes
authorCatalin Marinas <catalin.marinas@gmail.com>
Mon, 24 Mar 2008 18:30:25 +0000 (18:30 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Mon, 24 Mar 2008 18:30:25 +0000 (18:30 +0000)
If only some of the patches were specified for syncing, the command had the
side effect of reordering the patches in the stack.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/sync.py

index cbacef72e2844324550ce5db28bf47f5e9274200..ae9a5f87e7e48e04e791ee057f141a8b97eec317 100644 (file)
@@ -136,15 +136,14 @@ def func(parser, options, args):
         to_pop = applied[applied.index(first_patch) + 1:]
         if to_pop:
             pop_patches(crt_series, to_pop[::-1])
-        popped = to_pop + [p for p in patches if p in unapplied]
     else:
-        popped = patches
+        to_pop = []
+    popped = to_pop + [p for p in patches if p in unapplied]
 
-    for p in patches:
+    for p in [first_patch] + popped:
         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
@@ -172,7 +171,3 @@ def func(parser, options, args):
             out.done('updated')
         else:
             out.done()
-
-    # push the remaining patches
-    if popped:
-        push_patches(crt_series, popped)