In the proposed ui:
pijul checkout
can take multiple branches as arguments. Doing so creates a new, anonymous branch. This anonymous branch is the union of the sets of patches of the branches named in the arguments:
feature1
and bugfix1
are both names of branches. Branches give a name to a subset of patches in a repository.
feature1 = {p1, p2, p5 }
bugfix1 = {p1, p3, p4, p6}
pijul checkout feature1,bugfix1
sets the working branch to show the union of the set of patches in feature1
and bugfix1
. Running pijul changes
after that checkout will show patches from both feature1
and bugfix1
. The working directory will show the effect of the composition of union of patches in feature1
and bugfix1
.
feature1 ∪ bugfix1 = {p1, p2, p3, p4, p5, p6}
The branch (feature1 U bugfix1
) resulting from the union of these branches is anonymous unless given a name so that it can be referred to later.
Okay, so giving an anonymous branch a name means we can refer to it later. As a consequence we can also refer back to patches recorded to bugfixes but not to bugfix1 or bugfix2 (e.g. the ChangeLog with a line mentioning bugfix2 or something).
bugfixes = bugfix1 ∪ bugfix2
Patches in an anonymous branch and not in one of the branches of the union must stay in the working copy (unrecorded) or else there would be no way to refer to them later. If you want to refer to those patches later, you need to give that set of patches a name. That’s called recording patches to a branch. As an aside, there’s no need for anything like git stash
in this ui.
If you give an anonymous branch a name:
bugfixes = bugfix1 ∪ bugfix2
The contents of bugfix1
still stays in bugfix1
and the contents of bugfix2
still stays in bugfix2
.
Suppose some patches get applied to bugfix2
separately and then we pijul checkout bugfixes
. We will see those new patches in the bugfixes
branch without having explicitly pulled them into bugfixes
. This is because bugfix1 and bugfix2 are still bound to their respective patch sets even after taking their union.
That’s one way labeling branches is different from pulling those branches into that label.
note: You probably want to keep different stances on what is in, say, stable, devel, and remote branches as @flobec pointed out. That is why having some hierarchy may actually be a good thing as opposed to only a sea of patches (à la darcs spontaneous branches).
Hierarchy is a way in which this branch ui is the same what we have now in pijul.
In the following example, bugfix1
is different from the other bugfix1
’s. It contains patches that backport it from devel to the current stable branch (different stances on bugfix1
):
stable = stable ∪ bugfix1
Yet we still keep the name bugfix1
and we still keep in mind the patches that it is bound to in both stable and devel. The difference between the stable
and devel
stances on bugfix1
is the bugfix1_backport
.
bugfix1_backport = (stable ∪ bugfix1) - (devel ∪ bugfix1)
The backport is in addition to whatever is in bugfix1. The backport’s diff may expand if something more is pushed to bugfix1.
feature1
and bugfix1
have the same type. They are both branch names. They can contain other branch names, or patches.
feature2 = bugfix2_0 ∪ bugfix2_1
will overwrite what’s already in feature2 …that is, unless you also include its own name when taking the union:
feature2 = feature2 ∪ bugfix2_0 ∪ bugfix2_1
bugfix2_0
is a partial branch because it only contains patches pertaining to bugfix2_0
. If you wanted it to be a full branch of the repo, you would need to include all patches of the repository in your union and set bugfix2_0
:
bugfix2_0 = all-patches-in-repo ∪ bugfix2_0
Or you could just take the union with a some other full branch.
You probably wouldn’t want to work directly out of bugfix2_0
alone because it wouldn’t contain much else besides patches pertaining to bugfix2_0
. Instead, record to it out of some other, branch with more patches in it.
Many commands can be collapsed into the checkout
command. This may all be bit general which is why I suggest some syntactic sugar for the cli.
I’m still hammering out the details myself. Let me know if I was any clearer this time.