how to find out the *base* of bookmark, (where it started)

4 views
Skip to first unread message

Uwe Brauer

unread,
Apr 18, 2023, 4:11:02 PMApr 18
to via hg-git, Mercurial List


Hi

I just cloned a git repository with the hg-git plugin

hg book shows me

copyright 679:fea497d36b67
documentation 449:18c23a5d8b5a
fontlockhang 684:5a39cee1856e
hairyblocks 672:c81bebb99ebb
mac_init 455:5771ddf2e50d
master 689:ee371bfe7da4
modernize 441:3dddc612b35f
shellcomplete 496:b4410de703dc
strings 197:b9f449756224
usage1 486:c95faee8b690
wisent-parser 657:1842e54161be


But these are the positions where the bookmark are actually, I recall that somebody told me the

Command

hg log -r 'min(strings)'

Should tell me where the bookmark strings started. (I have to admit that I very seldom uses bookmarks)

But this command seems not really to work.

Any idea what to do

Thanks

Uwe Brauer
--
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military.
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine.
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/

Pierre-Yves David

unread,
Apr 28, 2023, 8:22:30 AMApr 28
to Uwe Brauer, via hg-git, Mercurial List
On 4/18/23 22:10, Uwe Brauer wrote:
>
> Hi
>
> I just cloned a git repository with the hg-git plugin
>
> hg book shows me
>
> copyright 679:fea497d36b67
> documentation 449:18c23a5d8b5a
> fontlockhang 684:5a39cee1856e
> hairyblocks 672:c81bebb99ebb
> mac_init 455:5771ddf2e50d
> master 689:ee371bfe7da4
> modernize 441:3dddc612b35f
> shellcomplete 496:b4410de703dc
> strings 197:b9f449756224
> usage1 486:c95faee8b690
> wisent-parser 657:1842e54161be
>
>
> But these are the positions where the bookmark are actually, I recall that somebody told me the
>
> Command
>
> hg log -r 'min(strings)'


Min is just going to give you the lowest revision number matching a
revset. This is not what you want (and in this case, the revset only
match one revision).


> Should tell me where the bookmark strings started. (I have to admit that I very seldom uses bookmarks)
>
> But this command seems not really to work.
>
> Any idea what to do


Bookmark does not record this information, so you don't have a
definitive answer here (this is part of why topic exists).

If all your bookmark create a unique and independant topological branch
you can use `roots(only("bookmark-name"))` to find the root of that
unique topological branch.


--
Pierre-Yves David

Uwe Brauer

unread,
Apr 28, 2023, 8:46:07 AMApr 28
to Pierre-Yves David, Uwe Brauer, via hg-git, Mercurial List

> On 4/18/23 22:10, Uwe Brauer wrote:


> Min is just going to give you the lowest revision number matching a
> revset. This is not what you want (and in this case, the revset only
> match one revision).


> Bookmark does not record this information, so you don't have a
> definitive answer here (this is part of why topic exists).

Right, but one observation, in the current implementation, once you push
to a publishing remote repository, the topic information is hidden.
So lately I have seen repositories which on purpose are configured to be
non-publishing, for example hg-git in order to still get the topics
displayed when you pulled

changeset: 1914:502212b50354
│ tag: tip
│ Remote_Branch: https://foss.heptapod.net/mercurial/hg-git/default:drop-compat
│ Branch: default
│ Author: Dan Villiom Podlaski Christiansen <dan...@gmail.com>
│ Date: Fri, 01 Apr 2022 18:56:00 +0200
│ Topic: drop-compat
│ Phase: draft
│ Summary: ci: drop compat for Mercurial 5.2

○ changeset: 1913:15c66b3006a8
│ Branch: default
│ Author: Dan Villiom Podlaski Christiansen <dan...@gmail.com>
│ Date: Fri, 01 Apr 2022 16:26:09 +0200
│ Topic: drop-compat
│ Phase: draft
│ Summary: compat: drop support for Python 3.6



The downside of this approach is that you loose partially the power of
phases.

So would it be convenient to display, at least optionally, topics of
phases that are published? (I know I should ask this on the evolve
mailing list, but I am curious to hear what others on this list think
about it).


> If all your bookmark create a unique and independant topological
> branch you can use `roots(only("bookmark-name"))` to find the root of
> that unique topological branch.

Thanks! The point is as I said the bookmarks have their origin in a git
repository (but even in git it is not straightforward to find out where
a git branch starts!).

The roots command seems not to work in hg 5.2, so in which version was
it introduced?

regards

Uwe Brauer

