Browse Source

sde-create: Introduced tree discriminator, creating a new working tree

karasz/new-early
Alejandro Mery 17 years ago
parent
commit
3ff9347b53
1 changed files with 75 additions and 0 deletions
  1. +75
    -0
      bin/sde-create-tree

+ 75
- 0
bin/sde-create-tree

@ -0,0 +1,75 @@
#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: bin/sde-create-tree
# Copyright (C) 2008 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
#Description: Creates a new OpenSDE working tree
[ -n "$SDEROOT" ] ||
export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
. "$SDEROOT/lib/libsde.in"
create_usage() {
local progname=${0##*/}
echo "Usage: ${progname//-/ } <dirname>"
}
create_origin()
{
if [ -d "$SDEROOT/.git/" ]; then
GIT_DIR="$SDEROOT/.git" git config remote.origin.url
fi
}
shortopts=''
longopts=''
options=$( getopt -o "$shortopts" -l "$longopts" -- "$@" )
if [ $? -ne 0 ]; then
create_usage
exit -1
fi
# load new arguments list
eval set -- "$options"
while [ $# -gt 0 ]; do
case "$1" in
--) shift; break ;;
esac
shift
done
# dirname
if [ $# -ne 1 ]; then
create_usage
exit 1
fi
here=$(pwd -P)
if [ "$SDEROOT" = "$here" ] || expr "$here" : "$SDEROOT/" > /dev/null; then
echo_abort 1 "Already inside a working tree."
fi
origin=$(create_origin)
origin="${origin:-git://git.opensde.net/opensde/opensde-nopast.git}"
target="$1"
echo_info "Cloning $origin"
if git clone "$origin" "$target"; then
cd "$target"
export SDEROOT="$(pwd -P)"
exec sde up
fi

Loading…
Cancel
Save