Don't automatically track all remote branches

20 views
Skip to first unread message

Sanjay Vasandani

unread,
Oct 6, 2022, 2:31:32 PM10/6/22
to hg-git
With Git, there are refs created for remote branches but there's not automatically a tracking branch for each remote branch. hg-git, on the other hand, creates a bookmark for each remote branch unconditionally in addition to the git-remote pseudo-tag which is equivalent to the Git ref. This requires unnecessary bookkeeping and noise in the set of bookmarks, especially when following the pattern of personal remote branches (i.e. allowing rewriting of history on remote branches that nobody else is expected to use).

I'd prefer an option to not have tracking bookmarks automatically, allowing one to create them as-needed. Arguably this should be the default to match Git behavior. We also may want to persist some additional metadata to associate a bookmark with its remote Git branch (pseudo-tag) rather than relying on name.

Dan Villiom Podlaski Christiansen

unread,
Nov 4, 2022, 4:46:35 PM11/4/22
to noreply-spamdigest via hg-git
On 6 Oct 2022, at 20.31, 'Sanjay Vasandani' via hg-git <hg-...@googlegroups.com> wrote:

> With Git, there are refs created for remote branches but there's not automatically a tracking branch for each remote branch. hg-git, on the other hand, creates a bookmark for each remote branch unconditionally in addition to the git-remote pseudo-tag which is equivalent to the Git ref. This requires unnecessary bookkeeping and noise in the set of bookmarks, especially when following the pattern of personal remote branches (i.e. allowing rewriting of history on remote branches that nobody else is expected to use).
>
> I'd prefer an option to not have tracking bookmarks automatically, allowing one to create them as-needed. Arguably this should be the default to match Git behavior. We also may want to persist some additional metadata to associate a bookmark with its remote Git branch (pseudo-tag) rather than relying on name.

I think the main challenge with that setup up is that the “remote branch” concept doesn't exist in Mercurial, so you'd _never_ get any bookmarks unless you create them yourself. And if other people force-push their branches, those commits would still litter your history…

I think a better solution is to just not pull (in Mercurial terms) all branches. You can do that at the moment by specifying a default revision to using the URL fragment, e.g. `#master`. Personally, I set it up like that, and when I want any _other_ branch, I pull it using `hg pull -r otherbranch`. Having multiple default revisions/names on the remote would be nice, but I don't think that's possible even with a regular Mercurial repository…

(Apologies for the late response, but I haven't had much time for hg-git lately.)

--

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

Sanjay Vasandani

unread,
Nov 4, 2022, 5:38:40 PM11/4/22
to hg-...@googlegroups.com
I think the main challenge with that setup up is that the “remote branch” concept doesn't exist in Mercurial
The fact that it doesn't exist in Mercurial is precisely why it would need to be specific to hg-git, basically mimicking the configuration for git fetch where one gives a list of refspecs.


so you'd _never_ get any bookmarks unless you create them yourself.
That's precisely what I'd want, i.e. not getting any bookmarks unless I explicitly stated I wanted to track that branch. Ideally I'd be able to actually add/remove tracked branches from hg-git configuration so those bookmarks are kept up-to-date when pulling a given remote, as well as a way to have entries automatically pruned when the remote branch is deleted (basically matching git behavior).

The bookmark syncing behavior for these branches should be consistent with Git w.r.t. history rewriting.

And if other people force-push their branches, those commits would still litter your history…
I believe consistent with Git whenever you're not specifically looking at commits reachable from a given branch.


I think a better solution is to just not pull (in Mercurial terms) all branches. You can do that at the moment by specifying a default revision to using the URL fragment, e.g. `#master`.
Is this documented anywhere? I couldn't spot it in the help entry for hggit.

Personally, I set it up like that, and when I want any _other_ branch, I pull it using `hg pull -r otherbranch`.
I think this would be the equivalent of `git fetch` for the remote branch, but without adding any tracking right?

--
You received this message because you are subscribed to a topic in the Google Groups "hg-git" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hg-git/hbZgKk6upRo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hg-git+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hg-git/FF320654-2737-49D8-9615-37F7AECCD249%40gmail.com.
Reply all
Reply to author
Forward
0 new messages