[projects/git-slug: 123/170] ADC to move repositories

glen glen at pld-linux.org
Mon Sep 21 21:49:09 CEST 2015


commit 8f6b6dc85abb2a34446898c7b381f8c13aeeeab6
Author: Kacper Kornet <draenog at pld-linux.org>
Date:   Tue Jun 26 20:10:12 2012 +0100

    ADC to move repositories

 adc/move | 27 +++++++++++++++++++++++++++
 setup.py |  2 +-
 2 files changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/adc/move b/adc/move
new file mode 100755
index 0000000..bd6b25f
--- /dev/null
+++ b/adc/move
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+. $(dirname $0)/adc.common-functions
+
+[ "$#" -ne 2 ] && die 'Error: move <repo1> <repo2>'
+[ -n "$WATCHDIR" ] || die 'Error: WATCHDIR not set'
+[ -d "$WATCHDIR" ] || die "Error: $WATCHDIR does not exist"
+
+EMPTYSHA1='0000000000000000000000000000000000000000'
+
+move_from="${1%.git}"
+move_from_full="$GL_REPO_BASE_ABS/packages/${move_from}.git"
+get_rights_and_owner "packages/${move_from}"
+[ -z "$perm_write" ] && die "Error: You do not have permission to lock this repository"
+[ -d $move_from_full ] || die "Error: repository $move_from doesn't exist"
+
+move_to="${2%.git}"
+move_to_full="$GL_REPO_BASE_ABS/packages/${move_from}.git"
+$(dirname $0)/create "$move_to" || die "Error in creating new repo"
+
+echo "Repository moved by $GL_USER to $2" >> $move_from_full/.gitolite.down
+git --git-dir="$move_to_full" fetch "$move_from_full" 'refs/*:refs/*'
+
+( echo $GL_USER
+  echo "$move_to"
+  GIT_DIR=$move_to_full git for-each-ref  --format="$EMPTYSHA1 %(objectname)  %(refname)" refs/heads/\*
+  ) > $WATCHDIR/$2.$$
diff --git a/setup.py b/setup.py
index 969de8c..101cf82 100644
--- a/setup.py
+++ b/setup.py
@@ -10,6 +10,6 @@ setup(name='git-core-slug',
       url='https://github.com/draenog/slug',
       classifiers=['Programming Language :: Python :: 3'],
       packages=['git_slug', 'Daemon'],
-      data_files=[('adc/bin', ['adc/trash'])],
+      data_files=[('adc/bin', ['adc/trash', 'adc/move'])],
       scripts=['slug.py', 'slug_watch']
      )
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4ed64f73960519a2f4fd04c42950b2c96ae795c5



More information about the pld-cvs-commit mailing list