diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py --- a/hgext/convert/__init__.py +++ b/hgext/convert/__init__.py @@ -337,6 +337,9 @@ def convert(ui, src, dest=None, revmapfi ``convert.git.remoteprefix`` as a prefix followed by a /. The default is 'remote'. + :convert.git.saverev: whether to store the original Git commit ID in the + metadata of the destination commit. The default is True. + :convert.git.skipsubmodules: does not convert root level .gitmodules files or files with 160000 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 @@ -322,11 +322,13 @@ class convert_git(common.converter_sourc tzs, tzh, tzm = tz[-5:-4] + "1", tz[-4:-2], tz[-2:] tz = -int(tzs) * (int(tzh) * 3600 + int(tzm)) date = tm + " " + str(tz) + saverev = self.ui.configbool('convert', 'git.saverev', True) c = common.commit(parents=parents, date=date, author=author, desc=message, rev=version, - extra=extra) + extra=extra, + saverev=saverev) return c def numcommits(self): 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 @@ -928,3 +928,58 @@ Converting multiple extras works +convert.git.saverev can be disabled to prevent convert_revision from being written + + $ hg convert --config convert.git.saverev=false gitextras hgextras4 + initializing destination hgextras4 repository + scanning source... + sorting... + converting... + 1 initial + 0 message with extras + updating bookmarks + + $ hg -R hgextras4 log --debug -r 1 + changeset: 1:1dcaf4ffe5bee43fa86db2800821f6f0af212c5c + bookmark: master + tag: tip + phase: draft + parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d + parent: -1:0000000000000000000000000000000000000000 + manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 + user: test + date: Sun Sep 09 01:46:40 2001 +0000 + extra: branch=default + description: + message with extras + + + +convert.git.saverev and convert.git.extrakeys can be combined to preserve +convert_revision from source + + $ hg convert --config convert.git.saverev=false --config convert.git.extrakeys=convert_revision gitextras hgextras5 + initializing destination hgextras5 repository + scanning source... + sorting... + converting... + 1 initial + 0 message with extras + updating bookmarks + + $ hg -R hgextras5 log --debug -r 1 + changeset: 1:574d85931544d4542007664fee3747360e85ee28 + bookmark: master + tag: tip + phase: draft + parent: 0:a13935fec4daf06a5a87a7307ccb0fc94f98d06d + parent: -1:0000000000000000000000000000000000000000 + manifest: 0:6a3df4de388f3c4f8e28f4f9a814299a3cbb5f50 + user: test + date: Sun Sep 09 01:46:40 2001 +0000 + extra: branch=default + extra: convert_revision=0000aaaabbbbccccddddeeee + description: + message with extras + + diff --git a/tests/test-convert.t b/tests/test-convert.t --- a/tests/test-convert.t +++ b/tests/test-convert.t @@ -279,6 +279,9 @@ remote refs are converted as bookmarks with "convert.git.remoteprefix" as a prefix followed by a /. The default is 'remote'. + convert.git.saverev + whether to store the original Git commit ID in the metadata + of the destination commit. The default is True. convert.git.skipsubmodules does not convert root level .gitmodules files or files with 160000 mode indicating a submodule. Default is False.