-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to rbt patch for automatically creating a Git commit
The option -c, --commit automatically creates a commit in the current local branch with the summary, description, bugs, testing, and author information fetched from the review request. Testing done: Tested with a new review request using the commands 'rbt patch -c <review_request_id>' and 'rbt patch --commit <review_request_id>'. Unit tests passed. Reviewed at https://reviews.reviewboard.org/r/4865/
- Loading branch information
Showing
7 changed files
with
132 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
import subprocess | ||
|
||
from rbtools.utils.filesystem import make_tempfile | ||
|
||
|
||
def edit_text(content): | ||
"""Allows a user to edit a block of text and returns the saved result. | ||
The environment's default text editor is used if available, otherwise | ||
vim is used. | ||
""" | ||
tempfile = make_tempfile(content) | ||
editor = os.environ.get('EDITOR', 'vim') | ||
subprocess.call([editor, tempfile]) | ||
f = open(tempfile) | ||
result = f.read() | ||
f.close() | ||
|
||
return result |