VirtualBox

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

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

tools/bin/backport-*: Added --force switch to force merging/backporting. Use with caution!

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1# !kmk_ash
2# $Id: backport-merge.sh 84267 2020-05-12 08:37:44Z 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 if test -z "${MY_FAILED_REV}"; then
70 echo "***"
71 echo "*** Merging r${MY_REV} ..."
72 echo "***"
73 if [ -n "${MY_FORCE}" ]; then
74 MY_MERGE_ARGS="$MY_MERGE_ARGS--ignore-ancestry"
75 fi
76 if "${MY_SVN}" merge ${MY_MERGE_ARGS} "${MY_TRUNK_DIR}" "${MY_BRANCH_DIR}" -c ${MY_REV}; then
77 # Check for conflict.
78 MY_CONFLICTS=`"${MY_SVN}" status "${MY_BRANCH_DIR}" | "${MY_SED}" -n -e '/^C/p'`
79 if test -z "${MY_CONFLICTS}"; then
80 if test -z "${MY_DONE_REVS}"; then
81 MY_DONE_REVS=${MY_REV}
82 else
83 MY_DONE_REVS="${MY_DONE_REVS} ${MY_REV}"
84 fi
85 else
86 echo '!!!'" Have conflicts after merging ${MY_REV}."
87 MY_FAILED_REV=${MY_REV}
88 fi
89 else
90 echo '!!!'" Failed merging r${MY_REV}."
91 MY_FAILED_REV=${MY_REV}
92 fi
93 else
94 if test -z "${MY_TODO_REVS}"; then
95 MY_TODO_REVS=${MY_REV}
96 else
97 MY_TODO_REVS="${MY_TODO_REVS} ${MY_REV}"
98 fi
99 fi
100done
101
102if test -z "${MY_FAILED_REV}"; then
103 echo "* Successfully merged all revision (${MY_DONE_REVS})."
104 exit 0;
105fi
106if test -n "${MY_DONE_REVS}"; then
107 echo "* Successfully merged: ${MY_DONE_REVS}"
108fi
109if test -n "${MY_TODO_REVS}"; then
110 echo "* Revisions left todo: ${MY_TODO_REVS}"
111fi
112exit 1;
Note: See TracBrowser for help on using the repository browser.

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