Mercurial > hg
comparison tests/test-convert.t @ 30813:2cbbd4622ab0
convert: config option to control Git committer actions
When converting a Git repository to Mercurial at Mozilla, I encountered
a scenario where I didn't want `hg convert` to automatically add the
"committer: <committer>" line to commit messages. While I can hack around
this by rewriting the Git commit before it is fed into `hg convert`,
I figured it would be a useful knob to control.
This patch introduces a config option that allows lots of control
over the committer value. I initially implemented this as a single
boolean flag to control whether to save the committer message. But
then there was feedback that it would be useful to save the committer
in extra data. While this patch doesn't implement support for saving
in extra data, it does add a mechanism for extending which actions
to take on the committer field. We should be able to easily add
actions to save in extra data.
Some of the implemented features weren't asked for. But I figured they
could be useful. If nothing else they demonstrate the extensibility
of this mechanism.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 13 Jan 2017 23:21:10 -0800 |
parents | ced0d686ecb3 |
children | c5bf2e8ec18c |
comparison
equal
deleted
inserted
replaced
30812:98bfce9bd5e5 | 30813:2cbbd4622ab0 |
---|---|
266 files in a commit. Increasing this will make rename and copy | 266 files in a commit. Increasing this will make rename and copy |
267 detection more accurate but will significantly slow down | 267 detection more accurate but will significantly slow down |
268 computation on large projects. The option is only relevant | 268 computation on large projects. The option is only relevant |
269 if "convert.git.similarity" is greater than 0. The default | 269 if "convert.git.similarity" is greater than 0. The default |
270 is "400". | 270 is "400". |
271 convert.git.committeractions | |
272 list of actions to take when processing author and committer | |
273 values. | |
274 | |
275 Git commits have separate author (who wrote the commit) and committer | |
276 (who applied the commit) fields. Not all destinations support separate | |
277 author and committer fields (including Mercurial). This config option | |
278 controls what to do with these author and committer fields during | |
279 conversion. | |
280 | |
281 A value of "messagedifferent" will append a "committer: ..." line to | |
282 the commit message if the Git committer is different from the author. | |
283 The prefix of that line can be specified using the syntax | |
284 "messagedifferent=<prefix>". e.g. "messagedifferent=git-committer:". | |
285 When a prefix is specified, a space will always be inserted between | |
286 the prefix and the value. | |
287 | |
288 "messagealways" behaves like "messagedifferent" except it will always | |
289 result in a "committer: ..." line being appended to the commit | |
290 message. This value is mutually exclusive with "messagedifferent". | |
291 | |
292 "dropcommitter" will remove references to the committer. Only | |
293 references to the author will remain. Actions that add references to | |
294 the committer will have no effect when this is set. | |
295 | |
296 "replaceauthor" will replace the value of the author field with the | |
297 committer. Other actions that add references to the committer will | |
298 still take effect when this is set. | |
299 | |
300 "replacecommitter" will replace the value of the committer field with | |
301 the author. | |
302 | |
303 The default is "messagedifferent". | |
304 | |
271 convert.git.extrakeys | 305 convert.git.extrakeys |
272 list of extra keys from commit metadata to copy to the | 306 list of extra keys from commit metadata to copy to the |
273 destination. Some Git repositories store extra metadata in | 307 destination. Some Git repositories store extra metadata in |
274 commits. By default, this non-default metadata will be lost | 308 commits. By default, this non-default metadata will be lost |
275 during conversion. Setting this config option can retain | 309 during conversion. Setting this config option can retain |