[PATCH V2] bundle: warn when update to revision existing only in a bundle (issue5004)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Mar 28 21:16:41 EDT 2016



On 03/28/2016 05:18 AM, liscju wrote:
> # HG changeset patch
> # User liscju <piotr.listkiewicz at gmail.com>
> # Date 1458719722 -3600
> #      Wed Mar 23 08:55:22 2016 +0100
> # Node ID 868a52d3688526893b9c666c92187bb0574ea6fe
> # Parent  345f4fa4cc8912bb722ad3e35d68858487420bc6
> bundle: warn when update to revision existing only in a bundle (issue5004)
>
> Now its done silently, so unless user really knows what he is doing
> will be suprised to find that after update 'hg status' doesn't work.
>
> diff -r 345f4fa4cc89 -r 868a52d36885 mercurial/bundlerepo.py
> --- a/mercurial/bundlerepo.py	Fri Mar 25 16:23:23 2016 -0500
> +++ b/mercurial/bundlerepo.py	Wed Mar 23 08:55:22 2016 +0100
> @@ -32,6 +32,7 @@ from . import (
>       localrepo,
>       manifest,
>       mdiff,
> +    node as nodemod,
>       pathutil,
>       phases,
>       revlog,
> @@ -385,6 +386,18 @@ class bundlerepository(localrepo.localre
>       def getcwd(self):
>           return os.getcwd() # always outside the repo
>
> +    def setparents(self, p1, p2=nullid):
> +        c = changelog.changelog(self.svfs)
> +        nodemap = c.nodemap
> +        if p1 not in nodemap:
> +            self.ui.warn(_("setting parent to node %s that "
> +                           "exists only in the bundle\n")
> +                         % nodemod.hex(p1))
> +        if p2 and p2 not in nodemap:
> +            self.ui.warn(_("setting parent to node %s that "
> +                           "exists only in the bundle\n")
> +                         % nodemod.hex(p2))
> +        return localrepo.localrepository.setparents(self, p1, p2)

You are adding code for the merge case and this is great, but you are 
not testing it (you only test a single parent). Can you update your test 
to also test p2?

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list