From 3c9a24394aa0d595f1ce58737599459e9220dfd1 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 7 Apr 2009 09:47:57 +0000 Subject: [PATCH] automate process of transforming a standalone bzr branch into a branch attached to a separate repository --- bzr-move-to-repository | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 bzr-move-to-repository diff --git a/bzr-move-to-repository b/bzr-move-to-repository new file mode 100755 index 0000000..9dfa288 --- /dev/null +++ b/bzr-move-to-repository @@ -0,0 +1,36 @@ +#! /bin/sh -e + +if [ -z "$1" ]; then + echo "Usage: $0 DIRECTORY" >&2 + exit 1 +fi +set -- "${1%/}" +if [ -d "$1.nonrepo" ]; then + echo "$1.nonrepo exists; in-flight collision?" >&2 + exit 1 +fi +if [ ! -d "$1" ]; then + echo "$1 is not a directory!" >&2 + exit 1 +fi +if [ ! -d "$1/.bzr" ]; then + echo "$1 is not a Bazaar branch!" >&2 + exit 1 +fi +if [ ! -d "$1/.bzr/repository" ]; then + echo "$1 seems to already be in a repository!" >&2 + exit 1 +fi +if [ "$(bzr st "$1")" ]; then + echo "$1 has uncommitted changes!" >&2 + exit 1 +fi + +mv -T "$1" "$1.nonrepo" +bzr get "$1.nonrepo" "$1" +cp -a "$1.nonrepo/.bzr/branch/branch.conf" "$1/.bzr/branch/branch.conf" +# oem-config/ubiquity +if [ -d "$1.nonrepo/d-i/source" ] && [ ! -d "$1/d-i/source" ]; then + mv "$1.nonrepo/d-i/source" "$1/d-i/source" +fi +rm -rf "$1.nonrepo" -- 2.30.2