unread,
Apr 28, 2023, 8:51:36 AMApr 28
to Uwe Brauer, Pierre-Yves David, via hg-git, Mercurial List
>>> "UB" == Uwe Brauer <o...@mat.ucm.es> writes:
>> If all your bookmark create a unique and independant topological
>> branch you can use `roots(only("bookmark-name"))` to find the root of
>> that unique topological branch.


Meanwhile I tried out

hg root(only("master"))

And obtained

Badly placed ()'s.

Pierre-Yves David

unread,
Apr 28, 2023, 8:54:22 AMApr 28
to Uwe Brauer, via hg-git, Mercurial List

On 4/28/23 14:51, Uwe Brauer wrote:
>>>> "UB" == Uwe Brauer <o...@mat.ucm.es> writes:
>>> If all your bookmark create a unique and independant topological
>>> branch you can use `roots(only("bookmark-name"))` to find the root of
>>> that unique topological branch.
>
> Meanwhile I tried out
>
> hg root(only("master"))


You invocation seems to be missing a command, and quoting.


>
> And obtained
>
> Badly placed ()'s.
>
>
--
Pierre-Yves David

Uwe Brauer

unread,
Apr 28, 2023, 8:57:38 AMApr 28
to Pierre-Yves David, Uwe Brauer, via hg-git, Mercurial List
>>> "PD" == Pierre-Yves David <pierre-y...@ens-lyon.org> writes:

> On 4/28/23 14:51, Uwe Brauer wrote:
>>>>> "UB" == Uwe Brauer <o...@mat.ucm.es> writes:
>>> If all your bookmark create a unique and independant topological
>>> branch you can use `roots(only("bookmark-name"))` to find the root of
>>> that unique topological branch.
>>
>> Meanwhile I tried out
>>
>> hg root(only("master"))


> You invocation seems to be missing a command, and quoting.

I am confused
https://www.mercurial-scm.org/doc/hg.1.html

Lists
the roots command

However hg 5.2

hg help roots

Tells me

hg help roots
abort: no such help topic: roots
(try 'hg help --keyword roots')

So do I need to upgrade, if so, which version?

Pierre-Yves David

unread,
Apr 28, 2023, 9:11:39 AMApr 28
to Uwe Brauer, via hg-git, Mercurial List

On 4/28/23 14:57, Uwe Brauer wrote:
>>>> "PD" == Pierre-Yves David <pierre-y...@ens-lyon.org> writes:
>> On 4/28/23 14:51, Uwe Brauer wrote:
>>>>>> "UB" == Uwe Brauer <o...@mat.ucm.es> writes:
>>>> If all your bookmark create a unique and independant topological
>>>> branch you can use `roots(only("bookmark-name"))` to find the root of
>>>> that unique topological branch.
>>> Meanwhile I tried out
>>>
>>> hg root(only("master"))
>
>> You invocation seems to be missing a command, and quoting.
> I am confused
> https://www.mercurial-scm.org/doc/hg.1.html
>
> Lists
> the roots command
>
> However hg 5.2
>
> hg help roots
>
> Tells me
>
> hg help roots
> abort: no such help topic: roots
> (try 'hg help --keyword roots')
>
> So do I need to upgrade, if so, which version?


I am talking about the `roots` revset :

    hg log --rev "root(only('master'))"



>
>
>
>
--
Pierre-Yves David

Uwe Brauer

unread,
Apr 28, 2023, 9:17:47 AMApr 28
to Pierre-Yves David, Uwe Brauer, via hg-git, Mercurial List

> On 4/28/23 14:57, Uwe Brauer wrote:


> I am talking about the `roots` revset :

>     hg log --rev "root(only('master'))"

Ok thanks, I cloned with hg-git,
https://sourceforge.net/p/matlab-emacs/src/

hg bookmarks

Returns
copyright 679:fea497d36b67
documentation 449:18c23a5d8b5a
fontlockhang 684:5a39cee1856e
hairyblocks 672:c81bebb99ebb
mac_init 455:5771ddf2e50d
modernize 441:3dddc612b35f
org-mode 690:e26d7c527708
shellcomplete 496:b4410de703dc
strings 197:b9f449756224
usage1 486:c95faee8b690
wisent-parser 657:1842e54161be

And indeed for some of these bookmarks the command you recommend
gives some sensible answers, but for example



hg log --rev "roots(only('strings'))"
changeset: 0:14edb46e43f6
user: zappo <za...@users.sourceforge.net>
date: Thu Dec 01 13:12:18 2005 +0000
summary: Describe what is in the matlab-emacs CVS repository

In any case, thanks again for that suggestion
Reply all
Reply to author
Forward
0 new messages