Add a couple other files, some of which are actively used, some of which are "legacy"
Adding LICENSE as well to note that all files unless otherwise noted are under the MIT license
This commit is contained in:
parent
64f55bfbd5
commit
4bee3c66fa
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2008 Slide, Inc
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
|
@ -0,0 +1,42 @@
|
|||
#!/usr/local/bin/python
|
||||
|
||||
import getpass
|
||||
import os
|
||||
import readline
|
||||
import sys
|
||||
|
||||
USAGE = ''' usage: davgit.py [push/pull]
|
||||
'''
|
||||
|
||||
NET_RC = '''
|
||||
machine your.webdav.server.with.auth
|
||||
login USER_LOGIN
|
||||
password USER_PASSWORD
|
||||
'''
|
||||
ENV_PASS_KEY = 'GIT_WEBDAV_SIGNED_PASSWORD'
|
||||
|
||||
|
||||
def main():
|
||||
if not len(sys.argv) > 1:
|
||||
print USAGE
|
||||
return
|
||||
try:
|
||||
os.environ['GIT_SSL_NO_VERIFY'] = '1'
|
||||
user = getpass.getuser()
|
||||
password = os.getenv(ENV_PASS_KEY)
|
||||
if not password:
|
||||
password = getpass.getpass('LDAP Password: ')
|
||||
# Generate the ~/.netrc file that git-over-https needs to properly pass authentication via libcurl
|
||||
netrc = os.open(os.path.expanduser('~/.netrc'), os.O_CREAT | os.O_WRONLY)
|
||||
os.write(netrc, NET_RC.replace('USER_LOGIN', user).replace('USER_PASSWORD', password))
|
||||
os.close(netrc)
|
||||
|
||||
# Needed to properly pass on extra args to `git pull` like:
|
||||
# `davgit.py pull origin master` -> `git pull origin master`
|
||||
os.system('git %s' % ' '.join(sys.argv[1:]))
|
||||
finally:
|
||||
os.remove(os.path.expanduser('~/.netrc'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/local/bin/python
|
||||
|
||||
import optparse
|
||||
import os
|
||||
|
||||
if __name__ == '__main__':
|
||||
op = optparse.OptionParser()
|
||||
op.add_option('-r', '--repos', dest='repos', help='Specify the repositories to pull from ( repo1,repo2,repo3 )')
|
||||
op.add_option('-b', '--branch', dest='branch', help='Specify the branch to pull from the respective repositories')
|
||||
|
||||
opts, args = op.parse_args()
|
||||
|
||||
if not opts.repos or not opts.branch:
|
||||
print ' *** Incomplete parameters ***'
|
||||
print
|
||||
print ' Please run this script with -h, and use the appropriate options'
|
||||
exit
|
||||
|
||||
repos = opts.repos.split(',')
|
||||
repos = map(lambda r: r.strip(), repos)
|
||||
branch = opts.branch.strip()
|
||||
|
||||
rc = os.system('git checkout %s' % (branch))
|
||||
repos.reverse()
|
||||
while rc == 0 and len(repos):
|
||||
repo = repos.pop()
|
||||
print 'Pulling from %s:%s' % (repo, branch)
|
||||
rc = os.system('git pull %s %s' % (repo, branch))
|
||||
if rc:
|
||||
print 'Crap! Some sort failure occurred, resolve and rerun :)'
|
||||
exit
|
||||
print 'YAY! All done'
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
'''
|
||||
This post-commit hook is intended to be used to send "GITCOMMIT" emails to
|
||||
the specified target address.
|
||||
|
||||
The mails sent to the specified address look something like this
|
||||
|
||||
From: tyler@slide.com
|
||||
To: commits@slide.com
|
||||
Subject: GITCOMMIT [$MACHINE/$BRANCH] Minor change (ce0520c)
|
||||
|
||||
commit ce0520ceebb756aee7fce58f4fd643a6bca349d8
|
||||
Author: R. Tyler Ballance <tyler@slide.com>
|
||||
Date: Thu Dec 4 10:37:55 2008 -0800
|
||||
|
||||
Minor change
|
||||
|
||||
diff --git a/file b/file
|
||||
index bc1f44a..4468922 100644
|
||||
--- a/file
|
||||
+++ b/file
|
||||
@@ -992,28 +992,5 @@
|
||||
|
||||
$DIFF
|
||||
'''
|
||||
|
||||
import getpass
|
||||
import os
|
||||
import socket
|
||||
import smtplib
|
||||
import sys
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
SMTP_SERVER = 'smtp.your.com'
|
||||
MAIL_SUFFIX = '@your.com'
|
||||
|
||||
def mail_commit(address):
|
||||
user = os.getenv('PG_USER') or getpass.getuser()
|
||||
machine = socket.gethostname()
|
||||
base_git_cmd = 'git log --max-count=1 --no-color --no-merges --author=%s' % (user)
|
||||
branch = os.popen('git branch --no-color | grep "* " | sed \'s/* //g\'').read().rstrip()
|
||||
commit_diff = os.popen('%s --unified=4 --pretty=medium' % base_git_cmd).read().rstrip()
|
||||
mail_subject = os.popen('%s --pretty=format:"%%s (%%h)"' % (base_git_cmd)).read().rstrip()
|
||||
mail_subject = 'GITCOMMIT [%s/%s] %s' % (machine, branch, mail_subject)
|
||||
|
||||
print 'Sending a commit mail to %s' % (address)
|
||||
|
||||
s = smtplib.SMTP(SMTP_SERVER)
|
||||
sender = os.getenv('GIT_FROM') or ('%s%s' % (user, MAIL_SUFFIX))
|
||||
message = 'From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s' % (sender, address, mail_subject, commit_diff)
|
||||
s.sendmail('%s%s' % (user, MAIL_SUFFIX), [address], message)
|
||||
s.quit()
|
||||
|
||||
if __name__ == '__main__':
|
||||
op = OptionParser()
|
||||
op.add_option('-m', '--mail', dest='address', help='Email address to mail commit messages to')
|
||||
opts, args = op.parse_args()
|
||||
|
||||
if not opts.address:
|
||||
print '*** You need to specify a mailing address! ***'
|
||||
exit
|
||||
|
||||
mail_commit(opts.address)
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
#!/bin/bash
|
||||
|
||||
MERGE_BRANCH=mergemaster
|
||||
REPO=$1
|
||||
BRANCH=$2
|
||||
|
||||
if [[ -z "${1}" || -z "${2}" ]]; then
|
||||
echo "===> You must provide a \"remote\" and a \"refspec\" for Git to use!"
|
||||
echo "===> Exiting :("
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
LATEST_COMMIT=`git log --max-count=1 --no-merges --pretty=format:"%H"`
|
||||
|
||||
function master
|
||||
{
|
||||
echo "==> Making sure we're on 'master'"
|
||||
git checkout master
|
||||
}
|
||||
|
||||
function setup_mergemaster
|
||||
{
|
||||
master
|
||||
echo "==> Killing the old mergemaster branch"
|
||||
git branch -D $MERGE_BRANCH
|
||||
|
||||
echo "==> Creating a new mergemaster branch"
|
||||
git checkout -b $MERGE_BRANCH
|
||||
git checkout master
|
||||
}
|
||||
|
||||
function cleanup
|
||||
{
|
||||
rm -f .git/SVNPULL_MSG
|
||||
}
|
||||
|
||||
function prepare_message
|
||||
{
|
||||
master
|
||||
|
||||
echo "===> Pulling from ${REPO}:${BRANCH}"
|
||||
git pull ${REPO} ${BRANCH}
|
||||
git checkout ${MERGE_BRANCH}
|
||||
|
||||
echo "==> Merging across change from master to ${MERGE_BRANCH}"
|
||||
git pull --no-commit --squash . master
|
||||
|
||||
cp .git/SQUASH_MSG .git/SVNPULL_MSG
|
||||
|
||||
master
|
||||
}
|
||||
|
||||
function merge_to_svn
|
||||
{
|
||||
git reset --hard ${LATEST_COMMIT}
|
||||
master
|
||||
setup_mergemaster
|
||||
|
||||
echo "===> Pulling from ${REPO}:${BRANCH}"
|
||||
git pull ${REPO} ${BRANCH}
|
||||
git checkout ${MERGE_BRANCH}
|
||||
|
||||
echo "==> Merging across change from master to ${MERGE_BRANCH}"
|
||||
git pull --no-commit --squash . master
|
||||
|
||||
echo "==> Committing..."
|
||||
git commit -a -F .git/SVNPULL_MSG && git-svn dcommit --no-rebase
|
||||
|
||||
cleanup
|
||||
}
|
||||
|
||||
setup_mergemaster
|
||||
|
||||
prepare_message
|
||||
|
||||
merge_to_svn
|
||||
|
||||
master
|
||||
|
||||
echo "===> All done!"
|
||||
|
Loading…
Reference in New Issue