From 9c6dea9fd46d61b0a14a506a9b217c9b236b02fc Mon Sep 17 00:00:00 2001 From: Ondrej Stanek Date: Wed, 24 Jun 2020 13:50:27 +0200 Subject: [PATCH] Pass original hg commit hash to plugins --- README.md | 2 +- hg-fast-export.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3fb2474..2346074 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,7 @@ defined filter methods in the [dos2unix](./plugins/dos2unix) and [branch_name_in_commit](./plugins/branch_name_in_commit) plugins. ``` -commit_data = {'branch': branch, 'parents': parents, 'author': author, 'desc': desc, 'revision': revision} +commit_data = {'branch': branch, 'parents': parents, 'author': author, 'desc': desc, 'revision': revision, 'hg_hash': hg_hash} def commit_message_filter(self,commit_data): ``` diff --git a/hg-fast-export.py b/hg-fast-export.py index d830296..4627eb1 100755 --- a/hg-fast-export.py +++ b/hg-fast-export.py @@ -302,9 +302,10 @@ def export_commit(ui,repo,revision,old_marks,max,count,authors, parents = [p for p in repo.changelog.parentrevs(revision) if p >= 0] author = get_author(desc,user,authors) + hg_hash=revsymbol(repo,b"%d" % revision).hex() if plugins and plugins['commit_message_filters']: - commit_data = {'branch': branch, 'parents': parents, 'author': author, 'desc': desc, 'revision': revision} + commit_data = {'branch': branch, 'parents': parents, 'author': author, 'desc': desc, 'revision': revision, 'hg_hash': hg_hash} for filter in plugins['commit_message_filters']: filter(commit_data) branch = commit_data['branch']