chiark / gitweb /
hacky exim queue admin helpers
[bin.git] / bzr-move-to-repository
1 #! /bin/sh -e
2
3 if [ -z "$1" ]; then
4         echo "Usage: $0 DIRECTORY" >&2
5         exit 1
6 fi
7 set -- "${1%/}"
8 if [ -d "$1.nonrepo" ]; then
9         echo "$1.nonrepo exists; in-flight collision?" >&2
10         exit 1
11 fi
12 if [ ! -d "$1" ]; then
13         echo "$1 is not a directory!" >&2
14         exit 1
15 fi
16 if [ ! -d "$1/.bzr" ]; then
17         echo "$1 is not a Bazaar branch!" >&2
18         exit 1
19 fi
20 if [ ! -d "$1/.bzr/repository" ]; then
21         echo "$1 seems to already be in a repository!" >&2
22         exit 1
23 fi
24 if [ "$(bzr st "$1")" ]; then
25         echo "$1 has uncommitted changes!" >&2
26         exit 1
27 fi
28
29 mv -T "$1" "$1.nonrepo"
30 bzr get "$1.nonrepo" "$1"
31 cp -a "$1.nonrepo/.bzr/branch/branch.conf" "$1/.bzr/branch/branch.conf"
32 # oem-config/ubiquity
33 if [ -d "$1.nonrepo/d-i/source" ] && [ ! -d "$1/d-i/source" ]; then
34         mv "$1.nonrepo/d-i/source" "$1/d-i/source"
35 fi
36 rm -rf "$1.nonrepo"