1. George Notaras
  2. bucket2hub

Commits

George Notaras  committed fb063ae

Added initial files.

  • Participants
  • Branches default

Comments (0)

Files changed (3)

File repolist

Empty file added.

File sync.sh

View file
+#! /usr/bin/env bash
+
+function usage {
+    echo "`basename $0` <username> [<repo>]"
+    exit 1
+}
+
+# Set paths
+
+# Check command line arguments
+if [ $# -lt 1 ] ; then
+    usage
+fi
+
+# Store username
+USERNAME=$1
+echo "Using username: $USERNAME"
+
+# Determine repository list
+if [ -z $2 ]; then
+    # No repository has been provided
+    REPOLIST=`cat repolist`
+else
+    REPOLIST=$2
+fi
+
+
+CURDIR=`pwd`
+
+for repo in $REPOLIST ; do
+
+    cd bitbucket
+    if [ ! -d $repo ] ; then
+        hg clone --noupdate ssh://hg@bitbucket.org/$USERNAME/$repo
+    else
+        cd $repo
+        hg pull
+    fi
+
+    cd $CURDIR
+
+    cd github
+    if [ ! -d $repo ] ; then
+        git init $repo
+        cd $repo
+        git remote add origin ssh://git@github.com/$USERNAME/$repo.git
+        
+    else
+        cd $repo
+        hg pull
+    fi
+
+    # Convert mercurial repo
+    sh ../../lib/fast-export/hg-fast-export.sh -r ../../bitbucket/$repo
+
+    # Push to github
+    git push -u origin master
+    
+    cd $CURDIR
+
+done
+

File update_lib.sh

View file
+#! /usr/bin/env bash
+
+# Create the lib directory if missing
+[ ! -d lib ] && mkdir lib
+
+# Also create directories for bitbucket and github repositories
+[ ! -d bitbucket ] && mkdir bitbucket
+[ ! -d github ] && mkdir github
+
+
+cd lib
+
+# Update fast-export
+if [ ! -d fast-export ] ; then
+    git clone git://repo.or.cz/fast-export.git
+else
+    cd fast-export
+    git pull
+    cd ..   # lib/
+fi
+
+echo Finished