diff options
author | Yvan Roux <yvan.roux@linaro.org> | 2015-06-24 21:16:18 +0200 |
---|---|---|
committer | Yvan Roux <yvan.roux@linaro.org> | 2015-06-25 15:21:55 +0200 |
commit | c89b70b04e903e7ab709cbec2316ec554de9087e (patch) | |
tree | 3304544cd9d479f593bcc815a0eedbbf939fdc77 | |
parent | 281b5e32fe28cb0c8a435d4ee3a86633b9aa1f5a (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-x | backflip | 28 |
1 files changed, 20 insertions, 8 deletions
@@ -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" |