Browse Source

sde-create-manifest: getting started with the code to generate a manifest from a living working tree

user/amery/wip/manifest
Alejandro Mery 15 years ago
parent
commit
187bf03147
1 changed files with 66 additions and 0 deletions
  1. +66
    -0
      bin/sde-create-manifest

+ 66
- 0
bin/sde-create-manifest

@ -0,0 +1,66 @@
#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: bin/sde-create-manifest
# Copyright (C) 2010 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 ---
[ -n "$SDEROOT" ] ||
export SDEROOT="$(cd "${0%/*}/.."; pwd -P)"
. "$SDEROOT/lib/libsde.in"
manifest_svn() {
local dir="${1%/*}" url= url0= dirname=
url="$(cd "$dir"; LANG=C svn info | grep ^URL: | cut -d' ' -f2-)"
if [ "$dir" != '.' -a -d "$dir/../.svn" ]; then
# parent is also svn
url0="${url%/*}"
if (cd "$dir/.."; LANG=C svn info 2> /dev/null) | grep -q "^URL: $url0\$"; then
return
fi
fi
echo "$dir $url"
}
manifest_git() {
local dir="${1%/*}" branch=
local repo= proto=
repo=$(GIT_DIR="$1" git config --get remote.origin.url)
proto=${repo%%://*}
case "$proto" in
ssh) proto="git+ssh"
repo=$proto://${repo#*://}
;;
esac
echo "$dir $repo"
}
cd "$SDEROOT" || exit 1
# root
if [ -d ".git" ]; then
manifest_git ./.git
elif [ -f ".svn" ]; then
manifest_svn ./.svn
else
echo_error ".: unknown vcs"
fi
for d in $(find target src package -type d -name '.git'); do
manifest_git $d
done
for d in $(find target src package -type d -name '.svn'); do
manifest_svn $d
done

Loading…
Cancel
Save