Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(701)

Unified Diff: git_cl/test/save-description-on-failure.sh

Issue 5012006: Move git-cl into depot_tools.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « git_cl/test/rename.sh ('k') | git_cl/test/submit-from-new-dir.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl/test/save-description-on-failure.sh
===================================================================
--- git_cl/test/save-description-on-failure.sh (revision 0)
+++ git_cl/test/save-description-on-failure.sh (revision 0)
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# We should save a change's description when an upload fails.
+
+set -e
+
+. ./test-lib.sh
+
+# Back up any previously-saved description the user might have.
+BACKUP_FILE="$HOME/.git_cl_description_backup"
+BACKUP_FILE_TMP="$BACKUP_FILE.tmp"
+if [ -e "$BACKUP_FILE" ]; then
+ mv "$BACKUP_FILE" "$BACKUP_FILE_TMP"
+fi
+
+setup_initgit
+setup_gitgit
+
+(
+ set -e
+ cd git-git
+
+ DESC="this is the description"
+
+ # Create a branch and check in a file.
+ git checkout -q --track -b work origin
+ echo foo >> test
+ git add test; git commit -q -m "$DESC"
+
+ # Try to upload the change to an unresolvable hostname; git-cl should fail.
+ export EDITOR=/bin/true
+ git config rietveld.server bogus.example.com:80
+ test_expect_failure "uploading to bogus server" "$GIT_CL upload 2>/dev/null"
+
+ # Check that the change's description was saved.
+ test_expect_success "description was backed up" \
+ "grep -q '$DESC' '$BACKUP_FILE'"
+)
+
+SUCCESS=$?
+
+cleanup
+
+# Restore the previously-saved description.
+rm -f "$BACKUP_FILE"
+if [ -e "$BACKUP_FILE_TMP" ]; then
+ mv "$BACKUP_FILE_TMP" "$BACKUP_FILE"
+fi
+
+if [ $SUCCESS == 0 ]; then
+ echo PASS
+fi
Property changes on: git_cl/test/save-description-on-failure.sh
___________________________________________________________________
Added: svn:executable
+ *
« no previous file with comments | « git_cl/test/rename.sh ('k') | git_cl/test/submit-from-new-dir.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698