VirtualBox

source: vbox/trunk/tools/bin/backport-merge.sh@ 86763

Last change on this file since 86763 was 84270, checked in by vboxsync, 5 years ago

tools/bin/backport-*: Clear MERGE_ARGS when iterating over multiple backports at once.

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.3 KB
Line 
1# !kmk_ash
2# $Id: backport-merge.sh 84270 2020-05-12 09:20:36Z vboxsync $
3## @file
4# Script for merging a backport from trunk.
5#
6
7#
8# Copyright (C) 2020 Oracle Corporation
9#
10# This file is part of VirtualBox Open Source Edition (OSE), as
11# available from http://www.virtualbox.org. This file is free software;
12# you can redistribute it and/or modify it under the terms of the GNU
13# General Public License (GPL) as published by the Free Software
14# Foundation, in version 2 as it comes in the "COPYING" file of the
15# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17#
18
19#
20# Determin script dir so we can source the common bits.
21#
22MY_SED=kmk_sed
23MY_SCRIPT_DIR=`echo "$0" | "${MY_SED}" -e 's|\\\|/|g' -e 's|^\(.*\)/[^/][^/]*$|\1|'` # \ -> / is for windows.
24if test "${MY_SCRIPT_DIR}" = "$0"; then
25 MY_SCRIPT_DIR=`pwd -L`
26else
27 MY_SCRIPT_DIR=`cd "${MY_SCRIPT_DIR}"; pwd -L` # pwd is built into kmk_ash.
28fi
29
30#
31# This does a lot.
32#
33MY_SCRIPT_NAME="backport-merge.sh"
34. "${MY_SCRIPT_DIR}/backport-common.sh"
35
36#
37# Check that the branch is clean if first revision.
38#
39if test -n "${MY_FIRST_REV}"; then
40 MY_STATUS=`"${MY_SVN}" status -q "${MY_BRANCH_DIR}"`
41 if test -n "${MY_STATUS}"; then
42 echo "error: Branch already has changes pending..."
43 "${MY_SVN}" status -q "${MY_BRANCH_DIR}"
44 exit 1;
45 fi
46 test -z "${MY_DEBUG}" || echo "debug: Found no pending changes on branch."
47fi
48
49#
50# Update branch if requested.
51#
52if test -n "${MY_UPDATE_FIRST}"; then
53 if ! "${MY_SVN}" update "${MY_BRANCH_DIR}" --ignore-externals; then
54 echo "error: branch updating failed..."
55 exit 1;
56 fi
57 test -z "${MY_DEBUG}" || echo "debug: Updated the branch."
58fi
59
60#
61# Do the merging.
62#
63MY_DONE_REVS=
64MY_FAILED_REV=
65MY_TODO_REVS=
66test -n "${MY_DEBUG}" && echo "MY_REVISIONS=${MY_REVISIONS}"
67for MY_REV in ${MY_REVISIONS};
68do
69 MY_MERGE_ARGS=
70 if test -z "${MY_FAILED_REV}"; then
71 echo "***"
72 echo "*** Merging r${MY_REV} ..."
73 echo "***"
74 if [ -n "${MY_FORCE}" ]; then
75 MY_MERGE_ARGS="$MY_MERGE_ARGS --ignore-ancestry"
76 fi
77 if "${MY_SVN}" merge ${MY_MERGE_ARGS} "${MY_TRUNK_DIR}" "${MY_BRANCH_DIR}" -c ${MY_REV}; then
78 # Check for conflict.
79 MY_CONFLICTS=`"${MY_SVN}" status "${MY_BRANCH_DIR}" | "${MY_SED}" -n -e '/^C/p'`
80 if test -z "${MY_CONFLICTS}"; then
81 if test -z "${MY_DONE_REVS}"; then
82 MY_DONE_REVS=${MY_REV}
83 else
84 MY_DONE_REVS="${MY_DONE_REVS} ${MY_REV}"
85 fi
86 else
87 echo '!!!'" Have conflicts after merging ${MY_REV}."
88 MY_FAILED_REV=${MY_REV}
89 fi
90 else
91 echo '!!!'" Failed merging r${MY_REV}."
92 MY_FAILED_REV=${MY_REV}
93 fi
94 else
95 if test -z "${MY_TODO_REVS}"; then
96 MY_TODO_REVS=${MY_REV}
97 else
98 MY_TODO_REVS="${MY_TODO_REVS} ${MY_REV}"
99 fi
100 fi
101done
102
103if test -z "${MY_FAILED_REV}"; then
104 echo "* Successfully merged all revision (${MY_DONE_REVS})."
105 exit 0;
106fi
107if test -n "${MY_DONE_REVS}"; then
108 echo "* Successfully merged: ${MY_DONE_REVS}"
109fi
110if test -n "${MY_TODO_REVS}"; then
111 echo "* Revisions left todo: ${MY_TODO_REVS}"
112fi
113exit 1;
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette