forked from 0k/0k-charms
root
12 years ago
5 changed files with 56 additions and 139 deletions
-
47precise/git/hooks/install
-
2precise/git/revision
-
13precise/git/src/patch/bzr-fastimport/btree-except.patch
-
129precise/git/src/sbin/git-bzr-syncs
-
2precise/openerp/hooks/install
@ -1 +1 @@ |
|||
0 |
|||
1 |
@ -0,0 +1,13 @@ |
|||
=== modified file 'revision_store.py'
|
|||
--- revision_store.py 2012-01-10 08:48:02 +0000
|
|||
+++ revision_store.py 2013-06-13 13:42:59 +0000
|
|||
@@ -170,7 +170,7 @@
|
|||
""" |
|||
self.repo = repo |
|||
self._graph = None |
|||
- self._use_known_graph = True
|
|||
+ self._use_known_graph = False
|
|||
self._supports_chks = getattr(repo._format, 'supports_chks', False) |
|||
|
|||
def expects_rich_root(self): |
|||
|
@ -1,129 +0,0 @@ |
|||
#!/bin/bash |
|||
|
|||
. /etc/shlib |
|||
|
|||
include common |
|||
include pretty |
|||
|
|||
|
|||
devdir=/srv/git-bzr-mirrors |
|||
conf_file="/etc/git-bzr-syncs/git-bzr-syncs.conf" |
|||
|
|||
if ! [ -f "$conf_file" ]; then |
|||
print_error "No config file found in '$conf_file'." |
|||
fi |
|||
|
|||
|
|||
modules_branch=$(cat "$conf_file" | egrep -v ^\s*# | egrep -v ^\$) |
|||
|
|||
## get branch from bzr_branch |
|||
function get_bzr_remote_branch() { |
|||
git config -l | grep "^bzr\.bzr/.*\.upstream=$1$" | |
|||
sed -r "s,^bzr\.(bzr/.*)\.upstream=.*$,\1," |
|||
|
|||
} |
|||
|
|||
function get_bzr_local_branch() { |
|||
git config -l | grep "^bzr\..*\.bzr=$1" | |
|||
sed -r "s,^bzr\.(.*)\.bzr=.*$,\1,g" | |
|||
## This is because git-bzr-ng do not support "/" in branches names |
|||
grep -v "/" | |
|||
head -n 1 |
|||
} |
|||
|
|||
function get_current_branch() { |
|||
local branch |
|||
branch=$(git symbolic-ref HEAD) |
|||
echo "${branch#refs/heads/}" |
|||
} |
|||
|
|||
function git_pull_remote_bzr() { |
|||
Wrap git checkout "$1" && |
|||
Wrap git bzr sync && |
|||
Wrap git merge --ff-only "$2" || exit 1 |
|||
## remove bogus tags |
|||
export bogus_tags=$(git tag -l | grep ^openerp-build) |
|||
Wrap -d "delete $(echo "$bogus_tags" | wc -l ) bogus tags" 'echo "$bogus_tags" | xargs -n 20 git tag -d ' || exit 1 |
|||
} |
|||
|
|||
function get_bzr_official_branch() { |
|||
|
|||
git config -l | grep "^branch\..*\.follow-git-bzr=$1$" | |
|||
sed -r "s,^branch\.(.*)\.follow-git-bzr=.*$,\1,g" | |
|||
## This is because git-bzr-ng do not support "/" in branches names |
|||
head -n 1 |
|||
: |
|||
} |
|||
|
|||
function git_update_official() { |
|||
update_to=$(git config branch.$1.follow-git-bzr) |
|||
|
|||
## XXXvlab: this should be better but current git version is not |
|||
## supporting "-B" |
|||
#Wrap git checkout -B "$1" "$update_to" |
|||
|
|||
if git branch "$1" >/dev/null 2>&1 ; then |
|||
Elt "Created branch $YELLOW$1$NORMAL"; Feed |
|||
fi |
|||
Wrap git checkout "$1" && |
|||
Wrap git reset --hard "$update_to" || exit 1 |
|||
} |
|||
|
|||
if [ "$1" ]; then |
|||
modules_branch=$(echo "$modules_branch" | grep "^$1=") |
|||
fi |
|||
|
|||
for line in $modules_branch; do |
|||
dir=$(echo "$line" | cut -f 1 -d "=") |
|||
bzr_branches=$(echo "$line" | cut -f 2- -d "=" | tr "," "\n") |
|||
Title Repository $YELLOW$dir$NORMAL |
|||
for bzr_branch in $bzr_branches; do |
|||
if ! [ -d "$devdir/$dir" ]; then |
|||
echo " You must clone your git repository in $devdir/$dir." |
|||
echo |
|||
echo " git clone GIT_REPO_URL $devdir/$dir" |
|||
echo " OR git bzr clone GIT_REPO_URL $devdir/$dir" |
|||
echo |
|||
print_error "No repository found in $devdir/$dir." |
|||
fi |
|||
cd "$devdir/$dir" |
|||
git_bzr_remote_branch="$(get_bzr_remote_branch $bzr_branch)" |
|||
if [ -z "$git_bzr_remote_branch" ]; then |
|||
echo " You must do the first 'git bzr' import yourself:" |
|||
echo |
|||
echo " git bzr import lp:LP_BRANCH LOCAL_BZR_BRANCH" |
|||
echo |
|||
echo " ie: git bzr import lp:openobject-addons/7.0 openobject-addons-7.0" |
|||
echo |
|||
print_error "bzr branch $bzr_branch was not configured in $dir repository." |
|||
fi |
|||
#echo " BZR REMOTE: $git_bzr_remote_branch" |
|||
git_bzr_local_branch="$(get_bzr_local_branch $git_bzr_remote_branch)" |
|||
|
|||
if [ -z "$git_bzr_local_branch" ]; then |
|||
print_error "git bzr remote branch $git_bzr_remote_branch was not linked to a branch in $dir repository." |
|||
fi |
|||
#echo " BZR LOCAL: $git_bzr_local_branch" |
|||
current_branch=$(get_current_branch) |
|||
if [ "$(git diff)" ]; then |
|||
print_error "Repository $dir is not clean." |
|||
fi |
|||
git_bzr_official_branch="$(get_bzr_official_branch $git_bzr_local_branch)" |
|||
|
|||
if [ -z "$git_bzr_official_branch" ]; then |
|||
echo " You must link $git_bzr_local_branch branch to the branch managed by 'git bzr'." |
|||
echo |
|||
echo " git config branch.$git_bzr_local_branch.follow-git-bzr LOCAL_BZR_BRANCH" |
|||
echo |
|||
print_error "git bzr local branch $git_bzr_local_branch was not linked to an official branch in $dir repository." |
|||
fi |
|||
Section "sync branch $YELLOW$git_bzr_official_branch$NORMAL" |
|||
Elt bzr branch: $YELLOW$bzr_branch$NORMAL ; Feed |
|||
Elt git intermediary branch: $YELLOW$git_bzr_local_branch$NORMAL ; Feed |
|||
|
|||
git_pull_remote_bzr "$git_bzr_local_branch" "$git_bzr_remote_branch" |
|||
git_update_official "$git_bzr_official_branch" |
|||
Wrap git push origin "$git_bzr_official_branch" || exit 1 |
|||
Wrap git push --tags || exit 1 |
|||
done |
|||
done |
Write
Preview
Loading…
Cancel
Save
Reference in new issue