diff --git a/NEWS.txt b/NEWS.txt index c3784ef..0dfd33f 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -1,9 +1,19 @@ News ==== +0.1.1 + +*Release date: March 28, 2012* + +* Fix issue #1 which makes the git-sweep help menus more useful +* Fix a minor grammar issue in the help +* Fix issue #2 which dropped extra options when telling you to use + cleanup +* Added a --force option to skip confirmation prompt + 0.1.0 ----- -*Release date: 0.1.0* +*Release date: n/a* * Initial release diff --git a/setup.py b/setup.py index ec75d8f..e5483d8 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ README = open(os.path.join(here, 'README.rst')).read() NEWS = open(os.path.join(here, 'NEWS.txt')).read() -version = '0.1.0' +version = '0.1.1' install_requires = [ 'GitPython>=0.3.2RC1'] @@ -20,7 +20,17 @@ 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 + 'Development Status :: 4 - Beta', + 'Environment :: Console', + 'License :: OSI Approved :: MIT License', + 'Intended Audience :: Developers', + 'Natural Language :: English', + 'Operating System :: POSIX', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Topic :: Software Development :: Quality Assurance', + 'Topic :: Software Development :: Version Control', + 'Topic :: Text Processing' ], keywords='git maintenance branches', author='Arc90, Inc.', diff --git a/src/gitsweep/cli.py b/src/gitsweep/cli.py index 6b995b5..0912e5b 100644 --- a/src/gitsweep/cli.py +++ b/src/gitsweep/cli.py @@ -140,22 +140,23 @@ def _sweep(self): deleter = Deleter(repo, remote_name=remote_name, master_branch=master_branch) - if not args.force: - sys.stdout.write('\nDelete these branches? (y/n) ') - answer = raw_input() - if args.force or answer.lower().startswith('y'): - sys.stdout.write('\n') - for ref in ok_to_delete: - sys.stdout.write(' deleting {0}'.format(ref.remote_head)) - deleter.remove_remote_refs([ref]) - sys.stdout.write(' (done)\n') - - sys.stdout.write('\nAll done!\n') - sys.stdout.write('\nTell everyone to run `git fetch --prune` ' - 'to sync with this remote.\n') - sys.stdout.write('(you don\'t have to, yours is synced)\n') - else: - sys.stdout.write('\nOK, aborting.\n') + if ok_to_delete: + if not args.force: + sys.stdout.write('\nDelete these branches? (y/n) ') + answer = raw_input() + if args.force or answer.lower().startswith('y'): + sys.stdout.write('\n') + for ref in ok_to_delete: + sys.stdout.write(' deleting {0}'.format(ref.remote_head)) + deleter.remove_remote_refs([ref]) + sys.stdout.write(' (done)\n') + + sys.stdout.write('\nAll done!\n') + sys.stdout.write('\nTell everyone to run `git fetch --prune` ' + 'to sync with this remote.\n') + sys.stdout.write('(you don\'t have to, yours is synced)\n') + else: + sys.stdout.write('\nOK, aborting.\n') elif ok_to_delete: # Replace the first argument with cleanup sysv_copy = self.args[:] diff --git a/src/gitsweep/tests/test_cli.py b/src/gitsweep/tests/test_cli.py index 9ddd6ce..9948a91 100644 --- a/src/gitsweep/tests/test_cli.py +++ b/src/gitsweep/tests/test_cli.py @@ -126,7 +126,7 @@ def test_will_preview_none_found(self): def test_will_cleanup(self): """ - Will preview the proposed deletes. + Will cleanup the proposed deletes. """ for i in range(1, 6): self.command('git checkout -b branch{0}'.format(i)) @@ -164,7 +164,7 @@ def test_will_cleanup(self): def test_will_abort_cleanup(self): """ - Will preview the proposed deletes. + Will abort cleanup on user request """ for i in range(1, 6): self.command('git checkout -b branch{0}'.format(i)) @@ -252,3 +252,15 @@ def test_will_force_clean(self): Tell everyone to run `git fetch --prune` to sync with this remote. (you don't have to, yours is synced) ''', stdout) + + def test_cleanup_no_branches_found(self): + """ + Will not prompt user if no branches are found that can be cleaned up + """ + (retcode, stdout, stderr) = self.gscommand('git-sweep cleanup --force') + + self.assertResults(''' + Fetching from the remote + No remote branches are available for cleaning up + ''', stdout) +