Fossil Forum

Any way to list unmerged branches?
Login

Any way to list unmerged branches?

Any way to list unmerged branches?

(1) By patmaddox on 2023-06-12 20:41:57 [source]

git has git branch --merged and git branch --no-merged to list branches that have been merged into the current branch, or not. Does Fossil have something like that?

(2) By Stephan Beal (stephan) on 2023-06-12 20:51:36 in reply to 1 [link] [source]

Does Fossil have something like that?

i don't know that that has any useful meaning in fossil, for two reasons:

  1. you can merge a branch to any other branch and keep working on both branches. What does "unmerged" really mean in that case?

  2. you can have any number of distinct branches in fossil with the same name.

That said: i am, quite thankfully, quite ignorant of most git-isms, so perhaps i'm missing the "filter" needed to answer your question properly.

(3) By Martin Gagnon (mgagnon) on 2023-06-12 21:03:33 in reply to 2 [link] [source]

May be OP want to differentiate between closed and open leaves ?

(6) By Konstantin Khomutov (kostix) on 2023-06-13 12:47:54 in reply to 2 [link] [source]

Git does not have the concept of unmerged branches, and

you can merge a branch to any other branch and keep working on both branches.

applies to it, too.

So basically you can ask whether any or both of a pair of branches have at least a single commit which is not present on the other branch since their last merge (called their "merge base"), if any.


My guess is that the OP assumed a workflow typical for simple projects where there's just a single mainline branch (let it be "trunk"), and all the other branches are created to be eventually merged back to that mainline branch just once (and then closed).

(8) By patmaddox on 2023-06-13 16:24:55 in reply to 6 [link] [source]

My guess is that the OP assumed a workflow typical for simple projects where there's just a single mainline branch (let it be "trunk"), and all the other branches are created to be eventually merged back to that mainline branch just once (and then closed).

It doesn't have to be just once, and then closed.

commit to trunk
commit to branch1
fossil up trunk
fossil branch --unmerged # lists branch1
fossil merge branch1
fossil branch --unmerged # does not list branch1
commit to branch1
fossil up trunk
fossil branch --unmerged # lists branch1

(9) By Daniel Dumitriu (danield) on 2023-06-14 14:41:00 in reply to 8 [link] [source]

A version which seemingly does what you'd like is currently implemented on a branch. Please test it and report back.

(10) By Daniel Dumitriu (danield) on 2023-06-14 14:45:12 in reply to 9 [link] [source]

Please note that other filter option apply on top, especially the default of only showing open branches - so do add -c/-a if you want closed/all branches [too].

(7) By patmaddox on 2023-06-13 16:23:00 in reply to 2 [link] [source]

What does "unmerged" really mean in that case?

"Unmerged" means a branch that has a leaf that doesn't exist in the current branch.

you can have any number of distinct branches in fossil with the same name.

This is a fork, right?

(4) By Richard Hipp (drh) on 2023-06-12 22:40:10 in reply to 1 [link] [source]

On the Branches page you can see all of the branches, and which ones have been merged and which ones have been closed. You can click no the "Status" and "Resolution" columns to sort them.

I'm not aware of an equivalent capability for the command-line. But it is just an SQL query, so wouldn't been hard to add. Patches will be thoughtfully considered. :-)

(5) By Andy Bradford (andybradford) on 2023-06-13 04:48:57 in reply to 1 [link] [source]

If you use the  UI to view the timeline of a given  branch, I believe it
will show you also merges into the branch.

The question  of "which  branches have  not been  merged into  the given
branch" however, is a slightly  different problem. "fossil leaves" might
give  you an  idea  of which  branches still  have  leaves, however,  it
doesn't mean  that the  branch hasn't  been merged,  just that  the last
commit on the branch is a leaf.

As others  have pointed  out there  is also a  /brlist web  command that
shows you other information.

What are you trying to do or accomplish?

Andy