[StGIT PATCH 1/3] Command to move a patch to the top
From: Robin Rosenberg <robin.rosenberg@dewire.com>
---
stgit/main.py | 3 +++
t/t1500-float.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/stgit/main.py b/stgit/main.py
index f59bce6..e9cc6cd 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -38,6 +38,7 @@ import stgit.commands.clone
import stgit.commands.commit
import stgit.commands.export
import stgit.commands.files
+import stgit.commands.float
import stgit.commands.fold
import stgit.commands.goto
import stgit.commands.id
@@ -77,6 +78,7 @@ commands = {
'commit': stgit.commands.commit,
'export': stgit.commands.export,
'files': stgit.commands.files,
+ 'float': stgit.commands.float,
'fold': stgit.commands.fold,
'goto': stgit.commands.goto,
'id': stgit.commands.id,
@@ -113,6 +115,7 @@ stackcommands = (
'applied',
'clean',
'commit',
+ 'float',
'goto',
'init',
'pop',
diff --git a/t/t1500-float.sh b/t/t1500-float.sh
new file mode 100755
index 0000000..670050f
--- /dev/null
+++ b/t/t1500-float.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Robin Rosenberg
+#
+
+test_description='Test floating a number of patches to the top of the stack
+
+'
+
+. ./test-lib.sh
+
+test_expect_success \
+ 'Initialize the StGIT repository' \
+ 'stg init &&
+ stg new A -m "a" && echo A >a.txt && stg add a.txt && stg refresh &&
+ stg new B -m "b" && echo B >b.txt && stg add b.txt && stg refresh &&
+ stg new C -m "c" && echo C >c.txt && stg add c.txt && stg refresh &&
+ stg new D -m "d" && echo D >d.txt && stg add d.txt && stg refresh &&
+ stg new E -m "e" && echo E >e.txt && stg add e.txt && stg refresh &&
+ stg new F -m "f" && echo F >f.txt && stg add f.txt && stg refresh &&
+ test "`echo \`cat .git/patches/master/applied\``" = "A B C D E F"
+ '
+
+test_expect_success \
+ 'Float A to top' \
+ 'stg float A &&
+ test "`echo \`cat .git/patches/master/applied\``" = "B C D E F A"
+ '
+test_expect_success \
+ 'Float A to top (noop)' \
+ 'stg float A &&
+ test "`echo \`cat .git/patches/master/applied\``" = "B C D E F A"
+ '
+test_expect_success \
+ 'Float B C to top (noop)' \
+ 'stg float B C &&
+ test "`echo \`cat .git/patches/master/applied\``" = "D E F A B C"
+ '
+test_expect_success \
+ 'Float E A to top (noop)' \
+ 'stg float E A &&
+ test "`echo \`cat .git/patches/master/applied\``" = "D F B C E A"
+ '
+test_done