[PATCH 2 of 2] unionrepo: override the _phasecache() to return a union phasecaches of two repos

Mads Kiilerich mads at kiilerich.com
Tue Apr 1 01:36:33 UTC 2014


On 03/28/2014 02:33 AM, elson.wei at gmail.com wrote:
> # HG changeset patch
> # User Wei, Elson <elson.wei at gmail.com>
> # Date 1395970218 -28800
> #      Fri Mar 28 09:30:18 2014 +0800
> # Node ID 209c9e7394bb8b59b01048abe2cc225456132eca
> # Parent  077d695569cc1c6012b3aa6fb742b9dac22b133d
> unionrepo: override the _phasecache() to return a union phasecaches of two repos

I am sure you are onto something here. Phases were not considered when 
unionrepo was created and it will thus probably not do "the right thing".

One tricky case would be if a changeset has different phases in the two 
repositories. I don't what the result of that should be.

In which situation did you see the missing unionrepo as a problem?

> The phase roots of the repo2 are not loaded. All revisions in repo2 will become
> 'public'.

Is that a description of the situation before or after this patch? 
Please make that more clear in the description.

> diff --git a/tests/test-unionrepo.t b/tests/test-unionrepo.t
> --- a/tests/test-unionrepo.t
> +++ b/tests/test-unionrepo.t
> @@ -148,3 +148,9 @@
>     2:68c0685446a3  repo1-2
>     1:8a58db72e69d  repo1-1
>     0:f093fec0529b  repo1-0
> +
> +check the phase
> +
> +  $ hg -R union:repo1+repo2 phase -r 0:1
> +  0: draft
> +  1: draft

Testing shows that this test case gave the same result before the change 
and after. It is thus not really a convincing test case.

It do also not match the "All revisions in repo2 will become 'public'" 
description. Why is that?

Inserting test code like
   $ hg -R repo1 log -G -r null: --template '{rev}: {phase} {node|short} 
{desc|firstline}\n'
   $ hg -R repo2 log -G -r null: --template '{rev}: {phase} {node|short} 
{desc|firstline}\n'
   $ hg -R union:repo1+repo2 log -G -r null: --template '{rev}: {phase} 
{node|short} {desc|firstline}\n'
   $ hg -R union:repo2+repo1 log -G -r null: --template '{rev}: {phase} 
{node|short} {desc|firstline}\n'
without your change shows that the phase of changes from the 2nd repo 
varies. Why is that? It would be good to have a bit of a description of 
the problem you are solving so we can learn and verify that it really 
has been solved.

/Mads


More information about the Mercurial-devel mailing list