Permalink
Browse files

Some initial project skeleton stuff

  • Loading branch information...
1 parent 220a10b commit 4f1fadfae22ff4e0067a74c54577da4da4aa16c7 @robmadole robmadole committed Mar 16, 2012
Showing with 232 additions and 0 deletions.
  1. +11 −0 .gitignore
  2. +2 −0 MANIFEST.in
  3. +51 −0 README.rst
  4. +113 −0 bootstrap.py
  5. +13 −0 buildout.cfg
  6. +38 −0 setup.py
  7. +4 −0 src/gitsweep/__init__.py
View
@@ -0,0 +1,11 @@
+*.pyc
+
+.installed.cfg
+bin
+develop-eggs
+
+*.egg-info
+
+tmp
+build
+dist
View
@@ -0,0 +1,2 @@
+include README.rst
+include NEWS.txt
View
@@ -0,0 +1,51 @@
+git-sweep
+=========
+
+A command-line tool that helps you clean up Git branches that have been merged
+into master.
+
+One of the best features of Git is cheap branches. There are existing branching
+models like `GitHub Flow`_ and Vincent Driessen's `git-flow`_ that describe
+methods for using this feature.
+
+The problem
+-----------
+
+Your ``master`` branch is typically where all your code lands. All features
+branches are meant to be short-lived and merged into ``master`` once they are
+completed.
+
+As time marches on, you can build up **a long list of branches that are no
+longer needed**. They've been merged into ``master``, what do we do with them
+now?
+
+The answer
+----------
+
+Using ``git-sweep`` you can *safely remove remote branches that have been
+merged into master*.
+
+Try it for yourself (safely)
+----------------------------
+
+::
+
+ $ git-sweep preview
+
+::
+
+ $ git-sweep cleanup
+ Are you sure you wish to delete 15 remote branches (y/n)?
+
+::
+
+ Instructions for having your team sync their branches
+
+Requirements:
+-------------
+
+* Git >= 1.7
+* Python >= 2.6
+
+.. _GitHub Flow: http://scottchacon.com/2011/08/31/github-flow.html
+.. _git-flow: http://nvie.com/posts/a-successful-git-branching-model/
View
@@ -0,0 +1,113 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id: bootstrap.py 102545 2009-08-06 14:49:47Z chrisw $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+from optparse import OptionParser
+
+tmpeggs = tempfile.mkdtemp()
+
+is_jython = sys.platform.startswith('java')
+
+# parsing arguments
+parser = OptionParser()
+parser.add_option("-v", "--version", dest="version",
+ help="use a specific zc.buildout version")
+parser.add_option("-d", "--distribute",
+ action="store_true", dest="distribute", default=True,
+ help="Use Disribute rather than Setuptools.")
+
+options, args = parser.parse_args()
+
+if options.version is not None:
+ VERSION = '==%s' % options.version
+else:
+ VERSION = ''
+
+USE_DISTRIBUTE = options.distribute
+args = args + ['bootstrap']
+
+to_reload = False
+try:
+ import pkg_resources
+ if not hasattr(pkg_resources, '_distribute'):
+ to_reload = True
+ raise ImportError
+except ImportError:
+ ez = {}
+ if USE_DISTRIBUTE:
+ exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py'
+ ).read() in ez
+ ez['use_setuptools'](to_dir=tmpeggs, download_delay=0, no_fake=True)
+ else:
+ exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+ ).read() in ez
+ ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+ if to_reload:
+ reload(pkg_resources)
+ else:
+ import pkg_resources
+
+if sys.platform == 'win32':
+ def quote(c):
+ if ' ' in c:
+ return '"%s"' % c # work around spawn lamosity on windows
+ else:
+ return c
+else:
+ def quote (c):
+ return c
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+ws = pkg_resources.working_set
+
+if USE_DISTRIBUTE:
+ requirement = 'distribute'
+else:
+ requirement = 'setuptools'
+
+if is_jython:
+ import subprocess
+
+ assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
+ quote(tmpeggs), 'zc.buildout' + VERSION],
+ env=dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse(requirement)).location
+ ),
+ ).wait() == 0
+
+else:
+ assert os.spawnle(
+ os.P_WAIT, sys.executable, quote (sys.executable),
+ '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout' + VERSION,
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse(requirement)).location
+ ),
+ ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout' + VERSION)
+import zc.buildout.buildout
+zc.buildout.buildout.main(args)
+shutil.rmtree(tmpeggs)
View
@@ -0,0 +1,13 @@
+[buildout]
+parts = python scripts
+develop = .
+eggs = git-sweep
+
+[python]
+recipe = zc.recipe.egg
+interpreter = python
+eggs = ${buildout:eggs}
+
+[scripts]
+recipe = zc.recipe.egg:scripts
+eggs = ${buildout:eggs}
View
@@ -0,0 +1,38 @@
+from setuptools import setup, find_packages
+import sys, os
+
+here = os.path.abspath(os.path.dirname(__file__))
+README = open(os.path.join(here, 'README.rst')).read()
+NEWS = open(os.path.join(here, 'NEWS.txt')).read()
+
+
+version = '0.1'
+
+install_requires = [
+ # List your project dependencies here.
+ # For more details, see:
+ # http://packages.python.org/distribute/setuptools.html#declaring-dependencies
+]
+
+
+setup(name='git-sweep',
+ version=version,
+ description="Clean up branches from your Git remotes",
+ long_description=README + '\n\n' + NEWS,
+ classifiers=[
+ # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
+ ],
+ keywords='git maintenance branches',
+ author='Arc90, Inc.',
+ author_email='',
+ url='http://arc90.com',
+ license='MIT',
+ packages=find_packages('src'),
+ package_dir = {'': 'src'},include_package_data=True,
+ zip_safe=False,
+ install_requires=install_requires,
+ entry_points={
+ 'console_scripts':
+ ['git-sweep=gitsweep:main']
+ }
+)
View
@@ -0,0 +1,4 @@
+# Example package with a console entry point
+
+def main():
+ print "Hello World"

0 comments on commit 4f1fadf

Please sign in to comment.