Skip to content

Implement --prefix option #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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