Skip to content

Commit

Permalink
Implement --prefix option
Browse files Browse the repository at this point in the history
It is advertised already, and TopicManager is ready for it too. Wire it
all together.

Fixes aspiers#8
  • Loading branch information
Werkov committed Jul 4, 2024
1 parent 91a42bb commit 0332bcd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions git_explode/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ def parse_args(args):
parser.add_argument(
'-p', '--prefix',
dest="prefix",
help="prefix for all created topic branches",
help="prefix for all created topic branches [%(default)]",
type=str,
metavar="PREFIX")
metavar="PREFIX",
default="topic")
parser.add_argument(
'-c', '--context-lines',
dest='context_lines',
Expand All @@ -63,7 +64,7 @@ def main(args):
args = parse_args(args)
repo = GitUtils.get_repo()
exploder = GitExploder(repo, args.base, args.head, args.debug,
args.context_lines)
args.context_lines, args.prefix)
exploder.run()


Expand Down
4 changes: 2 additions & 2 deletions git_explode/exploder.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class GitExploder(object):
topic branches.
"""
def __init__(self, repo, base, head, debug, context_lines):
def __init__(self, repo, base, head, debug, context_lines, prefix):
self.logger = standard_logger('git-explode', debug)

self.debug = debug
Expand All @@ -29,7 +29,7 @@ def __init__(self, repo, base, head, debug, context_lines):
(base, GitUtils.commit_summary(self.base_commit)))
self.head = head
self.context_lines = context_lines
self.topic_mgr = TopicManager('topic%d', self.logger)
self.topic_mgr = TopicManager('%s%%d' % prefix, self.logger)

# Map commits to their exploded version
self.exploded = {}
Expand Down

0 comments on commit 0332bcd

Please sign in to comment.