/usr/bin/grab-merge is in ubuntu-dev-tools 0.155.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124  | #!/bin/sh
# grab-merge - grab a merge
#
# Copyright © 2008 Canonical Ltd.
# Author: Scott James Remnant <scott@ubuntu.com>.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of version 3 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# Uncomment if you have an account on casey
#RSYNC=y
# Uncomment if you know that this deletes all the files in the CWD
#EXPERT=y
# Or uncomment if you want to use named subdirectories
SUBDIR=y
set -e
MERGE=$1
if [ -z "$1" -o "$1" = "-h" -o "$1" = "--help" ]; then
    echo "Usage: $0 <package name>"
    echo ""
    echo "grab-merge downloads a merge's packaging files and report from"
    echo "merges.ubuntu.com, placing them into a new subdirectory for working"
    echo "from."
    exit 0
fi
if [ "$SUBDIR" = "y" ]; then
    [ -d "$MERGE" ] || { mkdir $MERGE; CREATED_DIR=1; }
    cd $MERGE
fi
if [ "$EXPERT" != "y" ] && [ -n "$(ls)" ]; then
    echo -n "Are you sure you want to delete all the files in $(pwd) [yN]? "
    read ANSWER
    [ "$ANSWER" = "y" ] || exit 1
fi
if [ "${MERGE#lib}" != "${MERGE}" ]; then
    HASH=${MERGE%${MERGE#????}}
else
    HASH=${MERGE%${MERGE#?}}
fi
if [ "$RSYNC" = "y" ]; then
    URL="merges.ubuntu.com:/srv/patches.ubuntu.com/merges/$HASH/$MERGE/"
    rsync --verbose --archive --progress --compress --delete \
        "$URL" . || { echo "Error while rsyncing $URL"; exit 1; }
else
    rm -rf  --one-file-system *
    wget -nv https://merges.ubuntu.com/$HASH/$MERGE/REPORT || {
            echo "Package not found on merges.ubuntu.com."
            [ "$CREATED_DIR" != "1" ] || { cd ..; rmdir $MERGE; }
            exit 1
        }
    for NAME in $(sed -n -e "/^    /p" REPORT); do
        if [ ! -f "$NAME" ]; then
            echo "Getting $NAME..."
            URL="https://merges.ubuntu.com/$HASH/$MERGE/$NAME"
            wget -q "$URL" || { echo "Error downloading $URL"; exit 1; }
        fi
    done
fi
echo
if grep "^generated: " REPORT >/dev/null; then
    VERSION=$(sed -n -e "/^generated:/s/^generated: *//p" REPORT)
    DEB_VENDOR=Ubuntu dpkg-source -x ${MERGE}_${VERSION#*:}.dsc
    echo
else
    TARBALL=$(sed -n -e "/\.src\.tar\.gz$/p" REPORT)
    echo unpacking $TARBALL
    tar xf $TARBALL
    echo
fi
if grep "^  C" REPORT; then
    echo
fi
echo "#!/bin/sh" > merge-genchanges
echo "exec $(sed -n -e '/^  $ /s/^  $ //p' REPORT) \"\$@\"" \
    >> merge-genchanges
chmod +x merge-genchanges
echo "#!/bin/sh" > merge-buildpackage
echo "exec $(sed -n -e '/^  $ /s/^  $ dpkg-genchanges/dpkg-buildpackage/p' REPORT) \"\$@\"" \
    >> merge-buildpackage
chmod +x merge-buildpackage
echo "#!/bin/sh" > merge-debuild
echo "exec $(sed -n -e '/^  $ /s/^  $ dpkg-genchanges/debuild/p' REPORT) \"\$@\"" \
    >> merge-debuild
chmod +x merge-debuild
echo "Run ../merge-genchanges , ../merge-buildpackage or ../merge-debuild when done"
if grep "^Vcs-" *.dsc >/dev/null; then
    echo
    echo "*** WARNING ***"
    echo
    echo "It looks like this package is maintained in revision control:"
    echo
    grep "^Vcs-" *.dsc
    echo
    echo "You almost certainly don't want to continue without investigating."
    exit 1
fi
 |