Problem description:
The new behavior of jj bookmark track <name> (without --remote) tracks the bookmark with all remotes. I think this is a bad default in the most common situation:
When contributing with one's own fork, the remotes are often named origin and upstream. Pushing to upstream is not possible, only to origin. When creating a new bookmark and tracking it with jj bookmark track <name>, the bookmark would be tracked with upstream as well, which is bad.
It has also been pointed out that the current behavior of jj bookmark track is not idempotent, which is weird. (If foo@origin exists, the first run will only create the local foo, ignoring other remotes. The second call will track foo@*.)
Possible solution:
I mainly want to start the discussion, but here's a suggestion that seems intuitive to me:
- If there is at least one remote where a matching (untracked) bookmark already exists: track the bookmark with all of those remotes.
- If the bookmark is already tracking something and there is no remote with a yet-untracked matching bookmark: Do nothing except print a hint to specify
--remote.
- If the bookmark isn't tracking anything and no matching remote bookmark exists: absent-track the bookmark with the default remote.
Possible alternatives:
Assume this situation: local foo, foo@origin and foo@upstream exist. Only foo@origin is tracked. With my above suggestion, jj bookmark track foo would also track foo@upstream. I thought about making that a no-op instead. So, if a bookmark is already tracking anything, always require --remote to track any additional remotes. I decided against this, because I couldn't think of a situation where I wouldn't want to track the matching bookmark on other remotes as well. Also, it would be impossible (?) for the user track "all remaining remotes where a matching bookmark already exists", because there is no string pattern to express that.
cc @yuja @martinvonz @PhilipMetzger
Problem description:
The new behavior of
jj bookmark track <name>(without--remote) tracks the bookmark with all remotes. I think this is a bad default in the most common situation:When contributing with one's own fork, the remotes are often named
originandupstream. Pushing toupstreamis not possible, only toorigin. When creating a new bookmark and tracking it withjj bookmark track <name>, the bookmark would be tracked withupstreamas well, which is bad.It has also been pointed out that the current behavior of
jj bookmark trackis not idempotent, which is weird. (Iffoo@originexists, the first run will only create the local foo, ignoring other remotes. The second call will trackfoo@*.)Possible solution:
I mainly want to start the discussion, but here's a suggestion that seems intuitive to me:
--remote.Possible alternatives:
Assume this situation: local
foo,foo@originandfoo@upstreamexist. Onlyfoo@originis tracked. With my above suggestion,jj bookmark track foowould also trackfoo@upstream. I thought about making that a no-op instead. So, if a bookmark is already tracking anything, always require--remoteto track any additional remotes. I decided against this, because I couldn't think of a situation where I wouldn't want to track the matching bookmark on other remotes as well. Also, it would be impossible (?) for the user track "all remaining remotes where a matching bookmark already exists", because there is no string pattern to express that.cc @yuja @martinvonz @PhilipMetzger