Re: [hg-git, add topics «backwards», delete topics]

Steve Fink sphink at gmail.com
Tue Jun 4 16:22:29 UTC 2019


I'm far from an expert, but maybe I can shed some light.

On 5/29/19 11:13 PM, Uwe Brauer wrote:
>     > Hi,
>     > Topic extension does not rebase automatically. You will need to rebase
>     > yourself. Some documentation about topics can be found here:
>     > https://www.mercurial-scm.org/doc/evolution/tutorials/topic-tutorial.html
>
> Thanks, some questions remarks:
>
>      1. It seems that when I push to a git repository, with the hg-git
>         extensions, changesets with a topic are ignored.

I know hg-git maps bookmarks to branches. Perhaps it doesn't do the same 
for topics? I would try adding a bookmark to the tip rev before pushing 
and see if it works. It's probably just missing hg-git functionality.

>
>      2. Is it possible to add a topic, starting from a changeset up to
>         tip?
> Suppose I have
>    changeset:   2:0556491f3147
> |  bookmark:    master
> |  tag:         default/master
> |  tag:         tip
> |  user:        Uwe Brauer <oub at mat.ucm.es>
> |  date:        Thu May 30 07:50:18 2019 +0200
> |  summary:     commit
> |
> o  changeset:   1:9db377faaf25
> |  user:        Uwe Brauer <oub at mat.ucm.es>
> |  date:        Thu May 30 07:49:02 2019 +0200
> |  summary:     second
> |
> o  changeset:   0:b376e0bd9631
>     user:        Uwe Brauer <oub at mat.ucm.es>
>     date:        Thu May 30 07:48:51 2019 +0200
>     summary:     commit
>
> I want to set a topic for rev 1 and 2
>
> I tried
>
>   hg topics topic1 --rev 1

Topics don't need to be uniform, so there's no implicit "descendants(x)" 
applied. Your command does exactly what you're asking it to do -- change 
the topic on just rev 1. Use `hg topic topic1 -r 1+2` or better yet, `hg 
topic topic1 -r 1::`.

> Finally how can I delete a topic.
>
> I tried
>
>   hg topics --clear

I think that clears out just your "active topic", which only controls 
what topic is used for new commits and what changesets are considered 
for pushing/merging/etc. You generally never use this, but instead 
update to a non-topic changeset when you switch tasks.

If you want to get rid of the topic for a changeset or range of 
changesets, use --rev.

     hg topics --rev 1 --clear

But first, consider not deleting topics. It's fine to do when you're 
experimenting with stuff, but typically when you're using topics you 
never need to delete them manually. They are implicitly deleted when you 
make a changeset public by pushing it to a publishing repo. (Internally, 
they are still there in hidden metadata, but semantically the topic of a 
changeset is `changeset.topic if not public() else None`.)



More information about the Mercurial mailing list