From b7bac5aeed258e5474bc9c58a0f9ac74fcdcf9c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 13 Jul 2010 12:15:25 +0200 Subject: [PATCH] Support calling 'svn up' before performing the commit. --- sunrise-commit | 25 ++++++++++++++++++++++++- sunrise-commit.1 | 5 +++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/sunrise-commit b/sunrise-commit index f72894f..1191ec7 100755 --- a/sunrise-commit +++ b/sunrise-commit @@ -192,6 +192,14 @@ vcs_commit() { fi } +vcs_update() { + # Unlike svn, git doesn't push the changes to origin immediately, + # and that's why we don't force update to it right here. + if [ ${SC_VCS} = svn ]; then + svn up || say 'Warning: svn up failed, trying to proceed anyway.' + fi +} + print_help() { cat <<_EOH_ Synopsis: @@ -203,6 +211,7 @@ Options: -c, --changelog backwards compat (ignored), -C, --nocolor disable colorful output, + -d, --noupdate disable updating the repository, -f, --force force repoman to proceed with the commit, -t, --trivial trivial changes (do not add a ChangeLog entry), -v, --verbose enable verbose output. @@ -231,7 +240,7 @@ confirm() { # Guess what! main() { - local commitmsg force monochrome trivial + local commitmsg force monochrome noupdate trivial unset SC_VERBOSE while [ ${#} -gt 0 ]; do @@ -251,6 +260,9 @@ main() { -C|--nocolor) monochrome=1 ;; + -d|--noupdate) + noupdate=1 + ;; -f|--force) force=1 ;; @@ -362,6 +374,11 @@ main() { confirm fi + if [ -n "${noupdate}" ]; then + sayv "Updating the repository..." + vcs_update + fi + sayv "Now, let's let repoman do its job..." exec repoman commit ${old_repoman--a} ${force+-f} -m "${SC_CP}: ${commitmsg}" ;; @@ -371,6 +388,12 @@ main() { say "Ready to commit ${WHITE}$(echo ${SC_CHANGE_LIST} | wc -w)${RESET} package removal(s), with commit message:" say "${BGREEN}${SC_CP}: ${commitmsg}${RESET}" confirm + + if [ -n "${noupdate}" ]; then + sayv "Updating the repository..." + vcs_update ${SC_CHANGE_LIST} + fi + vcs_commit "${SC_CP}: ${commitmsg}" ${SC_CHANGE_LIST} ;; esac diff --git a/sunrise-commit.1 b/sunrise-commit.1 index db65049..487613d 100644 --- a/sunrise-commit.1 +++ b/sunrise-commit.1 @@ -43,6 +43,11 @@ now created as needed, unless \fB--trivial\fP is used disable colorful output (for terminals which do not support escape sequences) +.IP "\fB-d\fP, \fB--noupdate\fP" + +do not update and rebase the repository before proceeding with +the commit + .IP "\fB-f\fP, \fB--force\fP" force proceeding with the commit even if QA violations occur. This