# HG changeset patch # User Bryan O'Sullivan # Date 1192055400 25200 # Node ID d0c67b52ac01bba493e4b3d393ce7d76a30de81b # Parent 6fa5258be3d4308669b42b00f9288a1c2afab95f convert: make contents of "extra" dict available from sources, for sinks. This breaks hash preservation for hg->hg conversion, as each converted change gets a convert_revision item added to its extra dict. Ugh. diff --git a/hgext/convert/common.py b/hgext/convert/common.py --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -20,13 +20,15 @@ class NoRepo(Exception): pass SKIPREV = 'SKIP' class commit(object): - def __init__(self, author, date, desc, parents, branch=None, rev=None): + def __init__(self, author, date, desc, parents, branch=None, rev=None, + extra={}): self.author = author self.date = date self.desc = desc self.parents = parents self.branch = branch self.rev = rev + self.extra = extra class converter_source(object): """Conversion source interface""" diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -108,7 +108,7 @@ class mercurial_sink(converter_sink): p2 = parents.pop(0) text = commit.desc - extra = {} + extra = commit.extra.copy() if self.branchnames and commit.branch: extra['branch'] = commit.branch if commit.rev: @@ -230,7 +230,7 @@ class mercurial_source(converter_source) parents = [hex(p.node()) for p in ctx.parents() if p.node() != nullid] return commit(author=ctx.user(), date=util.datestr(ctx.date()), desc=ctx.description(), parents=parents, - branch=ctx.branch()) + branch=ctx.branch(), extra=ctx.extra()) def gettags(self): tags = [t for t in self.repo.tagslist() if t[0] != 'tip'] diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -82,6 +82,7 @@ class changectx(object): def files(self): return self._changeset[3] def description(self): return self._changeset[4] def branch(self): return self._changeset[5].get("branch") + def extra(self): return self._changeset[5] def tags(self): return self._repo.nodetags(self._node) def parents(self):