summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2015-06-24 21:16:18 +0200
committerYvan Roux <yvan.roux@linaro.org>2015-06-25 15:21:55 +0200
commitc89b70b04e903e7ab709cbec2316ec554de9087e (patch)
tree3304544cd9d479f593bcc815a0eedbbf939fdc77
parent281b5e32fe28cb0c8a435d4ee3a86633b9aa1f5a (diff)
Better handling of degenerated cases:
- Bad revision number (not found in master history) - Changelog is missing in upstream commit Change-Id: Iaf4ef9efce9f20d0f274925da61578785cb77869
-rwxr-xr-xbackflip28
1 files changed, 20 insertions, 8 deletions
diff --git a/backflip b/backflip
index e4ceb44..6158dcd 100755
--- a/backflip
+++ b/backflip
@@ -165,6 +165,13 @@ print_info "example: ${bold}backflip -r master${NC}"
print_step "Finding SHA1"
# ==============================================================================
SHA1=`git log --format=format:"%H" --grep=trunk@${REV} master`
+if [ -z "$SHA1" ]; then
+ print_info "${red}This revision is missing in master historyi${NC}"
+ if ! $INTERACTIVE; then
+ mv ${PREFIX}.log ${PREFIX}-none.log
+ exit 1;
+ fi
+fi
print_info "${NC}SVN rev ${bold}${1}${NC} SHA1: ${bold}${SHA1}${NC}"
if $INTERACTIVE; then
ask "${bold}View the commit [N/y] ?" user_view
@@ -185,14 +192,19 @@ git cherry-pick -n $SHA1 2>/dev/null
print_step "Handling ChangeLogs Conflicts"
# ==============================================================================
CHLOGS=`git diff-tree --no-commit-id --name-only -r ${SHA1} | grep ChangeLog`
-for i in $CHLOGS; do
- print_info "${green}$i"
- # Revert ChangeLog corruption
- git reset -q HEAD $i
- git checkout $i
- # Create ChangeLog entry
- forge_entry $1 $i
-done
+if [ -z "$CHLOGS" ]; then
+ print_info "${red}WARNING: No ChangeLog in this commit.${NC}"
+ forge_entry $REV "missing/ChangeLog"
+else
+ for i in $CHLOGS; do
+ print_info "${green}$i"
+ # Revert ChangeLog corruption
+ git reset -q HEAD $i
+ git checkout $i
+ # Create ChangeLog entry
+ forge_entry $REV $i
+ done
+fi
# ==============================================================================
print_step "Status Checking"