Re: [PATCH] convert: add config option to control saving Git committer in message
On Fri, Jan 06, 2017 at 01:51:59PM -0800, Sean Farley wrote: > Gregory Szorc writes: > > > On Fri, Jan 6, 2017 at 11:48 AM, Sean Farley wrote: > > > >> Gregory Szorc writes: > >> > >> > On Fri, Jan 6, 2017 at 11:36 AM, Sean Farley wrote: > >> > > >> >> Gregory Szorc writes: > >> >> > >> >> > # HG changeset patch > >> >> > # User Gregory Szorc > >> >> > # Date 1483729033 28800 > >> >> > # Fri Jan 06 10:57:13 2017 -0800 > >> >> > # Node ID 1901566ab484a56b177b88ff080d635840e0912c > >> >> > # Parent 3de9df6ee5bf7601aa3870f18304bbeb3ce351af > >> >> > convert: add config option to control saving Git committer in message > >> >> > > >> >> > As part of converting a Git repository to Mercurial at Mozilla, I > >> >> > encountered a scenario where I didn't want `hg convert` to > >> >> > automatically add the "committer: " line to commit > >> messages. > >> >> > While I can hack around it downstream by rewriting the Git commit > >> >> > before feeding it into `hg convert`, I'd prefer to just specify a > >> >> > config flag to turn it off. This patch adds that flag. > >> >> > >> >> I'm fine with this as-is but what about maybe storing it in the > >> >> metadata? Just a thought. > >> >> > >> > > >> > I can implement that as a follow-up feature, behind yet another config > >> > flag. There's a reason I put "message" in the config option :) > >> > >> Fair enough :-) > >> > > > > Thinking about this a little more, I suppose I can have a single option > > defining a list of actions to take w.r.t. author and committer. If you feel > > this is more appropriate, please drop and I'll send V2. > > At least to me, that sounds pretty robust / better. I'd like to see it. Feel encouraged to send a proposed config spec before rolling the whole v2 if you want early feedback on that (I'm not quite sure what you have in mind, but I'm also not worried given your track record.) > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] convert: add config option to control saving Git committer in message
On Fri, Jan 06, 2017 at 11:36:32AM -0800, Sean Farley wrote: > Gregory Szorc writes: > > > # HG changeset patch > > # User Gregory Szorc > > # Date 1483729033 28800 > > # Fri Jan 06 10:57:13 2017 -0800 > > # Node ID 1901566ab484a56b177b88ff080d635840e0912c > > # Parent 3de9df6ee5bf7601aa3870f18304bbeb3ce351af > > convert: add config option to control saving Git committer in message > > > > As part of converting a Git repository to Mercurial at Mozilla, I > > encountered a scenario where I didn't want `hg convert` to > > automatically add the "committer: " line to commit messages. > > While I can hack around it downstream by rewriting the Git commit > > before feeding it into `hg convert`, I'd prefer to just specify a > > config flag to turn it off. This patch adds that flag. > > I'm fine with this as-is but what about maybe storing it in the > metadata? Just a thought. ... like hg-git does. Mike ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] convert: add config option to control saving Git committer in message
Gregory Szorc writes: > On Fri, Jan 6, 2017 at 11:48 AM, Sean Farley wrote: > >> Gregory Szorc writes: >> >> > On Fri, Jan 6, 2017 at 11:36 AM, Sean Farley wrote: >> > >> >> Gregory Szorc writes: >> >> >> >> > # HG changeset patch >> >> > # User Gregory Szorc >> >> > # Date 1483729033 28800 >> >> > # Fri Jan 06 10:57:13 2017 -0800 >> >> > # Node ID 1901566ab484a56b177b88ff080d635840e0912c >> >> > # Parent 3de9df6ee5bf7601aa3870f18304bbeb3ce351af >> >> > convert: add config option to control saving Git committer in message >> >> > >> >> > As part of converting a Git repository to Mercurial at Mozilla, I >> >> > encountered a scenario where I didn't want `hg convert` to >> >> > automatically add the "committer: " line to commit >> messages. >> >> > While I can hack around it downstream by rewriting the Git commit >> >> > before feeding it into `hg convert`, I'd prefer to just specify a >> >> > config flag to turn it off. This patch adds that flag. >> >> >> >> I'm fine with this as-is but what about maybe storing it in the >> >> metadata? Just a thought. >> >> >> > >> > I can implement that as a follow-up feature, behind yet another config >> > flag. There's a reason I put "message" in the config option :) >> >> Fair enough :-) >> > > Thinking about this a little more, I suppose I can have a single option > defining a list of actions to take w.r.t. author and committer. If you feel > this is more appropriate, please drop and I'll send V2. At least to me, that sounds pretty robust / better. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] convert: add config option to control saving Git committer in message
On Fri, Jan 6, 2017 at 11:48 AM, Sean Farley wrote: > Gregory Szorc writes: > > > On Fri, Jan 6, 2017 at 11:36 AM, Sean Farley wrote: > > > >> Gregory Szorc writes: > >> > >> > # HG changeset patch > >> > # User Gregory Szorc > >> > # Date 1483729033 28800 > >> > # Fri Jan 06 10:57:13 2017 -0800 > >> > # Node ID 1901566ab484a56b177b88ff080d635840e0912c > >> > # Parent 3de9df6ee5bf7601aa3870f18304bbeb3ce351af > >> > convert: add config option to control saving Git committer in message > >> > > >> > As part of converting a Git repository to Mercurial at Mozilla, I > >> > encountered a scenario where I didn't want `hg convert` to > >> > automatically add the "committer: " line to commit > messages. > >> > While I can hack around it downstream by rewriting the Git commit > >> > before feeding it into `hg convert`, I'd prefer to just specify a > >> > config flag to turn it off. This patch adds that flag. > >> > >> I'm fine with this as-is but what about maybe storing it in the > >> metadata? Just a thought. > >> > > > > I can implement that as a follow-up feature, behind yet another config > > flag. There's a reason I put "message" in the config option :) > > Fair enough :-) > Thinking about this a little more, I suppose I can have a single option defining a list of actions to take w.r.t. author and committer. If you feel this is more appropriate, please drop and I'll send V2. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] convert: add config option to control saving Git committer in message
Gregory Szorc writes: > On Fri, Jan 6, 2017 at 11:36 AM, Sean Farley wrote: > >> Gregory Szorc writes: >> >> > # HG changeset patch >> > # User Gregory Szorc >> > # Date 1483729033 28800 >> > # Fri Jan 06 10:57:13 2017 -0800 >> > # Node ID 1901566ab484a56b177b88ff080d635840e0912c >> > # Parent 3de9df6ee5bf7601aa3870f18304bbeb3ce351af >> > convert: add config option to control saving Git committer in message >> > >> > As part of converting a Git repository to Mercurial at Mozilla, I >> > encountered a scenario where I didn't want `hg convert` to >> > automatically add the "committer: " line to commit messages. >> > While I can hack around it downstream by rewriting the Git commit >> > before feeding it into `hg convert`, I'd prefer to just specify a >> > config flag to turn it off. This patch adds that flag. >> >> I'm fine with this as-is but what about maybe storing it in the >> metadata? Just a thought. >> > > I can implement that as a follow-up feature, behind yet another config > flag. There's a reason I put "message" in the config option :) Fair enough :-) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] convert: add config option to control saving Git committer in message
On Fri, Jan 6, 2017 at 11:36 AM, Sean Farley wrote: > Gregory Szorc writes: > > > # HG changeset patch > > # User Gregory Szorc > > # Date 1483729033 28800 > > # Fri Jan 06 10:57:13 2017 -0800 > > # Node ID 1901566ab484a56b177b88ff080d635840e0912c > > # Parent 3de9df6ee5bf7601aa3870f18304bbeb3ce351af > > convert: add config option to control saving Git committer in message > > > > As part of converting a Git repository to Mercurial at Mozilla, I > > encountered a scenario where I didn't want `hg convert` to > > automatically add the "committer: " line to commit messages. > > While I can hack around it downstream by rewriting the Git commit > > before feeding it into `hg convert`, I'd prefer to just specify a > > config flag to turn it off. This patch adds that flag. > > I'm fine with this as-is but what about maybe storing it in the > metadata? Just a thought. > I can implement that as a follow-up feature, behind yet another config flag. There's a reason I put "message" in the config option :) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] convert: add config option to control saving Git committer in message
Gregory Szorc writes: > # HG changeset patch > # User Gregory Szorc > # Date 1483729033 28800 > # Fri Jan 06 10:57:13 2017 -0800 > # Node ID 1901566ab484a56b177b88ff080d635840e0912c > # Parent 3de9df6ee5bf7601aa3870f18304bbeb3ce351af > convert: add config option to control saving Git committer in message > > As part of converting a Git repository to Mercurial at Mozilla, I > encountered a scenario where I didn't want `hg convert` to > automatically add the "committer: " line to commit messages. > While I can hack around it downstream by rewriting the Git commit > before feeding it into `hg convert`, I'd prefer to just specify a > config flag to turn it off. This patch adds that flag. I'm fine with this as-is but what about maybe storing it in the metadata? Just a thought. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] convert: add config option to control saving Git committer in message
# HG changeset patch # User Gregory Szorc # Date 1483729033 28800 # Fri Jan 06 10:57:13 2017 -0800 # Node ID 1901566ab484a56b177b88ff080d635840e0912c # Parent 3de9df6ee5bf7601aa3870f18304bbeb3ce351af convert: add config option to control saving Git committer in message As part of converting a Git repository to Mercurial at Mozilla, I encountered a scenario where I didn't want `hg convert` to automatically add the "committer: " line to commit messages. While I can hack around it downstream by rewriting the Git commit before feeding it into `hg convert`, I'd prefer to just specify a config flag to turn it off. This patch adds that flag. diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py --- a/hgext/convert/__init__.py +++ b/hgext/convert/__init__.py @@ -340,6 +340,11 @@ def convert(ui, src, dest=None, revmapfi :convert.git.saverev: whether to store the original Git commit ID in the metadata of the destination commit. The default is True. +:convert.git.savecommitterinmessage: whether to record the Git commit +"committer" in the commit message if it is different from the commit +"author." When enable, a ``committer: `` line is appended +to the commit message as necessary. The default is True. + :convert.git.skipsubmodules: does not convert root level .gitmodules files or files with 16 mode indicating a submodule. Default is False. diff --git a/hgext/convert/git.py b/hgext/convert/git.py --- a/hgext/convert/git.py +++ b/hgext/convert/git.py @@ -317,7 +317,10 @@ class convert_git(common.converter_sourc if n in self.copyextrakeys: extra[n] = v -if committer and committer != author: +committerinmessage = self.ui.configbool('convert', +'git.savecommitterinmessage', +True) +if committer and committer != author and committerinmessage: message += "\ncommitter: %s\n" % committer tzs, tzh, tzm = tz[-5:-4] + "1", tz[-4:-2], tz[-2:] tz = -int(tzs) * (int(tzh) * 3600 + int(tzm)) diff --git a/tests/test-convert-git.t b/tests/test-convert-git.t --- a/tests/test-convert-git.t +++ b/tests/test-convert-git.t @@ -482,6 +482,37 @@ convert author committer +recording committer in commit message can be disabled + + $ hg --config convert.git.savecommitterinmessage=false convert git-repo4 git-repo4-hg-no-committer + initializing destination git-repo4-hg-no-committer repository + scanning source... + sorting... + converting... + 1 addfoo + 0 addfoo2 + updating bookmarks + + $ hg -R git-repo4-hg-no-committer log -v + changeset: 1:190b2da396cc + bookmark:master + tag: tip + user:nottest + date:Mon Jan 01 00:00:21 2007 + + files: foo + description: + addfoo2 + + + changeset: 0:0735477b0224 + user:test + date:Mon Jan 01 00:00:20 2007 + + files: foo + description: + addfoo + + + --sourceorder should fail $ hg convert --sourcesort git-repo4 git-repo4-sourcesort-hg diff --git a/tests/test-convert.t b/tests/test-convert.t --- a/tests/test-convert.t +++ b/tests/test-convert.t @@ -282,6 +282,11 @@ convert.git.saverev whether to store the original Git commit ID in the metadata of the destination commit. The default is True. + convert.git.savecommitterinmessage +whether to record the Git commit "committer" in the commit +message if it is different from the commit "author." When +enable, a "committer: " line is appended to the +commit message as necessary. The default is True. convert.git.skipsubmodules does not convert root level .gitmodules files or files with 16 mode indicating a submodule. Default is False. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel