Have all remote changesets be in public phase

19 views
Skip to first unread message

Sanjay Vasandani

unread,
Mar 9, 2022, 2:42:44 PM3/9/22
to hg-git
I noticed that hggit.usephases only says it marks changesets reachable from the Git remote's HEAD as public, or alternatively uses the Git branches listed in git.public. Is there any way to have all imported remote changesets be public?

As an aside, I used to have my own command that wrapped pull do this. That is, mark all of the remote heads as public after pulling. With the addition of git.pull-prune-remote-branches and git.pull-prune-bookmarks (which are very welcome!), I think my wrapper cannot tell that a changeset came from remote if the hg tag/bookmark for the remote Git branch was deleted.

If there's no way to do this currently, perhaps hook(s) can be added for operations that hg-git does during pull? e.g. import of a Git revision into an hg changeset, modification of an hg tag or bookmark, etc.

Dan Villiom Podlaski Christiansen

unread,
Mar 10, 2022, 10:56:14 AM3/10/22
to hg-...@googlegroups.com
On 09/03/2022 20.42, 'Sanjay Vasandani' via hg-git wrote:

> I noticed that hggit.usephases only says it marks changesets reachable from
> the Git remote's HEAD as public, or alternatively uses the Git branches
> listed in git.public. Is there any way to have *all* imported remote
> changesets be public?
>
> As an aside, I used to have my own command that wrapped pull do this. That
> is, mark all of the remote heads as public after pulling. With the addition
> of git.pull-prune-remote-branches and git.pull-prune-bookmarks (which are
> very welcome!), I think my wrapper cannot tell that a changeset came from
> remote if the hg tag/bookmark for the remote Git branch was deleted.
>
> If there's no way to do this currently, perhaps hook(s) can be added for
> operations that hg-git does during pull? e.g. import of a Git revision into
> an hg changeset, modification of an hg tag or bookmark, etc.

I don't think we allow that at the moment, but it'll probably come when
we add support for using path options. It definitely sounds like
something we shuld have.

However, until then, you can use a hook like this:

[hooks]
post-pull = hg phase -p "tag('re:default/.*') or gittag()"

Or if you don't mind publishing everything ever converted to Git:

[hooks]
post-pull = hg phase -p "fromgit()"

- Dan
OpenPGP_0xA2ACC81B41CF4E34.asc
OpenPGP_signature

Sanjay Vasandani

unread,
Mar 10, 2022, 1:03:26 PM3/10/22
to hg-git
On Thursday, March 10, 2022 at 7:56:14 AM UTC-8 dan...@gmail.com wrote:
> I don't think we allow that at the moment, but it'll probably come when
> we add support for using path options. It definitely sounds like
> something we shuld have.
>
> However, until then, you can use a hook like this:
>
> [hooks]
> post-pull = hg phase -p "tag('re:default/.*') or gittag()"

This is similar to what I had been doing before. Does this work with git.pull-prune-remote-branches? If the remote Git branch got deleted, wouldn't the imported changesets no longer be in that revset?

Sanjay Vasandani

unread,
Mar 10, 2022, 2:55:43 PM3/10/22
to hg-git
Looking at Mercurial's build-in hooks, I would assume that the incoming hook would be the right one for this. It doesn't seem that pulling from a Git repo using hg-git triggers this hook though. Is my understanding of that hook incorrect, or should hg-git be triggering that hook?

Dan Villiom Podlaski Christiansen

unread,
Mar 11, 2022, 5:59:57 AM3/11/22
to noreply-spamdigest via hg-git
On 10 Mar 2022, at 19.03, 'Sanjay Vasandani' via hg-git <hg-...@googlegroups.com> wrote:

> On Thursday, March 10, 2022 at 7:56:14 AM UTC-8 dan...@gmail.com wrote:
> > I don't think we allow that at the moment, but it'll probably come when
> > we add support for using path options. It definitely sounds like
> > something we shuld have.
> >
> > However, until then, you can use a hook like this:
> >
> > [hooks]
> > post-pull = hg phase -p "tag('re:default/.*') or gittag()"
>
> This is similar to what I had been doing before. Does this work with git.pull-prune-remote-branches? If the remote Git branch got deleted, wouldn't the imported changesets no longer be in that revset?

If you add that hook, it'll run _after_ every push. Since publishing is a permanent state — unless you forcibly change it yourself — it'll ensure that the previous branches and tags remain published permanently. But anyway, if you really want to publish the changesets prior to pulling — although that seems to me the wrong time — you could probably do it in a `pre-pull` hook.

Just wondering, but could you perhaps describe the scenario? What are you trying to achieve?

--

Dan Villiom Podlaski Christiansen
dan...@gmail.com+45 2728 9771

Sanjay Vasandani

unread,
Mar 14, 2022, 12:53:14 PM3/14/22
to hg-git
I want to be able to treat the remote Git repo as a "publishing server" in Mercurial terms. From the Mercurial built-in help on phases:

> Normally, all servers are "publishing" by default. This means:

> - all draft changesets that are pulled or cloned appear in phase public on the client

Reply all
Reply to author
Forward
0 new messages