Skip to content

Commit 4f1fadf

Browse files
committed
Some initial project skeleton stuff
1 parent 220a10b commit 4f1fadf

File tree

7 files changed

+232
-0
lines changed

7 files changed

+232
-0
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.pyc
2+
3+
.installed.cfg
4+
bin
5+
develop-eggs
6+
7+
*.egg-info
8+
9+
tmp
10+
build
11+
dist

MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
include README.rst
2+
include NEWS.txt

README.rst

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
git-sweep
2+
=========
3+
4+
A command-line tool that helps you clean up Git branches that have been merged
5+
into master.
6+
7+
One of the best features of Git is cheap branches. There are existing branching
8+
models like `GitHub Flow`_ and Vincent Driessen's `git-flow`_ that describe
9+
methods for using this feature.
10+
11+
The problem
12+
-----------
13+
14+
Your ``master`` branch is typically where all your code lands. All features
15+
branches are meant to be short-lived and merged into ``master`` once they are
16+
completed.
17+
18+
As time marches on, you can build up **a long list of branches that are no
19+
longer needed**. They've been merged into ``master``, what do we do with them
20+
now?
21+
22+
The answer
23+
----------
24+
25+
Using ``git-sweep`` you can *safely remove remote branches that have been
26+
merged into master*.
27+
28+
Try it for yourself (safely)
29+
----------------------------
30+
31+
::
32+
33+
$ git-sweep preview
34+
35+
::
36+
37+
$ git-sweep cleanup
38+
Are you sure you wish to delete 15 remote branches (y/n)?
39+
40+
::
41+
42+
Instructions for having your team sync their branches
43+
44+
Requirements:
45+
-------------
46+
47+
* Git >= 1.7
48+
* Python >= 2.6
49+
50+
.. _GitHub Flow: http://scottchacon.com/2011/08/31/github-flow.html
51+
.. _git-flow: http://nvie.com/posts/a-successful-git-branching-model/

bootstrap.py

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
##############################################################################
2+
#
3+
# Copyright (c) 2006 Zope Corporation and Contributors.
4+
# All Rights Reserved.
5+
#
6+
# This software is subject to the provisions of the Zope Public License,
7+
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
8+
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9+
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10+
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11+
# FOR A PARTICULAR PURPOSE.
12+
#
13+
##############################################################################
14+
"""Bootstrap a buildout-based project
15+
16+
Simply run this script in a directory containing a buildout.cfg.
17+
The script accepts buildout command-line options, so you can
18+
use the -c option to specify an alternate configuration file.
19+
20+
$Id: bootstrap.py 102545 2009-08-06 14:49:47Z chrisw $
21+
"""
22+
23+
import os, shutil, sys, tempfile, urllib2
24+
from optparse import OptionParser
25+
26+
tmpeggs = tempfile.mkdtemp()
27+
28+
is_jython = sys.platform.startswith('java')
29+
30+
# parsing arguments
31+
parser = OptionParser()
32+
parser.add_option("-v", "--version", dest="version",
33+
help="use a specific zc.buildout version")
34+
parser.add_option("-d", "--distribute",
35+
action="store_true", dest="distribute", default=True,
36+
help="Use Disribute rather than Setuptools.")
37+
38+
options, args = parser.parse_args()
39+
40+
if options.version is not None:
41+
VERSION = '==%s' % options.version
42+
else:
43+
VERSION = ''
44+
45+
USE_DISTRIBUTE = options.distribute
46+
args = args + ['bootstrap']
47+
48+
to_reload = False
49+
try:
50+
import pkg_resources
51+
if not hasattr(pkg_resources, '_distribute'):
52+
to_reload = True
53+
raise ImportError
54+
except ImportError:
55+
ez = {}
56+
if USE_DISTRIBUTE:
57+
exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py'
58+
).read() in ez
59+
ez['use_setuptools'](to_dir=tmpeggs, download_delay=0, no_fake=True)
60+
else:
61+
exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
62+
).read() in ez
63+
ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
64+
65+
if to_reload:
66+
reload(pkg_resources)
67+
else:
68+
import pkg_resources
69+
70+
if sys.platform == 'win32':
71+
def quote(c):
72+
if ' ' in c:
73+
return '"%s"' % c # work around spawn lamosity on windows
74+
else:
75+
return c
76+
else:
77+
def quote (c):
78+
return c
79+
80+
cmd = 'from setuptools.command.easy_install import main; main()'
81+
ws = pkg_resources.working_set
82+
83+
if USE_DISTRIBUTE:
84+
requirement = 'distribute'
85+
else:
86+
requirement = 'setuptools'
87+
88+
if is_jython:
89+
import subprocess
90+
91+
assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd',
92+
quote(tmpeggs), 'zc.buildout' + VERSION],
93+
env=dict(os.environ,
94+
PYTHONPATH=
95+
ws.find(pkg_resources.Requirement.parse(requirement)).location
96+
),
97+
).wait() == 0
98+
99+
else:
100+
assert os.spawnle(
101+
os.P_WAIT, sys.executable, quote (sys.executable),
102+
'-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout' + VERSION,
103+
dict(os.environ,
104+
PYTHONPATH=
105+
ws.find(pkg_resources.Requirement.parse(requirement)).location
106+
),
107+
) == 0
108+
109+
ws.add_entry(tmpeggs)
110+
ws.require('zc.buildout' + VERSION)
111+
import zc.buildout.buildout
112+
zc.buildout.buildout.main(args)
113+
shutil.rmtree(tmpeggs)

buildout.cfg

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[buildout]
2+
parts = python scripts
3+
develop = .
4+
eggs = git-sweep
5+
6+
[python]
7+
recipe = zc.recipe.egg
8+
interpreter = python
9+
eggs = ${buildout:eggs}
10+
11+
[scripts]
12+
recipe = zc.recipe.egg:scripts
13+
eggs = ${buildout:eggs}

setup.py

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
from setuptools import setup, find_packages
2+
import sys, os
3+
4+
here = os.path.abspath(os.path.dirname(__file__))
5+
README = open(os.path.join(here, 'README.rst')).read()
6+
NEWS = open(os.path.join(here, 'NEWS.txt')).read()
7+
8+
9+
version = '0.1'
10+
11+
install_requires = [
12+
# List your project dependencies here.
13+
# For more details, see:
14+
# http://packages.python.org/distribute/setuptools.html#declaring-dependencies
15+
]
16+
17+
18+
setup(name='git-sweep',
19+
version=version,
20+
description="Clean up branches from your Git remotes",
21+
long_description=README + '\n\n' + NEWS,
22+
classifiers=[
23+
# Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
24+
],
25+
keywords='git maintenance branches',
26+
author='Arc90, Inc.',
27+
author_email='',
28+
url='http://arc90.com',
29+
license='MIT',
30+
packages=find_packages('src'),
31+
package_dir = {'': 'src'},include_package_data=True,
32+
zip_safe=False,
33+
install_requires=install_requires,
34+
entry_points={
35+
'console_scripts':
36+
['git-sweep=gitsweep:main']
37+
}
38+
)

src/gitsweep/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Example package with a console entry point
2+
3+
def main():
4+
print "Hello World"

0 commit comments

Comments
 (0)