[PATCH 2 of 3] convert: add a config knob for not saving the bzr revision
Matt Harbison
mharbison72 at gmail.com
Fri Jul 6 02:11:34 UTC 2018
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1530817649 14400
# Thu Jul 05 15:07:29 2018 -0400
# Node ID 7871e05503668294a5cf35697fe51db0045d8086
# Parent 3ec161a15ecfe089dacecee2a192162fe6e741d4
convert: add a config knob for not saving the bzr revision
Now that the timestamp is fixed, the log of the Mercurial repo is still
unstable with --debug, because the bzr commit ID keeps changing. Both hg and
git implement `convert.*.saverev`, so do the same here.
diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py
--- a/hgext/convert/__init__.py
+++ b/hgext/convert/__init__.py
@@ -204,6 +204,15 @@ def convert(ui, src, dest=None, revmapfi
:convert.hg.revs: revset specifying the source revisions to convert.
+
+ Bazaar Source
+ #############
+
+ The following options can be used with ``--config``:
+
+ :convert.bzr.saverev: whether to store the original Bazaar commit ID in the
+ metadata of the destination commit. The default is True.
+
CVS Source
##########
diff --git a/hgext/convert/bzr.py b/hgext/convert/bzr.py
--- a/hgext/convert/bzr.py
+++ b/hgext/convert/bzr.py
@@ -65,6 +65,7 @@ class bzr_source(common.converter_source
raise common.NoRepo(_('%s does not look like a Bazaar repository')
% path)
self._parentids = {}
+ self._saverev = ui.configbool('convert', 'bzr.saverev')
def _checkrepotype(self, path):
# Lightweight checkouts detection is informational but probably
@@ -175,7 +176,8 @@ class bzr_source(common.converter_source
author=self.recode(rev.committer),
desc=self.recode(rev.message),
branch=branch,
- rev=version)
+ rev=version,
+ saverev=self._saverev)
def gettags(self):
bytetags = {}
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -209,6 +209,9 @@ coreconfigitem('committemplate', '.*',
default=None,
generic=True,
)
+coreconfigitem('convert', 'bzr.saverev',
+ default=True,
+)
coreconfigitem('convert', 'cvsps.cache',
default=True,
)
diff --git a/tests/test-convert-bzr-merges.t b/tests/test-convert-bzr-merges.t
--- a/tests/test-convert-bzr-merges.t
+++ b/tests/test-convert-bzr-merges.t
@@ -39,7 +39,7 @@ test multiple merges at once
$ bzr merge -q --force ../source-branch2
$ bzr commit -q -m 'Merged branches' '--commit-time=2009-10-10 08:00:04 +0100'
$ cd ..
- $ hg convert --datesort source source-hg
+ $ hg convert --datesort --config convert.bzr.saverev=False source source-hg
initializing destination source-hg repository
scanning source...
sorting...
More information about the Mercurial-devel
mailing list