phases, local and remote; topics

Becker, Mischa J mischa.becker at kroger.com
Tue Dec 22 20:01:32 UTC 2020


> From: Uwe Brauer <oub at mat.ucm.es>
> Subject: Re: phases, local and remote; topics
>
> >>> "BMJ" == Becker, Mischa J <mischa.becker at kroger.com> writes:
>
> >> |   |               | remote | local | pull   | push   | clone  |
> >> |---+---------------+--------+-------+--------+--------+--------|
> >> | 1 | phase publish | true   | true  | public | public | public |
> >> | 2 |               | true   | false | draft  | public | draft  |
> >> | 3 |               | false  | false | draft  | draft  | draft  |
> >> | 4 |               | false  | true  | public | draft  | public |
>
> > I don't know how phase works with topics but this isn't how it works
> without topics.
>
> Hm that is what Sietse Brouwer told me some time ago, but maybe I
> misunderstood him.

On stepping thru all your test steps, it turns out some of the stuff I thought was true was incorrect.  I also discovered a typo bug in your test which is probably why everything didn't work as you expected it to.  See below.

> > A commit's phase is initially set based on the publish setting of the
> > repo you commit to. An existing draft commit will update to public if
> > pushed into\pulled from a publish=true repo but a public commit
> > doesn't down grade back to draft unless you force it.
>
> I am still not sure I understand. Since I also use a clone command my
> global setting comes into play. Let me try to rephrase the behaviour.
>
> First I do
> $ mkdir remote
> $ cd remote
> $ hg init
> $ echo "[phase]\npublish=false" >> .hg/hgrc

You have a typo here. It should be [phases] not [phase]. Also, on Windows 10, I had to capitalize False before mercurial would recognize that remote had been set to non-publishing in local settings.  I used the following.

  echo [phases] >> .hg/hgrc
  echo publish=False >> .hg/hgrc

> $ echo "First line" >> test.org
> $ hg addremove $ hg ci -m "First commit not publishing"
>
> That is now a non publishing repository (its first commit is in draft
> mode) which works as my remote sandbox.
>
> Now there are the following scenarios
>
> 1. My global .hgrc has
>
>    [phases]
>    publish = false
>
>    a. Then cloning from remote to local
>
>       hg clone remote local-no-publish.
>       leads to repository whose first changeset has the phase draft.
>
>    b. Committing a new changeset, results in a draft changeset.
>
>    c. Pushing this to the non publishing «remote» repository results in
>       a new changeset which is in draft mode
>
>       - in the local repository, but
>
>       - it also «arrives» in the remote repository as a draft changeset
>
> 2. Now I change my global setting
>    [phases]
>    publish = True
>
>    a. Then cloning from remote to local
>       hg clone remote local-publish
>
>       leads to a repository that has now 2 changesets (since I pushed
>       from local-publish), that are in public phase

Pushing from a publishing repo to a non-publishing repo does not change any changesets from draft to public.  The reason your changesets changed to public is because your remote doesn't have a valid phases setting in its local settings and mercurial is using your global setting which is now publish = True.

>    b. Committing a new changeset, results in a draft changeset.
>
>    c. I push this new changeset to «remote», now
>
>       - I have three public changesets in my local-publish repository
>         (that confused my yesterday) but if I understand you correctly
>         since the first two changesets are public the third must be also
>         after pushing.

No.  I (incorrectly) believed that the new changeset committed in step b would be committed as public because the repository was a publishing repository. Therefore, since it was already public, it wouldn't backtrack to being draft after pushing to a non-publishing repo.

>
>       - But I have now also three *public* changesets in the remote
>         repository, although in this repository I have the setting
>         [phases]
>         publish = false
>
>         That is really a bit confusing.

Try your test again after verifying that remote's hgrc is correct. (And try capitalizing False.)

Mischa

________________________________

This e-mail message, including any attachments, is for the sole use of the intended recipient(s) and may contain information that is confidential and protected by law from unauthorized disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.


More information about the Mercurial mailing list