[PATCH stable] bundlerepo: return more capable repos from getremotechanges

Mads Kiilerich mads at kiilerich.com
Fri Dec 21 13:38:26 CST 2012


On 12/17/2012 03:36 PM, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <madski at unity3d.com>
> # Date 1355754680 -3600
> # Branch stable
> # Node ID 01729f368344a926b8d9a45cff5fbfc129a8aa94
> # Parent  777084ac84167e3bdea45b5c00de1106cca36eef
> bundlerepo: return more capable repos from getremotechanges
>
> Problem:
> getremotechanges would return the 'other' repo if nothing was incoming and
> there thus wasn't any bundle to base the repo on. That could be a problem
> because a remote peer is less capable than a bundlerepo. That showed up as a
> crash in transplant.
>
> Solution:
> Return the local repo instead of the remote peer.
>
> diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
> --- a/mercurial/bundlerepo.py
> +++ b/mercurial/bundlerepo.py
> @@ -347,7 +347,7 @@
>                   os.unlink(bundlename)
>           except OSError:
>               pass
> -        return other, [], other.close
> +        return repo, [], repo.close

Hm. It works, but I doubt it is correct. I guess the function still 
should return other.close to make sure that other is closed exactly when 
it is expected to be closed, even in the case where we don't use other.

Do you agree?

/Mads

>   
>       bundle = None
>       bundlerepo = None
> diff --git a/tests/test-transplant.t b/tests/test-transplant.t
> --- a/tests/test-transplant.t
> +++ b/tests/test-transplant.t
> @@ -288,6 +288,15 @@
>     1  b1
>     0  r1
>   
> +remote transplant without pull
> +
> +  $ hg pull -q http://localhost:$HGPORT/
> +  $ hg transplant -s http://localhost:$HGPORT/ 2 4
> +  searching for changes
> +  skipping already applied revision 2:8d9279348abb
> +  applying 722f4667af76
> +  722f4667af76 transplanted to 76e321915884
> +
>   transplant --continue
>   
>     $ hg init ../tc
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list