def handle(self, *args, **options): if len(args) != 1: raise CommandError, 'Exactly one argument expected.' username, = args if not view_helpers.GitRepository(username).exists(): sys.exit(1)
def resetrepo(request): if request.method != 'POST': return HttpResponseNotAllowed(['POST']) view_helpers.GitRepository(request.user.username).reset() view_helpers.unset_mission_completed(request.user.get_profile(), 'git_config') view_helpers.unset_mission_completed(request.user.get_profile(), 'git_checkout') view_helpers.unset_mission_completed(request.user.get_profile(), 'git_diff') view_helpers.unset_mission_completed(request.user.get_profile(), 'git_rebase') if 'stay_on_this_page' in request.GET: return HttpResponseRedirect(reverse(main_page)) else: return HttpResponseRedirect(reverse(long_description))
def as_dict_for_template_context(self): (data, person) = self.get_base_data_dict_and_person() if person: repo = view_helpers.GitRepository(self.request.user.username) data.update({ 'repository_exists': repo.exists(), 'git_config_done': view_helpers.mission_completed(person, 'git_config'), 'git_checkout_done': view_helpers.mission_completed(person, 'git_checkout'), 'git_diff_done': view_helpers.mission_completed(person, 'git_diff'), 'git_rebase_done': view_helpers.mission_completed(person, 'git_rebase'), }) if data['repository_exists']: data.update({ 'checkout_url': repo.public_url, }) return data
def handle(self, *args, **options): if len(args) != 1: raise CommandError, 'Exactly one argument expected.' username, = args view_helpers.GitRepository(username).reset()