Skip to content

Commit 47449b6

Browse files
committed
Tweaks to the mergedevbranch utility.
- Legacy-Id: 7229
1 parent aedbcd9 commit 47449b6

1 file changed

Lines changed: 25 additions & 11 deletions

File tree

bin/mergedevbranch

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)";
6868
# Option parsing
6969

7070
# Options
71-
shortopts=chvV
72-
longopts=commit,help,verbose,version
71+
shortopts=cnhvV
72+
longopts=commit,no-commit,help,verbose,version
7373

7474
# Default values
75+
ARG_COMMIT=1
7576

7677
if [ "$(uname)" = "Linux" ]; then
7778
args=$(getopt -o "$shortopts" --long "$longopts" -n '$program' -- $SV "$@")
@@ -89,6 +90,7 @@ fi
8990
while true ; do
9091
case "$1" in
9192
-c| --commit) ARG_COMMIT=1;; # Run commit in addition to merge
93+
-n| --no-commit) ARG_COMMIT=0;; # Don't commit after merge
9294
-h| --help) usage; exit;; # Show this help, then exit
9395
-v| --verbose) VERBOSE=1;; # Be more talkative
9496
-V| --version) version; exit;; # Show program version, then exit
@@ -133,13 +135,20 @@ info=$(svn log ${repo}/ -r $rev --incremental)
133135
set $(echo "$info" | tail -n +2 | head -n 1 | tr "|" "\t")
134136
who=$2; echo -e "\n$who"
135137
comment=$(echo "$info" | tail -n +3); echo -e "$comment\n"
138+
comment=$(echo "$comment" | sed -r -e 's/(commit )?ready (for|to) merge\.?//i' -e '/^$/d')
136139
files=$(svn diff ${repo}/ -c $rev --summarize | awk '{$1=""; print;}' | while read file; do echo "${file/$repo\/$branch\//}"; done)
137140
138-
echo -e "Files: \n$files"
141+
echo -e "Files: \n$files\n"
139142
140-
note "Writing commit script"
141-
echo -e "#!/bin/bash\n\nsvn commit -m \"Merged [$rev] from $who: ${comment/\"/\'} ${fix/\"/\'}\"" > ../cicmd/commit-${rev}-merge.sh
142-
chmod +x ../cicmd/commit-${rev}-merge.sh
143+
read -p "Continue with diff? [Y/n] "
144+
[ "$REPLY" = "Y" -o "$REPLY" = "y" -o "$REPLY" = "" ] || exit
145+
146+
note "Diff:"
147+
svn diff -c $rev $repo/$branch | less
148+
149+
echo ""
150+
read -p "Continue with the merge? [Y/n] "
151+
[ "$REPLY" = "Y" -o "$REPLY" = "y" -o "$REPLY" = "" ] || exit
143152
144153
note "Do the merge:"
145154
if [[ $rev =~ : ]]; then
@@ -150,14 +159,14 @@ else
150159
svn merge -c $rev ${repo}/$branch ."
151160
fi
152161
162+
note "Writing commit script"
163+
echo -e "#!/bin/bash\n\nsvn commit -m \"Merged [$rev] from $who: ${comment/\"/\'} ${fix/\"/\'}\"" > ../cicmd/commit-${rev}-merge.sh
164+
chmod +x ../cicmd/commit-${rev}-merge.sh
165+
153166
M=$(svn st | cut -c 1-7 | grep -oh 'M' | head -n 1)
154167
C=$(svn st | cut -c 1-7 | grep -oh 'C' | head -n 1)
155168
G=$(svn st | cut -c 1-7 | grep -oh 'G' | head -n 1)
156169
157-
158-
date +"%Y-%m-%d %H:%M:%S $G$C$M @$rev $branch" >> mergelog
159-
date +"%Y-%m-%d %H:%M:%S Merged $branch@$rev" >> testresult
160-
161170
cd ../
162171
rsync -a $cwd/ merged@$rev/
163172
cp cicmd/commit-${rev}-merge.sh merged@$rev/commit
@@ -178,8 +187,13 @@ Regards,
178187
(via the mergesprintbranch script)
179188
EOF
180189
190+
svn revert ietf/meeting
191+
192+
193+
echo -e "\nRunning tests"
194+
ietf/manage.py test --settings=settings_sqlitetest || die "Tests failed"
181195
182-
if [ "$ARG_COMMIT" ]; then
196+
if [ "$ARG_COMMIT" != 0 ]; then
183197
echo "Committing the merge:"
184198
echo ""
185199
svn commit -m "Merged [$rev] from $who: $comment $fix"

0 commit comments

Comments
 (0)