From c7137076c07ca157279085e7dfbad01741c0d0ea Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 20 2014 09:28:57 +0000 Subject: Add logic into the internal library to edit an issue --- diff --git a/progit/lib.py b/progit/lib.py index f046e11..7fb2337 100644 --- a/progit/lib.py +++ b/progit/lib.py @@ -96,6 +96,25 @@ def new_issue(session, repo, title, content, user): return 'Issue created' +def edit_issue(session, issue, title, content): + ''' Edit the specified issue. + ''' + edit = [] + if title != issue.title: + issue.title = title + edit.append('title') + if content != issue.content: + issue.content = content + edit.append('content') + + if not edit: + return 'No changes to edit' + else: + session.add(issue) + session.flush() + return 'Edited successfully issue #%s' % issue.id + + def fork_project(session, user, repo, repo_folder, fork_folder): ''' Fork a given project into the user's forks. ''' reponame = os.path.join(repo_folder, repo.path)