Mercurial > hg
comparison tests/test-convert.t @ 30660:1f21a6835604
convert: add config option to copy extra keys from Git commits
Git commit objects support storing arbitrary key-value metadata. While
there is no user-facing mechanism in Git to record these values, some
tools do record data here.
Currently, `hg convert` only handles the "author," "committer," and
"parent" keys in Git commit objects. All other keys are ignored. This
means that any custom keys are lost when converting Git repos to
Mercurial.
This patch implements support for copying a whitelist of extra keys
from Git commit objects to the "extras" dict of the destination. As
the added tests demonstate, this allows extra metadata to be preserved
during the conversion process.
This patch stops short of converting all metadata to "extras." We could
potentially implement this via `convert.git.extrakeys=*` or similar.
But copying everything by default is a bit dangerous because if Git
adds new keys to commit objects, we could find ourselves copying
things that shouldn't be copied!
This patch also assumes the source key is the same as the destination
key. We could implement support for prefixing the output key to
distinguish it as coming from Git. But until this feature is needed,
I'm inclined to hold off implementing it.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Thu, 22 Dec 2016 23:28:11 -0700 |
parents | ea3540e66fd8 |
children | ced0d686ecb3 |
comparison
equal
deleted
inserted
replaced
30659:1404146157d9 | 30660:1f21a6835604 |
---|---|
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.extrakeys | |
272 list of extra keys from commit metadata to copy to the | |
273 destination. Some Git repositories store extra metadata in | |
274 commits. By default, this non-default metadata will be lost | |
275 during conversion. Setting this config option can retain | |
276 that metadata. Some built-in keys such as "parent" and | |
277 "branch" are not allowed to be copied. | |
271 convert.git.remoteprefix | 278 convert.git.remoteprefix |
272 remote refs are converted as bookmarks with | 279 remote refs are converted as bookmarks with |
273 "convert.git.remoteprefix" as a prefix followed by a /. The | 280 "convert.git.remoteprefix" as a prefix followed by a /. The |
274 default is 'remote'. | 281 default is 'remote'. |
275 convert.git.skipsubmodules | 282 convert.git.skipsubmodules |