> On 18/11/2024 20.50, Uwe Brauer wrote:
>> I'd love to help, since I consider it such an important feature. I was
>> surprised the importing git branches also works, (it relies it seems on
>> git's name-rev, right? That has its short comings, but that cannot be
>> avoided.
> Well, sort of; there's a heuristic that follows each Git “branch”
> backwards, but tries hard to let the default branch win. So it's not
> technically based on `name-rev`, but does most of the same 🙂 If you
> never delete the branch refs, they should get the right name.
Just to make sure we talking here about the same: git has no way to
determine the branch point as even the most enthusiastic git supporter
(and mercurial skeptical Felipe Contreras admits.
https://felipec.wordpress.com/2013/08/27/analysis-of-hg-and-git-branches/
Section Fixing git, and
https://felipec.wordpress.com/2013/08/27/analysis-of-hg-and-git-branches/
And Felipe's proposed solution that was never accepted.
https://github.com/felipec/git/commits/fc/tail
Where git fails can be seen in this example
--8<---------------cut here---------------start------------->8---
git init foo-git
cd foo
echo 1 > 1
git add 1
git commit -m "First commit in master"
echo 1.1 > 1
git add .
git commit -m "Second commit in master"
git checkout -b feature master~1
echo 1.2 > 1
git add .
git commit -m "First commit in feature"
echo 1.2.1 > 1
git add .
git commit -m "Second comit in feature"
git checkout master
git merge feature
echo 1.2.1/1.1 > 1
git add .
git commit -m "Merged feature in master"
--8<---------------cut here---------------end--------------->8---
Then
git log --graph --decorate --pretty=short | git name-rev --annotate-stdin
Results in
--8<---------------cut here---------------start------------->8---
* commit 84b337af54903763d7b54f54d145e1eb3c918d4a (master) (master)
|\ Merge: 9f2346c 68df6e5
| | Author: Uwe Brauer <
o...@mat.ucm.es>
| | Date: Wed Jul 19 21:28:40 2023 +0200
| |
| | Merged feature in master
| |
| * commit 68df6e5a25a4420ffa9347e31d3b9ceedc71eb03 (feature) (HEAD -> feature)
| | Author: Uwe Brauer <
o...@mat.ucm.es>
| | Date: Wed Jul 19 21:28:40 2023 +0200
| |
| | Second comit in feature
| |
| * commit d6a642b5c924f9f6aea42dbe942e50459ab46d3d (feature~1)
| | Author: Uwe Brauer <
o...@mat.ucm.es>
| | Date: Wed Jul 19 21:28:40 2023 +0200
| |
| | First commit in feature
| |
* | commit 9f2346c87ce46d7f05b9fdf2f2565531fde0e49d (master~1)
|/ Author: Uwe Brauer <
o...@mat.ucm.es>
| Date: Wed Jul 19 21:28:40 2023 +0200
|
| Second commit in master
|
* commit a66433476e579b7d8869cfc27aed0bb2287dacdd (feature~2)
Author: Uwe Brauer <
o...@mat.ucm.es>
Date: Wed Jul 19 21:28:39 2023 +0200
First commit in master
--8<---------------cut here---------------end--------------->8---
Which is incorrect
The commit a66433476e579b7 should be in the branch master not in
feature.
Anyhow you know all this stuff much better than me, I just wanted to be
sure that we are talking about the same
> I toyed around with the thought of a Heptapod-like mode where you'd
> have the three different namespaces for branches, topics and
> bookmarks. But actually implementing it in the current codebase seems
> near-impossible to me, sorry… I think it's another case where you just
> have to be aware of the two systems involved…
Yes I know, and for example remote branch tracking sounds wonderful but
the way it is implemented in git, is, well, confusing
>> In that sense topics would be more natural and appropriate. (The only
>> annoying design decision for me is, to make them invisible once a the
>> changeset is public (I need the --debug option to see public topics)
>>
>> Github plainly rejects topics claiming that they are fancy git
>> references.
>>
>> I can provide more information if necessary
> Please do — I don't think I tried pushing anything to Github, so I
> haven't seen the error myself. Feature-wise the main issues are:
Ok I will send that later.
> * How to handle detached tags? I've tried to make them work, but not
> 100% sure I got it right.
Ah BTW, the hg-git version I use (changeset 13cf16d4c84f) seems to have
a problem with tags.
I added a hg tag which resulted in new commit and pushed to github,
pulled then with git to my local git repository but no (git)tag was
created it seems.
> * How to close branches or topics when merged? For bookmarks, just
> pushing a non-existent bookmark by name using `-B` will work, but
> there's no similar support for branches, where it ought to be
> possible. How to detect a “closed” topic seems less obvious to me…
Ok I have to admit that even in mercurial I very seldom close branches,
but then the repositories I use for my daily work a fairly small with
just a handful of named branches.
> But again, I didn't test it out all that much myself. Now that the 1.2
> beta is out, I might try it out for some of my own, daily repositories
> and see how it goes.
If you decide to merge 13cf16d4c84f and release a new version I would
be more than happy to test things, but right now in order to maintain
emacs-matlab on github, I need the named branch support and cannot
benefit form any new features or fixes.
> - Dan