Skip to content

Commit 0332bcd

Browse files
committed
Implement --prefix option
It is advertised already, and TopicManager is ready for it too. Wire it all together. Fixes aspiers#8
1 parent 91a42bb commit 0332bcd

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

git_explode/cli.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ def parse_args(args):
3535
parser.add_argument(
3636
'-p', '--prefix',
3737
dest="prefix",
38-
help="prefix for all created topic branches",
38+
help="prefix for all created topic branches [%(default)]",
3939
type=str,
40-
metavar="PREFIX")
40+
metavar="PREFIX",
41+
default="topic")
4142
parser.add_argument(
4243
'-c', '--context-lines',
4344
dest='context_lines',
@@ -63,7 +64,7 @@ def main(args):
6364
args = parse_args(args)
6465
repo = GitUtils.get_repo()
6566
exploder = GitExploder(repo, args.base, args.head, args.debug,
66-
args.context_lines)
67+
args.context_lines, args.prefix)
6768
exploder.run()
6869

6970

git_explode/exploder.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class GitExploder(object):
1818
topic branches.
1919
2020
"""
21-
def __init__(self, repo, base, head, debug, context_lines):
21+
def __init__(self, repo, base, head, debug, context_lines, prefix):
2222
self.logger = standard_logger('git-explode', debug)
2323

2424
self.debug = debug
@@ -29,7 +29,7 @@ def __init__(self, repo, base, head, debug, context_lines):
2929
(base, GitUtils.commit_summary(self.base_commit)))
3030
self.head = head
3131
self.context_lines = context_lines
32-
self.topic_mgr = TopicManager('topic%d', self.logger)
32+
self.topic_mgr = TopicManager('%s%%d' % prefix, self.logger)
3333

3434
# Map commits to their exploded version
3535
self.exploded = {}

0 commit comments

Comments
 (0)