[PATCH] convert: allow branchmap to map trunk to arbitrary named branch (issue3469)

Augie Fackler raf at durin42.com
Fri Oct 5 18:54:43 CDT 2012


Fails tests though - test-convert-git fails. Lawrence, can you take a look?

On Aug 20, 2012, at 7:55 PM, Lawrence Stewart <lstewart at room52.net> wrote:

> # HG changeset patch
> # User lstewart
> # Date 1345510024 -36000
> # Node ID d49af0455cffa64de4d8e469847bf24f9d096a18
> # Parent  c6f88e7f95b764e23b7e0b4353c5a6458bbc3cc4
> 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 c6f88e7f95b7 -r d49af0455cff hgext/convert/convcmd.py
> --- a/hgext/convert/convcmd.py	Sat Aug 11 12:45:53 2012 -0500
> +++ b/hgext/convert/convcmd.py	Tue Aug 21 10:47:04 2012 +1000
> @@ -340,6 +340,15 @@
>                     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.
> +        if not commit.branch:
> +            commit.branch = self.branchmap.get(self.source.trunkname)
> +
>         self.dest.setbranch(commit.branch, pbranches)
>         try:
>             parents = self.splicemap[rev]
> diff -r c6f88e7f95b7 -r d49af0455cff tests/test-convert-svn-branches.t
> --- a/tests/test-convert-svn-branches.t	Sat Aug 11 12:45:53 2012 -0500
> +++ b/tests/test-convert-svn-branches.t	Tue Aug 21 10:47:04 2012 +1000
> @@ -101,3 +101,34 @@
>   abort: Mercurial failed to run itself, check hg executable is in PATH
>   [255]
> 
> +Convert 'trunk' to branch other than 'default'
> +
> +  $ cat > branchmap <<EOF
> +  > trunk hgtrunk
> +  > 
> +  > 
> +  > EOF
> +  $ hg convert --branchmap=branchmap --datesort -r 10 svn-repo C-hg
> +  initializing destination C-hg repository
> +  scanning source...
> +  sorting...
> +  converting...
> +  10 init projA
> +  9 hello
> +  8 branch trunk, remove c and dir
> +  7 change a
> +  6 change b
> +  5 move and update c
> +  4 move and update c
> +  3 change b again
> +  2 move to old2
> +  1 move back to old
> +  0 last change to a
> +
> +  $ cd C-hg
> +  $ hg branches
> +  hgtrunk                       10:745f063703b4
> +  old                            9:aa50d7b8d922
> +  old2                           8:c85a22267b6e (inactive)
> +  $ cd ..
> +
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list