mirror of
https://github.com/frej/fast-export.git
synced 2026-05-06 19:36:30 +02:00
Add branch_name_in_commit plugin
This commit is contained in:
10
plugins/branch_name_in_commit/README.md
Normal file
10
plugins/branch_name_in_commit/README.md
Normal file
@@ -0,0 +1,10 @@
|
||||
## Branch Name in Commit Message
|
||||
|
||||
Mercurial has a much stronger notion of branches than Git,
|
||||
and some parties may not wish to lose the branch information
|
||||
during the migration to Git. You can use this plugin to either
|
||||
prepend or append the branch name from the mercurial
|
||||
commit into the commit message in Git.
|
||||
|
||||
To use the plugin, add
|
||||
`--plugin branch_name_in_commit=(start|end)`.
|
||||
14
plugins/branch_name_in_commit/__init__.py
Normal file
14
plugins/branch_name_in_commit/__init__.py
Normal file
@@ -0,0 +1,14 @@
|
||||
def build_filter(args):
|
||||
return Filter(args)
|
||||
|
||||
class Filter:
|
||||
def __init__(self, args):
|
||||
if not args in ['start','end']:
|
||||
raise Exception('Cannot have branch name anywhere but start and end')
|
||||
self.pos = args
|
||||
|
||||
def commit_message_filter(self,commit_data):
|
||||
if self.pos == 'start':
|
||||
commit_data['desc'] = commit_data['branch'] + '\n' + commit_data['desc']
|
||||
if self.pos == 'end':
|
||||
commit_data['desc'] = commit_data['desc'] + '\n' + commit_data['branch']
|
||||
Reference in New Issue
Block a user