Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/sc/review/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,22 @@

logger = logging.getLogger(__name__)

def update_ticket():
def update_ticket(single_git: bool = False):
"""Add commit/PR information to your ticket."""
if root := RepoLibrary.get_repo_root_dir(Path.cwd()):
if not single_git and (root := RepoLibrary.get_repo_root_dir(Path.cwd())):
repo_source = ManifestRepoSource(root.parent)
elif root := GitFlowLibrary.get_git_root(Path.cwd()):
repo_source = SingleRepoSource(root.parent)
Comment thread
BenjiMilan marked this conversation as resolved.
else:
logger.error("Not in a repo project or git repository!")
logger.error(
"Not in a git repository!"
if single_git else
"Not in a git repository or repo workspace!")
sys.exit(1)

try:
TicketUpdater(repo_source).run()
except (ReviewException, ConnectionError) as e:
except (ReviewException, ConnectionError, RuntimeError) as e:
logger.error(e)
sys.exit(1)

Expand Down
5 changes: 3 additions & 2 deletions src/sc/review_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ def cli():
pass

@cli.command(name="review")
def update_ticket():
@click.option("-s", "--single-git", is_flag=True, help="Review only the current git repo.")
def update_ticket(single_git: bool):
"""Add commit/PR information to your ticket."""
review.update_ticket()
review.update_ticket(single_git)

@cli.command()
def add_git_instance():
Expand Down
Loading