[PATCH] fix for convert extension issue3469
Pierre-Yves David
pierre-yves.david at logilab.fr
Tue May 29 05:33:09 CDT 2012
On Mon, May 28, 2012 at 11:21:02AM +1000, Lawrence Stewart wrote:
> Hi all,
>
> Caveat: first time contributor with essentially no working knowledge
> of the Mercurial code base, so please go easy on me :)
>
> Attached is a tested patch which addresses issue3469 as far as my
> needs are concerned. The bug description [1] has all the relevant
> background which I won't repeat here.
submitted patch should be inlined in the message commit, not attached. You
probably want to use the patchbomb extension:
http://mercurial.selenic.com/wiki/ContributingChanges
> It's unclear to me if this patch should be accompanied by specific
> tweaks to the test suite or whether the existing tests which cover
> converting branches via the branchmap are sufficient.
If the breakage introduced by issue2653 fixes is not caught by the testsuite,
you better add a new test for it.
> Feedback welcomed.
>
> Cheers,
> Lawrence
>
> [1] http://bz.selenic.com/show_bug.cgi?id=3469
> # HG changeset patch
> # User lstewart
> # Date 1338167428 -36000
> # Node ID 18f05159a4fb2fbc1c6c07e7ef0e8009a5f2d86d
> # Parent 2ac08d8b21aa7b6e0a062afed5a3f357ccef67f9
> convert: allow branchmap to map trunk to arbitrary named branch (issue3469)
>
> The fix for issue2653 broke the ability to convert the trunk branch of a source
> repository to a named branch other than "default" in the destination repository.
> Leave the default behaviour as is, but allow the branchmap to be used to specify
> a non-default name for the branch in the destination repository to which
> converted revisions from trunk will be applied.
>
> diff -r 2ac08d8b21aa -r 18f05159a4fb hgext/convert/convcmd.py
> --- a/hgext/convert/convcmd.py Tue May 22 14:37:20 2012 -0500
> +++ b/hgext/convert/convcmd.py Mon May 28 11:10:28 2012 +1000
> @@ -340,6 +340,18 @@
> self.cachecommit(prev)
> pbranches.append((self.map[prev],
> self.commitcache[prev].branch))
> +
> + # If no destination branch is set, this commit is destined for the
> + # default branch in the destination repository. If a suitable entry
> + # exists in the branchmap, map the trunk branch name in the source
> + # repository to the branchmap-defined name in the destination
> + # repository.
> + try:
> + if not commit.branch:
> + commit.branch = self.branchmap[self.source.trunkname]
> + except KeyError:
> + pass
You should considerer using `self.branchmap.get(self.source.trunkname)` instead
of a try, except construct.
--
Pierre-Yves David
http://www.logilab.fr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120529/66c72bfc/attachment.pgp>
More information about the Mercurial-devel
mailing list