threads / patch / 8474

patch, 3 partsRobustify rebase test: check patches are reapplied.

Subject: [PATCH 1/3] Robustify rebase test: check patches are reapplied.

## tl;dr

5 messages between Jun 6, 2007 and Jun 10, 2007. Diffs are folded; open one to read it.

replies: 4people: 2as markdown or json

Yann Dirson· Jun 6, 2007, 22:01 UTC · lore

[SGIT PATCH 0/3] Assorted fixes

This fixes the issue reported by Andrey Borzenkov, and robustifies another testcase to catch any similar issue.

Also updates stg-whatchanged, which for some reason had been left broken.

-- 
Yann Dirson    <ydirson@altern.org> |
Debian-related: <dirson@debian.org> |   Support Debian GNU/Linux:
                                    |  Freedom, Power, Stability, Gratis
     http://ydirson.free.fr/        | Check <http://www.debian.org/>
Yann Dirson· Jun 6, 2007, 22:01 UTC · re: Yann Dirson · lore
Signed-off-by: Yann Dirson <ydirson@altern.org>
---
 t/t2200-rebase.sh |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Show changes to t/t2200-rebase.sh +2 −1
diff --git a/t/t2200-rebase.sh b/t/t2200-rebase.sh
index 52462dd..882572c 100755
--- a/t/t2200-rebase.sh
+++ b/t/t2200-rebase.sh
@@ -27,7 +27,8 @@ test_expect_success \
 	'Rebase to previous commit' \
 	'
 	stg rebase master~1 &&
-	test `stg id base@stack` = `git rev-parse master~1`
+	test `stg id base@stack` = `git rev-parse master~1` &&
+	test `stg applied | wc -l` = 1
 	'
 
 test_done
Karl Hasselström· Jun 10, 2007, 08:40 UTC · re: Yann Dirson · lore

Re: [PATCH 1/3] Robustify rebase test: check patches are reapplied.

On 2007-06-07 00:01:42 +0200, Yann Dirson wrote:
> +	test `stg applied | wc -l` = 1

Unimportant note: I believe "stg applied" has a -c (count) flag for precisely this purpose.

-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Yann Dirson· Jun 6, 2007, 22:01 UTC · re: Yann Dirson · lore

[PATCH 2/3] Catch early trying rebasing to unknown ref, and add testcase.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---
 stgit/commands/rebase.py |    4 ++++
 t/t2200-rebase.sh        |   12 ++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
Show changes to 2 files +16 −0

stgit/commands/rebase.py, t/t2200-rebase.sh

diff --git a/stgit/commands/rebase.py b/stgit/commands/rebase.py
index d132b60..2f0e660 100644
--- a/stgit/commands/rebase.py
+++ b/stgit/commands/rebase.py
@@ -52,6 +52,10 @@ def func(parser, options, args):
     check_conflicts()
     check_head_top_equal()
 
+    # ensure an exception is raised before popping on non-existent target
+    if git_id(args[0]) == None:
+        raise GitException, 'Unknown revision: %s' % git_id
+        
     applied = prepare_rebase(real_rebase=True, force=options.force)
     rebase(args[0])
     post_rebase(applied, options.nopush, options.merged)
diff --git a/t/t2200-rebase.sh b/t/t2200-rebase.sh
index 882572c..c142e08 100755
--- a/t/t2200-rebase.sh
+++ b/t/t2200-rebase.sh
@@ -31,4 +31,16 @@ test_expect_success \
 	test `stg applied | wc -l` = 1
 	'
 
+test_expect_failure \
+	'Attempt rebase to non-existing commit' \
+	'
+	stg rebase not-a-ref
+	'
+
+test_expect_success \
+	'Check patches were re-applied' \
+	'
+	test $(stg applied | wc -l) = 1
+	'
+
 test_done
Yann Dirson· Jun 6, 2007, 22:01 UTC · re: Yann Dirson · lore

[PATCH 3/3] Fixed typo in contrib/stg-whatchanged.

Signed-off-by: Yann Dirson <ydirson@altern.org>
---
 contrib/stg-whatchanged |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to contrib/stg-whatchanged +1 −1
diff --git a/contrib/stg-whatchanged b/contrib/stg-whatchanged
index f80d0a1..d5b6965 100755
--- a/contrib/stg-whatchanged
+++ b/contrib/stg-whatchanged
@@ -23,7 +23,7 @@ fi
 
 # Merges via "push" leave top=bottom so we must look at old patch
 # in this case (unlike, eg., "pick --fold")
-patchdir="$(git-rev-parse --git-dir)/patches/$(stg branch)/$(stg top)"
+patchdir="$(git-rev-parse --git-dir)/patches/$(stg branch)/patches/$(stg top)"
 if [ $(cat "$patchdir/bottom") = $(cat "$patchdir/top") ];
 then
     current_cmd="stg show //top.old"

← back to recent threads